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