11 immich-machine-learning,
28 buildNpmPackage' = buildNpmPackage.override { inherit nodejs; };
29 sources = lib.importJSON ./sources.json;
30 inherit (sources) version;
49 # The geodata website is not versioned, so we use the internet archive
51 runCommand "immich-geodata"
53 outputHash = "sha256-imqSfzXaEMNo9T9tZr80sr/89n19kiFc8qwidFzRUaY=";
54 outputHashMode = "recursive";
61 meta.license = lib.licenses.cc-by-40;
65 url="https://web.archive.org/web/20240724153050/http://download.geonames.org/export/dump"
66 curl -Lo ./cities500.zip "$url/cities500.zip"
67 curl -Lo $out/admin1CodesASCII.txt "$url/admin1CodesASCII.txt"
68 curl -Lo $out/admin2Codes.txt "$url/admin2Codes.txt"
69 curl -Lo $out/ne_10m_admin_0_countries.geojson \
70 https://raw.githubusercontent.com/nvkelso/natural-earth-vector/ca96624a56bd078437bca8184e78163e5039ad19/geojson/ne_10m_admin_0_countries.geojson
72 unzip ./cities500.zip -d $out/
73 echo "2024-07-24T15:30:50Z" > $out/geodata-date.txt
76 src = fetchFromGitHub {
80 inherit (sources) hash;
83 openapi = buildNpmPackage' {
84 pname = "immich-openapi-sdk";
86 src = "${src}/open-api/typescript-sdk";
87 inherit (sources.components."open-api/typescript-sdk") npmDepsHash;
92 npm config delete cache
93 npm prune --omit=dev --omit=optional
96 mv package.json package-lock.json node_modules build $out/
102 web = buildNpmPackage' {
103 pname = "immich-web";
106 inherit (sources.components.web) npmDepsHash;
109 rm node_modules/@immich/sdk
110 ln -s ${openapi} node_modules/@immich/sdk
111 # Rollup does not find the dependency otherwise
112 ln -s node_modules/@immich/sdk/node_modules/@oazapfts node_modules/
124 node-addon-api = stdenvNoCC.mkDerivation rec {
125 pname = "node-addon-api";
127 src = fetchFromGitHub {
129 repo = "node-addon-api";
131 hash = "sha256-k3v8lK7uaEJvcaj1sucTjFZ6+i5A6w/0Uj9rYlPhjCE=";
135 cp -r *.c *.h *.gyp *.gypi index.js package-support.json package.json tools $out/
139 vips' = vips.overrideAttrs (prev: {
140 mesonFlags = prev.mesonFlags ++ [ "-Dtiff=disabled" ];
146 src = "${src}/server";
147 inherit (sources.components.server) npmDepsHash;
149 nativeBuildInputs = [
162 vips' # Required for sharp
165 # Required because vips tries to write to the cache dir
166 makeCacheWritable = true;
169 cd node_modules/sharp
172 ln -s ${node-addon-api} node_modules/node-addon-api
174 ${lib.getExe nodejs} install/check
179 rm -r node_modules/@img/sharp*
185 npm config delete cache
189 mv package.json package-lock.json node_modules dist resources $out/
190 ln -s ${web} $out/build/www
191 ln -s ${geodata} $out/build/geodata
193 echo '${builtins.toJSON buildLock}' > $out/build/build-lock.json
195 makeWrapper ${lib.getExe nodejs} $out/bin/admin-cli --add-flags $out/dist/main --add-flags cli
196 makeWrapper ${lib.getExe nodejs} $out/bin/server --add-flags $out/dist/main --chdir $out \
197 --set IMMICH_BUILD_DATA $out/build --set NODE_ENV production \
210 inherit (nixosTests) immich;
213 machine-learning = immich-machine-learning;
221 updateScript = ./update.sh;
225 description = "Self-hosted photo and video backup solution";
226 homepage = "https://immich.app/";
227 license = lib.licenses.agpl3Only;
228 maintainers = with lib.maintainers; [ jvanbruegge ];
229 platforms = lib.platforms.linux;
230 mainProgram = "server";