Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

immich: 1.123.0 -> 1.124.2 #371942

Merged
merged 1 commit into from
Jan 20, 2025
Merged

immich: 1.123.0 -> 1.124.2 #371942

merged 1 commit into from
Jan 20, 2025

Conversation

dotlambda
Copy link
Member

@dotlambda dotlambda commented Jan 7, 2025

Diff: immich-app/immich@refs/tags/v1.123.0...v1.124.2

Changelog:
https://github.com/immich-app/immich/releases/tag/v1.124.0
https://github.com/immich-app/immich/releases/tag/v1.124.1
https://github.com/immich-app/immich/releases/tag/v1.124.2

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

closes #366377


Add a 👍 reaction to pull requests you find important.

@dotlambda
Copy link
Member Author

Building sharp from source fails with

npm error code 1
npm error path /build/server/node_modules/sharp
npm error command failed
npm error command sh -c node install/check
npm error sharp: Detected globally-installed libvips v8.16.0
npm error sharp: Attempting to build from source via node-gyp
npm error sharp: Found node-addon-api 
npm error sharp: Found node-gyp 11.0.0
npm error sharp: See https://sharp.pixelplumbing.com/install#building-from-source
npm error make: Entering directory '/build/server/node_modules/sharp/src/build'
npm error   CC(target) Release/obj.target/nothing/../../node-addon-api/nothing.o
npm error rm -f Release/obj.target/../../node-addon-api/nothing.a Release/obj.target/../../node-addon-api/nothing.a.ar-file-list; mkdir -p `dirname Release/obj.target/../../node-addon-api/nothing.a`
npm error ar crs Release/obj.target/../../node-addon-api/nothing.a @Release/obj.target/../../node-addon-api/nothing.a.ar-file-list
npm error   COPY Release/nothing.a
npm error   TOUCH Release/obj.target/libvips-cpp.stamp
npm error   CXX(target) Release/obj.target/sharp-linux-x64/common.o
npm error   CXX(target) Release/obj.target/sharp-linux-x64/metadata.o
npm error make: Leaving directory '/build/server/node_modules/sharp/src/build'
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | linux | x64
npm error gyp info chdir src
npm error gyp info find Python using Python version 3.12.8 found at "/nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/bin/python3"
npm error gyp WARN read config.gypi ENOENT: no such file or directory, open '/nix/store/qwrzxkqmsspprgq9s5j8bcr45lkign4k-nodejs-22.11.0-source/include/node/config.gypi'
npm error gyp info spawn /nix/store/c9m6yd8fg1flz2j5r4bif1ib5j20a0cy-python3-3.12.8/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/build/server/node_modules/sharp/src/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/nix/store/qwrzxkqmsspprgq9s5j8bcr45lkign4k-nodejs-22.11.0-source/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/nix/store/qwrzxkqmsspprgq9s5j8bcr45lkign4k-nodejs-22.11.0-source',
npm error gyp info spawn args '-Dnode_gyp_dir=/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/nix/store/qwrzxkqmsspprgq9s5j8bcr45lkign4k-nodejs-22.11.0-source/$(Configuration)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/build/server/node_modules/sharp/src',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error <string>:114: SyntaxWarning: invalid escape sequence '\/'
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error ../metadata.cc: In member function 'virtual void MetadataWorker::OnOK()':
npm error ../metadata.cc:237:46: error: 'NewOrCopy' is not a member of 'Napi::Buffer<char>'
npm error   237 |         info.Set("exif", Napi::Buffer<char>::NewOrCopy(env, baton->exif, baton->exifLength, sharp::FreeCallback));
npm error       |                                              ^~~~~~~~~
npm error ../metadata.cc:240:45: error: 'NewOrCopy' is not a member of 'Napi::Buffer<char>'
npm error   240 |         info.Set("icc", Napi::Buffer<char>::NewOrCopy(env, baton->icc, baton->iccLength, sharp::FreeCallback));
npm error       |                                             ^~~~~~~~~
npm error ../metadata.cc:243:46: error: 'NewOrCopy' is not a member of 'Napi::Buffer<char>'
npm error   243 |         info.Set("iptc", Napi::Buffer<char>::NewOrCopy(env, baton->iptc, baton->iptcLength, sharp::FreeCallback));
npm error       |                                              ^~~~~~~~~
npm error ../metadata.cc:246:45: error: 'NewOrCopy' is not a member of 'Napi::Buffer<char>'
npm error   246 |         info.Set("xmp", Napi::Buffer<char>::NewOrCopy(env, baton->xmp, baton->xmpLength, sharp::FreeCallback));
npm error       |                                             ^~~~~~~~~
npm error ../metadata.cc:250:31: error: 'NewOrCopy' is not a member of 'Napi::Buffer<char>'
npm error   250 |           Napi::Buffer<char>::NewOrCopy(env, baton->tifftagPhotoshop,
npm error       |                               ^~~~~~~~~
npm error make: *** [sharp-linux-x64.target.mk:139: Release/obj.target/sharp-linux-x64/metadata.o] Error 1
npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:216:23)
npm error gyp ERR! System Linux 6.6.61
npm error gyp ERR! command "/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/bin/node" "/nix/store/fkyp1bm5gll9adnfcj92snyym524mdrj-nodejs-22.11.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--directory=src"
npm error gyp ERR! cwd /build/server/node_modules/sharp/src
npm error gyp ERR! node -v v22.11.0
npm error gyp ERR! node-gyp -v v10.2.0
npm error gyp ERR! not ok

