@@ -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}