python3Packages.instructor: 1.6.4 -> 1.72 (#378975)
[NixPkgs.git] / pkgs / by-name / im / immich-go / package.nix
blob22337bcf166b1410ed381c9a33aeca40ebc5fe32
2   lib,
3   buildGoModule,
4   fetchFromGitHub,
5   nix-update-script,
6   testers,
7   immich-go,
8 }:
9 buildGoModule rec {
10   pname = "immich-go";
11   version = "0.22.1";
13   src = fetchFromGitHub {
14     owner = "simulot";
15     repo = "immich-go";
16     rev = "${version}";
17     hash = "sha256-6bLjHKkEghbY+UQFrgbfeHwOjtks1HjXbDXEr7DuJbU=";
19     # Inspired by: https://github.com/NixOS/nixpkgs/blob/f2d7a289c5a5ece8521dd082b81ac7e4a57c2c5c/pkgs/applications/graphics/pdfcpu/default.nix#L20-L32
20     # The intention here is to write the information into files in the `src`'s
21     # `$out`, and use them later in other phases (in this case `preBuild`).
22     # In order to keep determinism, we also delete the `.git` directory
23     # afterwards, imitating the default behavior of `leaveDotGit = false`.
24     # More info about git log format can be found at `git-log(1)` manpage.
25     leaveDotGit = true;
26     postFetch = ''
27       cd "$out"
28       git log -1 --pretty=%H > "COMMIT"
29       git log -1 --pretty=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ' > "SOURCE_DATE"
30       rm -rf ".git"
31     '';
32   };
34   vendorHash = "sha256-jED1K2zHv60zxMY4P7Z739uzf7PtlsnvZyStOSLKi4M=";
36   # options used by upstream:
37   # https://github.com/simulot/immich-go/blob/0.13.2/.goreleaser.yaml
38   ldflags = [
39     "-s"
40     "-w"
41     "-extldflags=-static"
42     "-X main.version=${version}"
43   ];
45   preBuild = ''
46     ldflags+=" -X main.commit=$(cat COMMIT)"
47     ldflags+=" -X main.date=$(cat SOURCE_DATE)"
48   '';
50   passthru = {
51     updateScript = nix-update-script { };
52     tests.versionTest = testers.testVersion {
53       package = immich-go;
54       command = "immich-go -version";
55       version = version;
56     };
57   };
59   meta = {
60     description = "Immich client tool for bulk-uploads";
61     longDescription = ''
62       Immich-Go is an open-source tool designed to streamline uploading
63       large photo collections to your self-hosted Immich server.
64     '';
65     homepage = "https://github.com/simulot/immich-go";
66     mainProgram = "immich-go";
67     license = lib.licenses.agpl3Only;
68     maintainers = with lib.maintainers; [ kai-tub ];
69     changelog = "https://github.com/simulot/immich-go/releases/tag/${version}";
70   };