as in lovell/sharp#4253. Any ideas?

@mweinelt
Copy link
Member

mweinelt commented Jan 8, 2025

@dotlambda
Copy link
Member Author

dotlambda commented Jan 8, 2025

The reference code comes from node-addon-api:

Yes, and I tried updating node-addon-api but that didn't help.
EDIT: Even removing all other existing versions of node-addon-api doesn't help, as you can see by the commit I just pushed.

@dotlambda dotlambda force-pushed the immich branch 2 times, most recently from 0790177 to 95d1bc2 Compare January 8, 2025 23:22
@dotlambda dotlambda changed the title immich: 1.123.0 -> 1.124.0 immich: 1.123.0 -> 1.124.1 Jan 8, 2025
@dotlambda dotlambda changed the title immich: 1.123.0 -> 1.124.1 immich: 1.123.0 -> 1.124.2 Jan 9, 2025
@emmertex
Copy link

Build issue with the latest
Haven't found why yet.

Updating from 1.123.0


Archive: ./cities500.zip
inflating: /nix/store/5k16d9lmzvx8plb66flyqb0dlv5mg8k4-immich-geodata/cities500.txt
error: hash mismatch in fixed-output derivation '/nix/store/qasqip2ixrhwxcl9i46f1v7v8kgli61s-immich-geodata.drv':
specified: sha256-gCi0iFQplv4XizDi9DYEVekFFe46DM4X2YiPSe7ugR4=
got: sha256-5/3j3aN7DnrmRE1bfntx+FC4Fic3V2IvNn2BjffFNFc=
error: 1 dependencies of derivation '/nix/store/w7gwq8n61xvdbwr96vkcmlfikcmqn2jd-immich-1.124.2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/sck1jsm482kq3zaswinh5f0236hzf254-unit-immich-server.service.drv' failed to build
error: 1 dependencies of derivation '/nix/store/70vsi5way8zf0486mn7673znr09h5mbf-system-units.drv' failed to build
error: 1 dependencies of derivation '/nix/store/33db0whp7ac5xnyzz33m2sqn634qs1b2-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/kslskvvz5qw8hxic6sqwkjfjh17f2gyg-nixos-system-nixserver0-25.05.git.c026c080f242.drv' failed to build

[nix-shell:~/nixpkgs]$ git stash
No local changes to save

[nix-shell:~/nixpkgs]$ git status
On branch immich

@vale981
Copy link
Contributor

vale981 commented Jan 17, 2025

diff --git a/pkgs/by-name/im/immich/package.nix b/pkgs/by-name/im/immich/package.nix
index 6a9c5f5973c3..b6bae49fabb0 100644
--- a/pkgs/by-name/im/immich/package.nix
+++ b/pkgs/by-name/im/immich/package.nix
@@ -184,6 +184,7 @@ buildNpmPackage' {
     # we manually build sharp from source later on
     # FIXME figure out why otherwise it fails with
     #     error: 'NewOrCopy' is not a member of 'Napi::Buffer<char>'
+    unset SHARP_IGNORE_GLOBAL_LIBVIPS
     export SHARP_IGNORE_GLOBAL_LIBVIPS=1
   '';
 
@@ -199,6 +200,8 @@ buildNpmPackage' {
     mkdir node_modules
     ln -s ${node-addon-api} node_modules/node-addon-api
 
