build(nix): fix build issues

This commit is contained in:
Yusuf Bera Ertan 2021-07-24 21:36:35 +03:00 committed by Blaž Hrastnik
parent 6a8a01df6b
commit 41f62c3157
2 changed files with 52 additions and 27 deletions

View File

@ -2,11 +2,11 @@
"nodes": {
"devshell": {
"locked": {
"lastModified": 1622711433,
"narHash": "sha256-rGjXz7FA7HImAT3TtoqwecByLO5yhVPSwPdaYPBFRQw=",
"lastModified": 1625086391,
"narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=",
"owner": "numtide",
"repo": "devshell",
"rev": "1f4fb67b662b65fa7cfe696fc003fcc1e8f7cc36",
"rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7",
"type": "github"
},
"original": {
@ -40,11 +40,11 @@
"rustOverlay": "rustOverlay"
},
"locked": {
"lastModified": 1624244973,
"narHash": "sha256-h+b4CwPjyibgwMYAeBaT5qBnxI0fsmGf66k23FqEH5Y=",
"lastModified": 1627106928,
"narHash": "sha256-JaQE0BEk1G1eT539WbYyrA2re4YYL9xo7cB+ZiV4nNM=",
"owner": "yusdacra",
"repo": "nix-cargo-integration",
"rev": "00f5df6d8e7eeeac2764b7fa2c57e2e81f5d47cd",
"rev": "e08af05413a2d53dadbd1a39976e1da0e5385970",
"type": "github"
},
"original": {
@ -55,11 +55,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1624024598,
"narHash": "sha256-X++38oH5MKEmPW4/2WdMaHQvwJzO8pJfbnzMD7DbG1E=",
"lastModified": 1626852498,
"narHash": "sha256-lOXUJvi0FJUXHTVSiC5qsMRtEUgqM4mGZpMESLuGhmo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "33d42ad7cf2769ce6364ed4e52afa8e9d1439d58",
"rev": "16105403bdd843540cbef9c63fc0f16c1c6eaa70",
"type": "github"
},
"original": {
@ -79,11 +79,11 @@
"rustOverlay": {
"flake": false,
"locked": {
"lastModified": 1624242197,
"narHash": "sha256-J0+j4DYFaE0O0marb4QN/S1bUhpGwAjQ4O04kIYKcb8=",
"lastModified": 1627092891,
"narHash": "sha256-6nN+rfsP+SNpnL3UPbrcwZe4qfh9/NH0LWtXhn9w/a4=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "df5d330f34b64194d64dcbafb91e82e01a89a229",
"rev": "939f2cf1aebc86bc3e9544645b495cd05995524a",
"type": "github"
},
"original": {

View File

@ -28,27 +28,53 @@
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:
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 { } ''
helix-syntax = prev: {
src =
let
pkgs = common.pkgs;
helix = pkgs.fetchgit {
url = "https://github.com/helix-editor/helix.git";
rev = "d4bd5b37669708361a0a6cd2917464b010e6b7f5";
fetchSubmodules = true;
sha256 = "sha256-KayR7K7UC0mT6EjHsZsCYY9IVDJzft63fGpPKGSY8nQ=";
};
in
pkgs.runCommand prev.src.name { } ''
mkdir -p $out
ln -s ${prev.src}/* $out
ln -sf ${helix}/helix-syntax/languages $out
'';
};
preConfigure = "mkdir -p ../runtime/grammars";
postInstall = "cp -r ../runtime $out/runtime";
};
};
mainBuild = common: prev:
let
inherit (common) pkgs lib;
helixSyntax = lib.buildCrate {
root = self;
memberName = "helix-syntax";
defaultCrateOverrides = {
helix-syntax = common.crateOverrides.helix-syntax;
};
release = false;
};
runtimeDir = pkgs.runCommand "helix-runtime" { } ''
mkdir -p $out
ln -s ${common.root}/runtime/* $out
ln -sf ${helixSyntax}/runtime/grammars $out
'';
in
lib.optionalAttrs (common.memberName == "helix-term") {
nativeBuildInputs = [ pkgs.makeWrapper ];
postFixup = ''
if [ -f "$out/bin/hx" ]; then
wrapProgram "$out/bin/hx" --set HELIX_RUNTIME "${runtimeDir}"
fi
'';
};
shell = common: prev: {
packages = prev.packages ++ (with common.pkgs; [ lld_10 lldb cargo-tarpaulin ]);
env = prev.env ++ [
@ -57,7 +83,6 @@
{ name = "RUSTFLAGS"; value = "-C link-arg=-fuse-ld=lld -C target-cpu=native"; }
];
};
build = _: prev: { rootFeatures = prev.rootFeatures ++ [ "embed_runtime" ]; };
};
};
}