build(nix): fetch submodules lazily

This commit is contained in:
Yusuf Bera Ertan 2021-06-21 21:03:56 +03:00 committed by Blaž Hrastnik
parent a70de6e980
commit 6dddd5cd1d
2 changed files with 31 additions and 43 deletions

37
flake.lock generated
View file

@ -31,24 +31,6 @@
"type": "github"
}
},
"helix": {
"flake": false,
"locked": {
"lastModified": 1624077450,
"narHash": "sha256-gcL519tetuEv0N+oBP8X3U4bPjwcAgzbPdgwW19qeVI=",
"ref": "master",
"rev": "1c2585202145467f0fde7ad9c571e462081c3656",
"revCount": 894,
"submodules": true,
"type": "git",
"url": "https://github.com/helix-editor/helix.git"
},
"original": {
"submodules": true,
"type": "git",
"url": "https://github.com/helix-editor/helix.git"
}
},
"nixCargoIntegration": {
"inputs": {
"devshell": "devshell",
@ -58,11 +40,11 @@
"rustOverlay": "rustOverlay"
},
"locked": {
"lastModified": 1624070370,
"narHash": "sha256-sfFqfmerCYvk0jDeP1gfuskz7AaqDsgV8aiQrEUGdsc=",
"lastModified": 1624244973,
"narHash": "sha256-h+b4CwPjyibgwMYAeBaT5qBnxI0fsmGf66k23FqEH5Y=",
"owner": "yusdacra",
"repo": "nix-cargo-integration",
"rev": "85e6c1ba4c0e3e6dec5a7d1f65bcc036d2ea6ae3",
"rev": "00f5df6d8e7eeeac2764b7fa2c57e2e81f5d47cd",
"type": "github"
},
"original": {
@ -73,11 +55,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1623580589,
"narHash": "sha256-Ayp1cjXpwFCkAiWUE46rj9APTltsiEBdIs2+cj+U7+c=",
"lastModified": 1624024598,
"narHash": "sha256-X++38oH5MKEmPW4/2WdMaHQvwJzO8pJfbnzMD7DbG1E=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "fa0326ce5233f7d592271df52c9d0812bec47b84",
"rev": "33d42ad7cf2769ce6364ed4e52afa8e9d1439d58",
"type": "github"
},
"original": {
@ -90,7 +72,6 @@
"root": {
"inputs": {
"flakeCompat": "flakeCompat",
"helix": "helix",
"nixCargoIntegration": "nixCargoIntegration",
"nixpkgs": "nixpkgs"
}
@ -98,11 +79,11 @@
"rustOverlay": {
"flake": false,
"locked": {
"lastModified": 1624069337,
"narHash": "sha256-9mTcx7osE4biF2Hm/GU19s1T3+KvphWj4QaUcJh39lU=",
"lastModified": 1624242197,
"narHash": "sha256-J0+j4DYFaE0O0marb4QN/S1bUhpGwAjQ4O04kIYKcb8=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "67dc2a9543a7c24591e6cb102ad0121c3a704aab",
"rev": "df5d330f34b64194d64dcbafb91e82e01a89a229",
"type": "github"
},
"original": {

View file

@ -11,15 +11,9 @@
url = "github:edolstra/flake-compat";
flake = false;
};
helix = {
url = "https://github.com/helix-editor/helix.git";
type = "git";
flake = false;
submodules = true;
};
};
outputs = inputs@{ nixCargoIntegration, helix, ... }:
outputs = inputs@{ self, nixCargoIntegration, ... }:
nixCargoIntegration.lib.makeOutputs {
root = ./.;
buildPlatform = "crate2nix";
@ -29,18 +23,31 @@
defaultOutputs = { app = "hx"; package = "helix"; };
overrides = {
crateOverrides = common: _: {
helix-term = prev: { buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ]; };
helix-term = prev: {
# link languages and theme toml files since helix-term expects them (for tests)
preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} ..";
buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ];
};
# link runtime since helix-core expects it because of embed_runtime feature
helix-core = _: { preConfigure = "ln -s ${common.root + "/runtime"} ../runtime"; };
# link languages and theme toml files since helix-view expects them
helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} .."; };
helix-syntax = prev: {
src = common.pkgs.runCommand prev.src.name { } ''
mkdir -p $out
ln -s ${prev.src}/* $out
ln -sf ${helix}/helix-syntax/languages $out
'';
};
helix-syntax = prev:
let
helix = common.pkgs.fetchgit {
url = "https://github.com/helix-editor/helix.git";
rev = "9fd17d4ff5b81211317da1a28d2b30442a512ffc";
fetchSubmodules = true;
sha256 = "sha256-y652sn/tCc1XoKr3YxDZv6bS2Cmr6+9K/wzzNAMFZJw=";
};
in
{
src = common.pkgs.runCommand prev.src.name { } ''
mkdir -p $out
ln -s ${prev.src}/* $out
ln -sf ${helix}/helix-syntax/languages $out
'';
};
};
shell = common: prev: {
packages = prev.packages ++ (with common.pkgs; [ lld_10 lldb ]);