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

View File

@ -31,24 +31,6 @@
"type": "github" "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": { "nixCargoIntegration": {
"inputs": { "inputs": {
"devshell": "devshell", "devshell": "devshell",
@ -58,11 +40,11 @@
"rustOverlay": "rustOverlay" "rustOverlay": "rustOverlay"
}, },
"locked": { "locked": {
"lastModified": 1624070370, "lastModified": 1624244973,
"narHash": "sha256-sfFqfmerCYvk0jDeP1gfuskz7AaqDsgV8aiQrEUGdsc=", "narHash": "sha256-h+b4CwPjyibgwMYAeBaT5qBnxI0fsmGf66k23FqEH5Y=",
"owner": "yusdacra", "owner": "yusdacra",
"repo": "nix-cargo-integration", "repo": "nix-cargo-integration",
"rev": "85e6c1ba4c0e3e6dec5a7d1f65bcc036d2ea6ae3", "rev": "00f5df6d8e7eeeac2764b7fa2c57e2e81f5d47cd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -73,11 +55,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1623580589, "lastModified": 1624024598,
"narHash": "sha256-Ayp1cjXpwFCkAiWUE46rj9APTltsiEBdIs2+cj+U7+c=", "narHash": "sha256-X++38oH5MKEmPW4/2WdMaHQvwJzO8pJfbnzMD7DbG1E=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "fa0326ce5233f7d592271df52c9d0812bec47b84", "rev": "33d42ad7cf2769ce6364ed4e52afa8e9d1439d58",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -90,7 +72,6 @@
"root": { "root": {
"inputs": { "inputs": {
"flakeCompat": "flakeCompat", "flakeCompat": "flakeCompat",
"helix": "helix",
"nixCargoIntegration": "nixCargoIntegration", "nixCargoIntegration": "nixCargoIntegration",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
@ -98,11 +79,11 @@
"rustOverlay": { "rustOverlay": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1624069337, "lastModified": 1624242197,
"narHash": "sha256-9mTcx7osE4biF2Hm/GU19s1T3+KvphWj4QaUcJh39lU=", "narHash": "sha256-J0+j4DYFaE0O0marb4QN/S1bUhpGwAjQ4O04kIYKcb8=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "67dc2a9543a7c24591e6cb102ad0121c3a704aab", "rev": "df5d330f34b64194d64dcbafb91e82e01a89a229",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -11,15 +11,9 @@
url = "github:edolstra/flake-compat"; url = "github:edolstra/flake-compat";
flake = false; 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 { nixCargoIntegration.lib.makeOutputs {
root = ./.; root = ./.;
buildPlatform = "crate2nix"; buildPlatform = "crate2nix";
@ -29,12 +23,25 @@
defaultOutputs = { app = "hx"; package = "helix"; }; defaultOutputs = { app = "hx"; package = "helix"; };
overrides = { overrides = {
crateOverrides = common: _: { 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 # link runtime since helix-core expects it because of embed_runtime feature
helix-core = _: { preConfigure = "ln -s ${common.root + "/runtime"} ../runtime"; }; helix-core = _: { preConfigure = "ln -s ${common.root + "/runtime"} ../runtime"; };
# link languages and theme toml files since helix-view expects them # link languages and theme toml files since helix-view expects them
helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} .."; }; helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} .."; };
helix-syntax = prev: { 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 { } '' src = common.pkgs.runCommand prev.src.name { } ''
mkdir -p $out mkdir -p $out
ln -s ${prev.src}/* $out ln -s ${prev.src}/* $out