@@ -184,14 +184,27 @@ in rec {
184184 ] ;
185185 } ) ;
186186
187- relocatableElectron = ( import ( pkgs . runCommandNoCC "nix-bundle-exe-patched" { } ''
187+ relocatableElectron = let
188+ additionalLibs = ''
189+ additionalLibs=(
190+ ${ pkgs . xorg . libX11 } /lib/libX11-xcb.so.1
191+ ${ pkgs . xorg . libxcb } /lib/*.so.?
192+ ${ pkgs . systemd /* patched */ } /lib/{libudev.so.1,libsystemd.so.0,libnss_*.so.2}
193+ ${ pkgs . nss } /lib/*.so
194+ ${ pkgs . libusb } /lib/*.so.0
195+ ${ pkgs . nssmdns } /lib/*.so.2
196+ ${ pkgs . numactl } /lib/libnuma.so.1
197+ ${ pkgs . pciutils } /lib/libpci.so.3
198+ ${ pkgs . libva . out } /lib/*.so.2
199+ ${ pkgs . atk } /lib/libatk-bridge-2.0.so
200+ $(find ${ pkgs . glibc } /lib -type l)
201+ )
202+ '' ;
203+ in ( import ( pkgs . runCommandNoCC "nix-bundle-exe-patched" { } ''
188204 cp -r ${ inputs . nix-bundle-exe } $out
189205 chmod -R +w $out
190- for additionalLib in \
191- ${ pkgs . xorg . libX11 } /lib/libX11-xcb.so.1 \
192- ${ pkgs . systemd /* patched */ } /lib/{libudev.so.1,libsystemd.so.0,libnss_*.so.2} \
193- ${ pkgs . nss } /lib/*.so \
194- ; do
206+ ${ additionalLibs }
207+ for additionalLib in "'' ${additionalLibs[@]}" ; do
195208 sed -r '/bundleExe "\$binary"/a\ bundleLib "'"$additionalLib"'" "lib"' -i $out/bundle-linux.sh
196209 done
197210 '' ) {
@@ -200,7 +213,7 @@ in rec {
200213 #bin_dir = "electron-bin";
201214 inherit pkgs ;
202215 } electronBin ) . overrideAttrs ( drv : {
203- buildCommand = ( builtins . replaceStrings [ "find '" ] [ "find -L '" ] drv . buildCommand ) + ''
216+ buildCommand = additionalLibs + ( builtins . replaceStrings [ "find '" ] [ "find -L '" ] drv . buildCommand ) + ''
204217 chmod -R +w $out
205218
206219 mkdir -p $out/lib
@@ -212,6 +225,8 @@ in rec {
212225 rm $out/lib/electron/lib/ld-linux-x86-64.so.2
213226 ( cd $out/lib/electron && rm libffmpeg.so && ln -s lib/libffmpeg.so libffmpeg.so ; )
214227
228+ ( cd $out/lib/electron/lib && ln -s libatk-bridge-2.0.so libatk-bridge.so ; )
229+
215230 patchelf --set-rpath '$ORIGIN/lib:$ORIGIN' $out/lib/electron/electron
216231
217232 cp ${ pkgs . writeScript "electron" ''
@@ -291,8 +306,8 @@ in rec {
291306 mkdir -p "'' ${DAEDALUS_DIR}/${ cluster } "/Secrets
292307 cd "'' ${DAEDALUS_DIR}/${ cluster } /"
293308
294- if [ -e "'' ${DAEDALUS_DIR}/${ cluster } "/daedalus_lockfile.old-nix-chroot ] ; then
295- rm "'' ${DAEDALUS_DIR}/${ cluster } "/daedalus_lockfile.old-nix-chroot || true
309+ if [ -e "'' ${DAEDALUS_DIR}/${ cluster } "/daedalus_lockfile.pre-auto-update ] ; then
310+ rm "'' ${DAEDALUS_DIR}/${ cluster } "/daedalus_lockfile.pre-auto-update || true
296311 fi
297312
298313 exec cardano-launcher --config "$ENTRYPOINT_DIR/config/launcher-config.yaml"
@@ -301,10 +316,25 @@ in rec {
301316 cp ${ pkgs . writeText "daedalus-frontend" ''
302317 #!/bin/sh
303318 set -xe
319+
320+ # `daedalus-frontend` is what `cardano-launcher` restarts during auto-update; let’s detect
321+ # this case here, and restart the `cardano-launcher` itself, in case we need it to
322+ # be updated as well:
323+ if [ -e "'' ${DAEDALUS_DIR}/${ cluster } "/daedalus_lockfile.pre-auto-update ] ; then
324+ nohup setsid ~/.daedalus/${ cluster } /bin/daedalus </dev/null >/dev/null 2>/dev/null &
325+ exit 0
326+ fi
327+
304328 exec electron --disable-setuid-sandbox --no-sandbox "$ENTRYPOINT_DIR"/libexec/daedalus-js "$@"
305329 '' } $out/libexec/daedalus-frontend
306330
307- chmod +x $out/bin/* $out/libexec/daedalus-frontend
331+ cp ${ pkgs . writeText "update-runner" ''
332+ #!/bin/sh
333+ set -xe
334+ exec "$1"
335+ '' } $out/libexec/update-runner
336+
337+ chmod +x $out/bin/* $out/libexec/{daedalus-frontend,update-runner}
308338
309339 mkdir -p $out/share/applications
310340 cp ${ common . launcherConfigs . ${ cluster } . installerConfig . iconPath . large } $out/share/icon_large.png
@@ -422,10 +452,6 @@ in rec {
422452 echo -n "$HOME/.daedalus${ pkgs . writeScript "escape-and-scrap-chroot" ''
423453 #!/bin/sh
424454 set -eu
425- XDG_DATA_HOME="'' ${XDG_DATA_HOME:-'' ${HOME}/.local/share}"
426- DAEDALUS_DIR="'' ${XDG_DATA_HOME}/Daedalus"
427- mv "$DAEDALUS_DIR"/${ cluster } /daedalus_lockfile \
428- "$DAEDALUS_DIR"/${ cluster } /daedalus_lockfile.old-nix-chroot || true
429455 nohup setsid ~/.daedalus/${ cluster } /bin/daedalus </dev/null >/dev/null 2>/dev/null &
430456 sleep 5
431457 ${ removeOldNixChroot . ${ cluster } }
0 commit comments