Skip to content

Commit

Permalink
colima: embed version and git revision
Browse files Browse the repository at this point in the history
These are shown on `colima version`

See also abiosoft/colima#301
  • Loading branch information
Atemu committed May 21, 2022
1 parent c777cdf commit 6a06553
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pkgs/applications/virtualization/colima/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ buildGoModule rec {
owner = "abiosoft";
repo = pname;
rev = "v${version}";
sha256 = "sha256-g7q2DmtyArtW7Ii2XF5umXQ0+BlCSa1Q7VNNuIuX65k=";
sha256 = "sha256-KYW3gxf21aWnuRHkysOjArzMSNH3m3XDoi6Sic3N+Po=";

# We need the git revision
leaveDotGit = true;
postFetch = ''
git -C $out rev-parse HEAD > $out/.git-revision
rm -rf $out/.git
'';
};

nativeBuildInputs = [ installShellFiles makeWrapper ];

vendorSha256 = "sha256-Z4+qwoX04VnLsUIYRfOowFLgcaA9w8oGRl77jzFigIc=";

preConfigure = ''
ldflags="-X github.com/abiosoft/colima/config.appVersion=${version}
-X github.com/abiosoft/colima/config.revision=$(cat .git-revision)"
'';

postInstall = ''
wrapProgram $out/bin/colima \
--prefix PATH : ${lib.makeBinPath [ lima ]}
Expand Down

0 comments on commit 6a06553

Please sign in to comment.