Skip to content

Commit 3576f97

Browse files
rhelmotdotlambda
authored andcommitted
immich: fix npmDeps build failure
It seems like c++filt and readelf are not always in PATH. npmDeps fails to build because of that. We add `|| true` to be resilient to this and move to prePatch because npmConfigHook is a postPatch hook.
1 parent e1f0c8b commit 3576f97

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

pkgs/by-name/im/immich/package.nix

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ let
120120
sourceRoot = "${src.name}/web";
121121
inherit (sources.components.web) npmDepsHash;
122122

123+
# prePatch is needed because npmConfigHook is a postPatch
124+
prePatch = ''
125+
# some part of the build wants to use un-prefixed binaries. let them.
126+
mkdir -p $TMP/bin
127+
ln -s "$(type -p ${stdenv.cc.targetPrefix}pkg-config)" $TMP/bin/pkg-config || true
128+
ln -s "$(type -p ${stdenv.cc.targetPrefix}c++filt)" $TMP/bin/c++filt || true
129+
ln -s "$(type -p ${stdenv.cc.targetPrefix}readelf)" $TMP/bin/readelf || true
130+
export PATH="$TMP/bin:$PATH"
131+
'';
132+
123133
preBuild = ''
124134
rm node_modules/@immich/sdk
125135
ln -s ${openapi} node_modules/@immich/sdk
@@ -161,17 +171,18 @@ buildNpmPackage' {
161171
src = "${src}/server";
162172
inherit (sources.components.server) npmDepsHash;
163173

164-
postPatch = ''
174+
# prePatch is needed because npmConfigHook is a postPatch
175+
prePatch = ''
165176
# pg_dumpall fails without database root access
166177
# see https://github.com/immich-app/immich/issues/13971
167178
substituteInPlace src/services/backup.service.ts \
168179
--replace-fail '`/usr/lib/postgresql/''${databaseMajorVersion}/bin/pg_dumpall`' '`pg_dump`'
169180
170181
# some part of the build wants to use un-prefixed binaries. let them.
171182
mkdir -p $TMP/bin
172-
ln -s "$(type -p ${stdenv.cc.targetPrefix}pkg-config)" $TMP/bin/pkg-config
173-
ln -s "$(type -p ${stdenv.cc.targetPrefix}c++filt)" $TMP/bin/c++filt
174-
ln -s "$(type -p ${stdenv.cc.targetPrefix}readelf)" $TMP/bin/readelf
183+
ln -s "$(type -p ${stdenv.cc.targetPrefix}pkg-config)" $TMP/bin/pkg-config || true
184+
ln -s "$(type -p ${stdenv.cc.targetPrefix}c++filt)" $TMP/bin/c++filt || true
185+
ln -s "$(type -p ${stdenv.cc.targetPrefix}readelf)" $TMP/bin/readelf || true
175186
export PATH="$TMP/bin:$PATH"
176187
'';
177188

0 commit comments

Comments
 (0)