Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--default.nix6
-rw-r--r--flake.nix25
2 files changed, 19 insertions, 12 deletions
diff --git a/default.nix b/default.nix
index 5020c406..d6406400 100644
--- a/default.nix
+++ b/default.nix
@@ -5,6 +5,7 @@
runCommand,
installShellFiles,
git,
+ gitRev ? null,
...
}: let
fs = lib.fileset;
@@ -34,9 +35,6 @@
ln -s ${grammars} $out/grammars
'';
in
- # Currently rustPlatform.buildRustPackage doesn't have the finalAttrs pattern
- # hooked up. To get around this while having good customization, mkDerivation is
- # used instead.
rustPlatform.buildRustPackage (self: {
cargoLock = {
lockFile = ./Cargo.lock;
@@ -63,7 +61,7 @@ in
HELIX_DISABLE_AUTO_GRAMMAR_BUILD = "1";
# So Helix knows what rev it is.
- HELIX_NIX_BUILD_REV = self.rev or self.dirtyRev or null;
+ HELIX_NIX_BUILD_REV = gitRev;
doCheck = false;
strictDeps = true;
diff --git a/flake.nix b/flake.nix
index 7d176cb0..0a92e23d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -16,7 +16,9 @@
flake-utils,
rust-overlay,
...
- }:
+ }: let
+ gitRev = self.rev or self.dirtyRev or null;
+ in
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
@@ -31,13 +33,20 @@
};
in {
packages = rec {
- helix = pkgs.callPackage ./default.nix {};
+ helix = pkgs.callPackage ./default.nix {inherit gitRev;};
- # The default Helix build. Uses the latest stable Rust toolchain, and unstable
- # nixpkgs.
- #
- # This can be overridden though to add Cargo Features, flags, and different toolchains with
- # packages.${system}.default.override { ... };
+ /**
+ The default Helix build. Uses the latest stable Rust toolchain, and unstable
+ nixpkgs.
+
+ The build inputs can be overriden with the following:
+
+ packages.${system}.default.override { rustPlatform = newPlatform; };
+
+ Overriding a derivation attribute can be done as well:
+
+ packages.${system}.default.overrideAttrs { buildType = "debug"; };
+ */
default = helix;
};
@@ -71,7 +80,7 @@
})
// {
overlays.default = final: prev: {
- helix = final.callPackage ./default.nix {};
+ helix = final.callPackage ./default.nix {inherit gitRev;};
};
};