on master help sign in
build(nix): fix build issues
commit41f62c31572ce05080e8a3469457895f0de7c6e8 authorYusuf Bera Ertan <y.bera003.06@protonmail.com> dateSat 24 Jul 2021, 21:36 (5 years ago) parent6a8a01d
2 files changed+52−27
flake.lock+12−12 flake.nix+40−15
flake.lock+12−12
@@ -2,11 +2,11 @@
22 "nodes": {
33 "devshell": {
44 "locked": {
5− "lastModified": 1622711433,
6− "narHash": "sha256-rGjXz7FA7HImAT3TtoqwecByLO5yhVPSwPdaYPBFRQw=",
5+ "lastModified": 1625086391,
6+ "narHash": "sha256-IpNPv1v8s4L3CoxhwcgZIitGpcrnNgnj09X7TA0QV3k=",
77 "owner": "numtide",
88 "repo": "devshell",
9− "rev": "1f4fb67b662b65fa7cfe696fc003fcc1e8f7cc36",
9+ "rev": "4b5ac7cf7d9a1cc60b965bb51b59922f2210cbc7",
1010 "type": "github"
1111 },
1212 "original": {
@@ -40,11 +40,11 @@
4040 "rustOverlay": "rustOverlay"
4141 },
4242 "locked": {
43− "lastModified": 1624244973,
44− "narHash": "sha256-h+b4CwPjyibgwMYAeBaT5qBnxI0fsmGf66k23FqEH5Y=",
43+ "lastModified": 1627106928,
44+ "narHash": "sha256-JaQE0BEk1G1eT539WbYyrA2re4YYL9xo7cB+ZiV4nNM=",
4545 "owner": "yusdacra",
4646 "repo": "nix-cargo-integration",
47− "rev": "00f5df6d8e7eeeac2764b7fa2c57e2e81f5d47cd",
47+ "rev": "e08af05413a2d53dadbd1a39976e1da0e5385970",
4848 "type": "github"
4949 },
5050 "original": {
@@ -55,11 +55,11 @@
5555 },
5656 "nixpkgs": {
5757 "locked": {
58− "lastModified": 1624024598,
59− "narHash": "sha256-X++38oH5MKEmPW4/2WdMaHQvwJzO8pJfbnzMD7DbG1E=",
58+ "lastModified": 1626852498,
59+ "narHash": "sha256-lOXUJvi0FJUXHTVSiC5qsMRtEUgqM4mGZpMESLuGhmo=",
6060 "owner": "nixos",
6161 "repo": "nixpkgs",
62− "rev": "33d42ad7cf2769ce6364ed4e52afa8e9d1439d58",
62+ "rev": "16105403bdd843540cbef9c63fc0f16c1c6eaa70",
6363 "type": "github"
6464 },
6565 "original": {
@@ -79,11 +79,11 @@
7979 "rustOverlay": {
8080 "flake": false,
8181 "locked": {
82− "lastModified": 1624242197,
83− "narHash": "sha256-J0+j4DYFaE0O0marb4QN/S1bUhpGwAjQ4O04kIYKcb8=",
82+ "lastModified": 1627092891,
83+ "narHash": "sha256-6nN+rfsP+SNpnL3UPbrcwZe4qfh9/NH0LWtXhn9w/a4=",
8484 "owner": "oxalica",
8585 "repo": "rust-overlay",
86− "rev": "df5d330f34b64194d64dcbafb91e82e01a89a229",
86+ "rev": "939f2cf1aebc86bc3e9544645b495cd05995524a",
8787 "type": "github"
8888 },
8989 "original": {
flake.nix+40−15
@@ -28,27 +28,53 @@
2828 preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} ..";
2929 buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ];
3030 };
31− # link runtime since helix-core expects it because of embed_runtime feature
32− helix-core = _: { preConfigure = "ln -s ${common.root + "/runtime"} ../runtime"; };
3331 # link languages and theme toml files since helix-view expects them
3432 helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml} .."; };
35− helix-syntax = prev:
36− let
37− helix = common.pkgs.fetchgit {
38− url = "https://github.com/helix-editor/helix.git";
39− rev = "9fd17d4ff5b81211317da1a28d2b30442a512ffc";
40− fetchSubmodules = true;
41− sha256 = "sha256-y652sn/tCc1XoKr3YxDZv6bS2Cmr6+9K/wzzNAMFZJw=";
42− };
43− in
44− {
45− src = common.pkgs.runCommand prev.src.name { } ''
33+ helix-syntax = prev: {
34+ src =
35+ let
36+ pkgs = common.pkgs;
37+ helix = pkgs.fetchgit {
38+ url = "https://github.com/helix-editor/helix.git";
39+ rev = "d4bd5b37669708361a0a6cd2917464b010e6b7f5";
40+ fetchSubmodules = true;
41+ sha256 = "sha256-KayR7K7UC0mT6EjHsZsCYY9IVDJzft63fGpPKGSY8nQ=";
42+ };
43+ in
44+ pkgs.runCommand prev.src.name { } ''
4645 mkdir -p $out
4746 ln -s ${prev.src}/* $out
4847 ln -sf ${helix}/helix-syntax/languages $out
4948 '';
50− };
49+ preConfigure = "mkdir -p ../runtime/grammars";
50+ postInstall = "cp -r ../runtime $out/runtime";
51+ };
5152 };
53+ mainBuild = common: prev:
54+ let
55+ inherit (common) pkgs lib;
56+ helixSyntax = lib.buildCrate {
57+ root = self;
58+ memberName = "helix-syntax";
59+ defaultCrateOverrides = {
60+ helix-syntax = common.crateOverrides.helix-syntax;
61+ };
62+ release = false;
63+ };
64+ runtimeDir = pkgs.runCommand "helix-runtime" { } ''
65+ mkdir -p $out
66+ ln -s ${common.root}/runtime/* $out
67+ ln -sf ${helixSyntax}/runtime/grammars $out
68+ '';
69+ in
70+ lib.optionalAttrs (common.memberName == "helix-term") {
71+ nativeBuildInputs = [ pkgs.makeWrapper ];
72+ postFixup = ''
73+ if [ -f "$out/bin/hx" ]; then
74+ wrapProgram "$out/bin/hx" --set HELIX_RUNTIME "${runtimeDir}"
75+ fi
76+ '';
77+ };
5278 shell = common: prev: {
5379 packages = prev.packages ++ (with common.pkgs; [ lld_10 lldb cargo-tarpaulin ]);
5480 env = prev.env ++ [
@@ -57,7 +83,6 @@
5783 { name = "RUSTFLAGS"; value = "-C link-arg=-fuse-ld=lld -C target-cpu=native"; }
5884 ];
5985 };
60− build = _: prev: { rootFeatures = prev.rootFeatures ++ [ "embed_runtime" ]; };
6186 };
6287 };
6388}