Skip to content

Commit

Permalink
Fix the git hash missing and add some more comments. (#13024)
Browse files Browse the repository at this point in the history
  • Loading branch information
RossSmyth authored Mar 4, 2025
1 parent fbc0f95 commit b1ee4ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
6 changes: 2 additions & 4 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
runCommand,
installShellFiles,
git,
gitRev ? null,
...
}: let
fs = lib.fileset;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
25 changes: 17 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
};

Expand Down Expand Up @@ -71,7 +80,7 @@
})
// {
overlays.default = final: prev: {
helix = final.callPackage ./default.nix {};
helix = final.callPackage ./default.nix {inherit gitRev;};
};
};

Expand Down

0 comments on commit b1ee4ab

Please sign in to comment.