Pass flake git rev down to package ldflags

This commit is contained in:
Tim Van Baak 2025-05-02 15:01:33 -07:00
parent cb6e3b72a8
commit 24fb9ac79e
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,7 @@
inherit (nixpkgs.lib) nixosSystem;
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
gitRev = toString (self.rev or self.dirtyRev or "0000000000000000000000000000000000000000");
in
{
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
@ -48,7 +49,7 @@
};
overlays.default = final: prev: {
intake = final.callPackage ./package.nix { };
intake = final.callPackage ./package.nix { inherit gitRev; };
};
nixosModules.default = import ./module.nix self;

View File

@ -2,6 +2,7 @@
buildGoModule,
jq,
lib,
gitRev ? "0000000000000000000000000000000000000000"
}:
let
inherit (lib.fileset)
@ -25,6 +26,10 @@ buildGoModule {
};
vendorHash = "sha256-sv4rlURaTatxJ5atYWYzD2O4EiuPp66i0RY5lQzhBKU=";
ldflags = [
"-X github.com/Jaculabilis/intake/core.Commit=${gitRev}"
];
nativeBuildInputs = [ jq ];
meta = { };