about summary refs log tree commit diff
path: root/pkgs/tools/misc/immich-cli/default.nix
blob: 8cf8212f8a83ccfb9f3fad532c535ac307c3506c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{ lib
, buildNpmPackage
, fetchFromGitHub
, testers
}:

let
  version = "2.2.15";
  src = fetchFromGitHub {
    owner = "immich-app";
    repo = "immich";
    # Using a fixed commit until upstream has release tags for cli.
    rev = "f7bfde6a3286d4b454c2f05ccf354914f8eccac6";
    hash = "sha256-O014Y2HwhfPqKKFFGtNDJBzCaR6ugI4azw6/kfzKET0=";
  };
  meta' = {
    description = "CLI utilities for Immich to help upload images and videos";
    homepage = "https://github.com/immich-app/immich";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ felschr pineapplehunter ];
    mainProgram = "immich";
  };

  open-api-typescript-sdk = buildNpmPackage {
    pname = "immich-cli-openapi-typescript-sdk";
    inherit src version;

    npmDepsHash = "sha256-rIN88xw8kdLfhFbT4OReTwzWqNlD4QVAAuvfMyda+V8=";

    postPatch = ''
      cd open-api/typescript-sdk
    '';
    meta = {
      # using inherit for `builtin.unsafeGetAttrPos` to work correctly
      inherit (meta')
        description
        homepage
        license
        maintainers;
    };
  };

  immich-cli = buildNpmPackage {
    pname = "immich-cli";
    inherit src version;

    npmDepsHash = "sha256-r/kCE6FmhbnMVv2Z76hH/1O1YEYSq9VY5kB0xlqWzaM=";

    postPatch = ''
      ln -sv ${open-api-typescript-sdk}/lib/node_modules/@immich/sdk/{build,node_modules} open-api/typescript-sdk
      cd cli
    '';

    passthru = {
      inherit open-api-typescript-sdk;
      tests.version = testers.testVersion { package = immich-cli; };
    };

    meta = {
      # using inherit for `builtin.unsafeGetAttrPos` to work correctly
      inherit (meta')
        description
        homepage
        license
        maintainers
        mainProgram;
    };
  };
in
immich-cli