forked from abiosoft/colima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
colima.nix
32 lines (26 loc) · 1011 Bytes
/
colima.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ pkgs ? import <nixpkgs> }:
with pkgs;
buildGo120Module {
name = "colima";
pname = "colima";
src = ./.;
nativeBuildInputs = [ installShellFiles makeWrapper git ];
vendorSha256 = "sha256-7DIhSjHpaCyHyXKhR8KWQc2YGaD8CMq+BZHF4zIkL50=";
CGO_ENABLED = 1;
subPackages = [ "cmd/colima" ];
# `nix-build` has .git folder but `nix build` does not, this caters for both cases
preConfigure = ''
export VERSION="$(git describe --tags --always || echo nix-build-at-"$(date +%s)")"
export REVISION="$(git rev-parse HEAD || echo nix-unknown)"
ldflags="-X github.com/abiosoft/colima/config.appVersion=$VERSION
-X github.com/abiosoft/colima/config.revision=$REVISION"
'';
postInstall = ''
wrapProgram $out/bin/colima \
--prefix PATH : ${lib.makeBinPath [ qemu lima ]}
installShellCompletion --cmd colima \
--bash <($out/bin/colima completion bash) \
--fish <($out/bin/colima completion fish) \
--zsh <($out/bin/colima completion zsh)
'';
}