-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
47 lines (40 loc) · 1.09 KB
/
default.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ lib, fetchFromGitHub, buildGoModule }:
let
version = "0.12.0";
in
buildGoModule {
pname = "nsv";
inherit version;
env.CGO_ENABLED = 0;
src = fetchFromGitHub {
owner = "purpleclay";
repo = "nsv";
rev = "v${version}";
leaveDotGit = true;
postFetch = ''
cd "$out"
git rev-parse HEAD > $out/COMMIT
git log -1 --format=%cI > $out/BUILD_DATE
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
hash = "sha256-237VgC1n4pTigB40PnuLAqQyC9/X7ebn/n2CyZvPhUM=";
};
vendorHash = "sha256-x5R2eAGEfVZWo+eh7KwMd0Q5aKx95qgVvrOrT6suh8g=";
meta = with lib; {
homepage = "https://github.com/purpleclay/nsv";
changelog = "https://github.com/purpleclay/nsv/releases/tag/v${version}";
description = "Semantic versioning without any config";
license = licenses.mit;
maintainers = with maintainers; [ purpleclay ];
};
ldflags = [
"-s"
"-w"
"-X main.version=v${version}"
"-X main.gitBranch=main"
];
preBuild = ''
ldflags+=" -X main.gitCommit=$(cat COMMIT) -X main.buildDate=$(cat BUILD_DATE)"
'';
doCheck = false;
}