11 src = fetchFromGitHub {
12 owner = "chainguard-dev";
15 hash = "sha256-bFlILwA8Vy7u8pJFx8PHvfYaeh8M2SRzrTpdDMYz6+M=";
16 # populate values that require us to use git. By doing this in postFetch we
17 # can delete .git afterwards and maintain better reproducibility of the src.
21 git rev-parse HEAD > $out/COMMIT
22 # in format of 0000-00-00T00:00:00Z
23 date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH
24 find "$out" -name .git -print0 | xargs -0 rm -rf
28 vendorHash = "sha256-xOsxzDIk2tuPXDtf1k0604B3AYgxEH5iQ/YdDs2Aezs=";
30 subPackages = [ "." ];
32 nativeBuildInputs = [ installShellFiles ];
37 "-X sigs.k8s.io/release-utils/version.gitVersion=v${version}"
38 "-X sigs.k8s.io/release-utils/version.gitTreeState=clean"
41 # ldflags based on metadata from git and source
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)"
48 installShellCompletion --cmd melange \
49 --bash <($out/bin/melange completion bash) \
50 --fish <($out/bin/melange completion fish) \
51 --zsh <($out/bin/melange completion zsh)
54 doInstallCheck = true;
56 installCheckPhase = ''
57 runHook preInstallCheck
59 $out/bin/melange --help
60 $out/bin/melange version 2>&1 | grep "v${version}"
62 runHook postInstallCheck
66 homepage = "https://github.com/chainguard-dev/melange";
67 changelog = "https://github.com/chainguard-dev/melange/blob/${src.rev}/NEWS.md";
68 description = "Build APKs from source code";
69 mainProgram = "melange";
70 license = licenses.asl20;
71 maintainers = with maintainers; [ developer-guy ];