Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 67 lines 1.9 kB view raw
1{ 2 lib, 3 buildGoModule, 4 fetchFromGitHub, 5 installShellFiles, 6 versionCheckHook, 7}: 8 9buildGoModule rec { 10 pname = "vexctl"; 11 version = "0.3.0"; 12 13 src = fetchFromGitHub { 14 owner = "openvex"; 15 repo = "vexctl"; 16 tag = "v${version}"; 17 hash = "sha256-rJK9OTaEF0PU12m7voMUHPHI2/Je7wh6w2Zr1Ug8+1w="; 18 # populate values that require us to use git. By doing this in postFetch we 19 # can delete .git afterwards and maintain better reproducibility of the src. 20 leaveDotGit = true; 21 postFetch = '' 22 cd "$out" 23 git rev-parse HEAD > $out/COMMIT 24 # '0000-00-00T00:00:00Z' 25 date -u -d "@$(git log -1 --pretty=%ct)" "+'%Y-%m-%dT%H:%M:%SZ'" > $out/SOURCE_DATE_EPOCH 26 find "$out" -name .git -print0 | xargs -0 rm -rf 27 ''; 28 }; 29 30 vendorHash = "sha256-YVMg9tjwJmrqxB2GmVuLkzsGXGlpp5gmZZTmv+PGWPc="; 31 32 nativeBuildInputs = [ installShellFiles ]; 33 34 ldflags = [ 35 "-s" 36 "-w" 37 "-X sigs.k8s.io/release-utils/version.gitVersion=v${version}" 38 "-X sigs.k8s.io/release-utils/version.gitTreeState=clean" 39 ]; 40 41 # ldflags based on metadata from git and source 42 preBuild = '' 43 ldflags+=" -X sigs.k8s.io/release-utils/version.gitCommit=$(cat COMMIT)" 44 ldflags+=" -X sigs.k8s.io/release-utils/version.buildDate=$(cat SOURCE_DATE_EPOCH)" 45 ''; 46 47 postInstall = '' 48 installShellCompletion --cmd vexctl \ 49 --bash <($out/bin/vexctl completion bash) \ 50 --fish <($out/bin/vexctl completion fish) \ 51 --zsh <($out/bin/vexctl completion zsh) 52 ''; 53 54 doInstallCheck = true; 55 56 nativeInstallCheckInputs = [ versionCheckHook ]; 57 58 versionCheckProgramArg = "version"; 59 60 meta = { 61 homepage = "https://github.com/openvex/vexctl"; 62 description = "Tool to create, transform and attest VEX metadata"; 63 mainProgram = "vexctl"; 64 license = lib.licenses.asl20; 65 maintainers = with lib.maintainers; [ jk ]; 66 }; 67}