1{ lib
2, buildGoModule
3, fetchFromGitHub
4, installShellFiles
5}:
6
7let config-module = "github.com/f1bonacc1/process-compose/src/config";
8in
9buildGoModule rec {
10 pname = "process-compose";
11 version = "0.69.0";
12
13 src = fetchFromGitHub {
14 owner = "F1bonacc1";
15 repo = pname;
16 rev = "v${version}";
17 hash = "sha256-YVNcr8oYEOsy0KLOsPdWTZcXYTqyz4RYG9MCEngLn7c=";
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 --short HEAD > $out/COMMIT
24 # in format of 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 # ldflags based on metadata from git and source
31 preBuild = ''
32 ldflags+=" -X ${config-module}.Commit=$(cat COMMIT)"
33 ldflags+=" -X ${config-module}.Date=$(cat SOURCE_DATE_EPOCH)"
34 '';
35
36 ldflags = [
37 "-X ${config-module}.Version=v${version}"
38 "-s"
39 "-w"
40 ];
41
42 nativeBuildInputs = [
43 installShellFiles
44 ];
45
46 vendorHash = "sha256-lU21nRfIi4/eobnHhX/fCWnWtoiQBiWvTUOjBL0I4X4=";
47
48 doCheck = false;
49
50 postInstall = ''
51 mv $out/bin/{src,process-compose}
52
53 installShellCompletion --cmd process-compose \
54 --bash <($out/bin/process-compose completion bash) \
55 --zsh <($out/bin/process-compose completion zsh) \
56 --fish <($out/bin/process-compose completion fish)
57 '';
58
59 meta = with lib; {
60 description = "A simple and flexible scheduler and orchestrator to manage non-containerized applications";
61 homepage = "https://github.com/F1bonacc1/process-compose";
62 changelog = "https://github.com/F1bonacc1/process-compose/releases/tag/v${version}";
63 license = licenses.asl20;
64 maintainers = with maintainers; [ thenonameguy ];
65 };
66}