@@ -18,83 +18,115 @@
19 nixCargoIntegration,
19 nixCargoIntegration,
22− nixCargoIntegration.lib.makeOutputs {
23+ nixCargoIntegration.lib.makeOutputs {
23− root = ./.;
24+ root = ./.;
24− renameOutputs = {"helix-term" = "helix";};
25+ renameOutputs = {"helix-term" = "helix";};
25− # Set default app to hx (binary is from helix-term release build)
26+ # Set default app to hx (binary is from helix-term release build)
26− # Set default package to helix-term release build
27+ # Set default package to helix-term release build
27− defaultOutputs = {
28+ defaultOutputs = {
28− app = "hx";
29+ app = "hx";
29− package = "helix";
30+ package = "helix";
31− overrides = {
32+ overrides = {
32− cCompiler = common:
33+ cCompiler = common:
33− with common.pkgs;
34+ with common.pkgs;
34− if stdenv.isLinux
35+ if stdenv.isLinux
36− else clang;
37+ else clang;
37− crateOverrides = common: _: {
38+ crateOverrides = common: _: {
38− helix-term = prev: let
39+ helix-term = prev: let
39− inherit (common) pkgs;
40+ inherit (common) pkgs;
40− mkRootPath = rel:
41+ mkRootPath = rel:
41− builtins.path {
42+ builtins.path {
42− path = "${common.root}/${rel}";
43+ path = "${common.root}/${rel}";
43− name = rel;
44+ name = rel;
45− grammars = pkgs.callPackage ./grammars.nix {};
46+ grammars = pkgs.callPackage ./grammars.nix config;
46− runtimeDir = pkgs.runCommandNoCC "helix-runtime" {} ''
47+ runtimeDir = pkgs.runCommandNoCC "helix-runtime" {} ''
47− mkdir -p $out
48+ mkdir -p $out
48− ln -s ${mkRootPath "runtime"}/* $out
49+ ln -s ${mkRootPath "runtime"}/* $out
49− rm -r $out/grammars
50+ rm -r $out/grammars
50− ln -s ${grammars} $out/grammars
51+ ln -s ${grammars} $out/grammars
52− in {
53+ overridedAttrs = {
53− # disable fetching and building of tree-sitter grammars in the helix-term build.rs
54+ # disable fetching and building of tree-sitter grammars in the helix-term build.rs
54− HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
55+ HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
55− # link languages and theme toml files since helix-term expects them (for tests)
56+ # link languages and theme toml files since helix-term expects them (for tests)
56− preConfigure =
57+ preConfigure =
57− pkgs.lib.concatMapStringsSep
58+ pkgs.lib.concatMapStringsSep
59− (path: "ln -sf ${mkRootPath path} ..")
60+ (path: "ln -sf ${mkRootPath path} ..")
60− ["languages.toml" "theme.toml" "base16_theme.toml"];
61+ ["languages.toml" "theme.toml" "base16_theme.toml"];
61− buildInputs = (prev.buildInputs or []) ++ [common.cCompiler.cc.lib];
62+ buildInputs = (prev.buildInputs or []) ++ [common.cCompiler.cc.lib];
62− nativeBuildInputs = [pkgs.makeWrapper];
63+ nativeBuildInputs = [pkgs.makeWrapper];
64− postFixup = ''
65+ postFixup = ''
65− if [ -f "$out/bin/hx" ]; then
66+ if [ -f "$out/bin/hx" ]; then
66− wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
67+ wrapProgram "$out/bin/hx" ''${makeWrapperArgs[@]} --set HELIX_RUNTIME "${runtimeDir}"
74+ pkgs.lib.optionalAttrs
75+ (config ? makeWrapperArgs)
76+ {inherit (config) makeWrapperArgs;}
79+ shell = common: prev: {
83+ with common.pkgs; [lld_13 lldb cargo-tarpaulin cargo-flamegraph rust-analyzer]
89+ name = "HELIX_RUNTIME";
90+ eval = "$PWD/runtime";
93+ name = "RUST_BACKTRACE";
99+ if common.pkgs.stdenv.isLinux
100+ then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"
71− shell = common: prev: {
75− with common.pkgs; [lld_13 lldb cargo-tarpaulin cargo-flamegraph rust-analyzer]
81− name = "HELIX_RUNTIME";
82− eval = "$PWD/runtime";
85− name = "RUST_BACKTRACE";
91− if common.pkgs.stdenv.isLinux
92− then "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"
107+ defaultOutputs = outputs {};
108+ makeOverridableHelix = system: old:
112+ makeOverridableHelix
114+ (outputs args).packages.${system}.helix;
120+ nixpkgs.lib.mapAttrs
126+ helix = makeOverridableHelix system packages.helix;
129+ defaultOutputs.packages;
100 nixConfig = {
132 nixConfig = {