aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix81
1 files changed, 29 insertions, 52 deletions
diff --git a/flake.nix b/flake.nix
index 9b3e1657..71825431 100644
--- a/flake.nix
+++ b/flake.nix
@@ -12,68 +12,45 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.rustOverlay.follows = "rust-overlay";
};
+ # NOTE: the flake looks like it is hanging when it pulls this input because
+ # the submodules take a long time to clone. This will be fixed in #1659.
+ helix = {
+ url = "https://github.com/helix-editor/helix.git";
+ type = "git";
+ submodules = true;
+ flake = false;
+ };
};
- outputs = inputs@{ self, nixCargoIntegration, ... }:
+ outputs = inputs@{ nixCargoIntegration, helix, ... }:
nixCargoIntegration.lib.makeOutputs {
root = ./.;
- buildPlatform = "crate2nix";
renameOutputs = { "helix-term" = "helix"; };
# Set default app to hx (binary is from helix-term release build)
# Set default package to helix-term release build
- defaultOutputs = { app = "hx"; package = "helix"; };
+ defaultOutputs = {
+ app = "hx";
+ package = "helix";
+ };
overrides = {
crateOverrides = common: _: rec {
- # link languages and theme toml files since helix-core/helix-view expects them
- helix-core = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml,base16_theme.toml} .."; };
- helix-view = _: { preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml,base16_theme.toml} .."; };
- helix-syntax = prev: {
- src =
- let
- pkgs = common.pkgs;
- helix = pkgs.fetchgit {
- url = "https://github.com/helix-editor/helix.git";
- rev = "d62ad8b595a4f901b9c5dba1bb6e8f70ece395bf";
- fetchSubmodules = true;
- sha256 = "sha256-X0N2clg2DQQ2bwyBrZVeaXLoSKaQ7NALydnd2eJzECg=";
- };
- 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";
+ helix-term = prev: {
+ buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ];
+ nativeBuildInputs = (prev.nativeBuildInputs or [ ]) ++ [ common.pkgs.makeWrapper ];
+ preConfigure = ''
+ ${prev.preConfigure}
+ rm -r helix-syntax/languages
+ ln -s ${helix}/helix-syntax/languages helix-syntax/languages
+ ln -s "$PWD/helix-syntax/languages" languages
+ mkdir -p runtime/grammars
+ '';
+ postInstall = ''
+ ${prev.postInstall or ""}
+ mkdir -p $out/lib
+ cp -r runtime $out/lib
+ wrapProgram "$out/bin/hx" --set HELIX_RUNTIME "$out/lib/runtime"
+ '';
};
- helix-term = prev:
- let
- inherit (common) pkgs lib;
- helixSyntax = lib.buildCrate {
- root = self;
- memberName = "helix-syntax";
- defaultCrateOverrides = {
- helix-syntax = 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
- {
- # link languages and theme toml files since helix-term expects them (for tests)
- preConfigure = "ln -s ${common.root}/{languages.toml,theme.toml,base16_theme.toml} ..";
- buildInputs = (prev.buildInputs or [ ]) ++ [ common.cCompiler.cc.lib ];
- 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_13 lldb cargo-tarpaulin cargo-flamegraph ]);