+    unset SHARP_IGNORE_GLOBAL_LIBVIPS
+    export SHARP_FORCE_GLOBAL_LIBVIPS=1
     node install/check
 
     rm -r node_modules

fixed the sharp build failure for me

@dotlambda
Copy link
Member Author

fixed the sharp build failure for me

That doesn't make any sense. Anyway, I tried it and get the same build error. Can you post the entire code that supposedly works?

@vale981
Copy link
Contributor

vale981 commented Jan 17, 2025

I might have messed up on my end. Let me double check.
EDIT: I've messed up indeed. Sorry for the noise...

the culprit seems to be https://github.com/immich-app/immich/blob/d5a9294eebcf303b63e585b4b668687f3146b471/server/package-lock.json#L11131

@vale981
Copy link
Contributor

vale981 commented Jan 18, 2025

So, one issue seems to be that npmConfigHook already tries to install sharp which fails because the package-lock.json pins an old version of node-addon-api.

Comment on lines 194 to 195
rm -r node_modules/node-addon-api
rm -r node_modules/**/node-addon-api
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vale981 That's not an issue since I remove all old versions of node-addon-api here.

Copy link
Contributor

@vale981 vale981 Jan 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thing is that the hook doesn't know about that...

with renaming preConfigure to prePatch, I get it to build but then it fails with

       > Finished npmBuildHook
       > Running phase: glibPreInstallPhase
       > Running phase: glibPreInstallPhase
       > Running phase: installPhase
       > npm error code ENOTCACHED
       > npm error request to https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz failed: cache mode is 'only-if-cached' but no cached response is available.
       > npm error A complete log of this run can be found in: /build/.npm/_logs/2025-01-18T01_34_28_575Z-debug-0.log
       For full logs, run 'nix log /nix/store/l1jg60arlbd2y1v7bi10hj7lcqfqh8gq-immich-1.124.2.drv'.

@vale981
Copy link
Contributor

vale981 commented Jan 18, 2025

Ok. Applying the following on top of your pr seems to work for me. Something internal to buildNpmPackage seems to have changed...

diff --git a/pkgs/by-name/im/immich/package.nix b/pkgs/by-name/im/immich/package.nix
index 6a9c5f5973c3..f3e314446a00 100644
--- a/pkgs/by-name/im/immich/package.nix
+++ b/pkgs/by-name/im/immich/package.nix
@@ -180,7 +180,7 @@ buildNpmPackage' {
   # Required because vips tries to write to the cache dir
   makeCacheWritable = true;
 
-  preConfigure = ''
+  prePatch = ''
     # we manually build sharp from source later on
     # FIXME figure out why otherwise it fails with
     #     error: 'NewOrCopy' is not a member of 'Napi::Buffer<char>'
@@ -213,9 +213,6 @@ buildNpmPackage' {
   installPhase = ''
     runHook preInstall
 
-    npm config delete cache
-    npm prune --omit=dev
-
     # remove build artifacts that bloat the closure
     rm -r node_modules/**/{*.target.mk,binding.Makefile,config.gypi,Makefile,Release/.deps}

@dotlambda
Copy link
Member Author

dotlambda commented Jan 19, 2025

Thanks! So my approach was correct but npmConfigHook is run in postPatch.
I asked immich to update their version of node-addon-api in package-lock.json: immich-app/immich#15438

@dotlambda dotlambda marked this pull request as ready for review January 19, 2025 03:27
@dotlambda dotlambda requested a review from vale981 January 19, 2025 14:28
@vale981
Copy link
Contributor

vale981 commented Jan 19, 2025

Thanks! So my approach was correct but npmConfigHook is run in postPatch. I asked immich to update their version of node-addon-api in package-lock.json: immich-app/immich#15438

There seems to be another dependency of theirs that needs the 5er version. I don't know how npm handles such conficts...

Edit: haha... i didn't look at your PR. Now I see how it's done :P. I still wonder why the sharp dependency doesn't enforce that version of the addon api though....

Edit edit: So it's a devDependency of sharp... is there a way to get nix to care about that (transitively through the immich package)? I guess adding it to immich is fine if they're cool with it.

@dotlambda dotlambda merged commit 25d6e81 into NixOS:master Jan 20, 2025
44 of 46 checks passed
@dotlambda dotlambda deleted the immich branch January 20, 2025 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants