Change:
NIX_LDFLAGS = "--as-needed -rpath ${lib.makeLibraryPath buildInputs}"; buildPhase = '' <ins> # lazarus tries to create files in $HOME/.lazarus </ins> export HOME=$(mktemp -d) <del> cd dev lazbuild --lazarusdir=${lazarus}/share/lazarus --widgetset=qt5 --build-all project_pea.lpi && [ -f pea ] lazbuild --lazarusdir=${lazarus}/share/lazarus --widgetset=qt5 --build-all project_peach.lpi && [ -f peazip ] cd .. </del> <ins> pushd dev lazbuild --lazarusdir=${lazarus}/share/lazarus --add-package metadarkstyle/metadarkstyle.lpk lazbuild --lazarusdir=${lazarus}/share/lazarus --widgetset=qt5 --build-all project_pea.lpi lazbuild --lazarusdir=${lazarus}/share/lazarus --widgetset=qt5 --build-all project_peach.lpi popd ''; # peazip looks for the "7z", not "7zz" _7z = runCommand "7z" {} '' mkdir -p $out/bin ln -s ${_7zz}/bin/7zz $out/bin/7z </ins> ''; installPhase = '' runHook preInstall <del> # Executables ## Main programs </del> install -D dev/{pea,peazip} -t $out/lib/peazip <ins> wrapProgram $out/lib/peazip/peazip --prefix PATH : ${lib.makeBinPath [ _7z archiver brotli upx zpaq zstd ]} </ins> mkdir -p $out/bin ln -s $out/lib/peazip/{pea,peazip} $out/bin/ <del> ## Symlink the available compression algorithm programs. mkdir -p $out/lib/peazip/res/bin/7z ln -s ${_7zz}/bin/7zz $out/lib/peazip/res/bin/7z/7z mkdir -p $out/lib/peazip/res/bin/arc ln -s ${archiver}/bin/arc $out/lib/peazip/res/bin/arc/ mkdir -p $out/lib/peazip/res/bin/brotli ln -s ${brotli}/bin/brotli $out/lib/peazip/res/bin/brotli/ mkdir -p $out/lib/peazip/res/bin/upx ln -s ${upx}/bin/upx $out/lib/peazip/res/bin/upx/ mkdir -p $out/lib/peazip/res/bin/zpaq ln -s ${zpaq}/bin/zpaq $out/lib/peazip/res/bin/zpaq/ mkdir -p $out/lib/peazip/res/bin/zstd ln -s ${zstd}/bin/zstd $out/lib/peazip/res/bin/zstd/ mkdir -p $out/share/peazip </del> <ins> mkdir -p $out/share/peazip $out/lib/peazip/res/share </ins> ln -s $out/share/peazip $out/lib/peazip/res/share cp -r res/share/{icons,lang,themes,presets} $out/share/peazip/ <del> install -D res/share/batch/freedesktop_integration/peazip.png -t "$out/share/icons/hicolor/256x256/apps" install -D res/share/icons/peazip_{7z,rar,zip}.png -t "$out/share/icons/hicolor/256x256/mimetypes" install -D res/share/batch/freedesktop_integration/peazip_{add,extract}.png -t "$out/share/icons/hicolor/256x256/actions" install -D res/share/batch/freedesktop_integration/*.desktop -t "$out/share/applications" </del> <ins> # Install desktop entries install -D res/share/batch/freedesktop_integration/*.desktop -t $out/share/applications # Install desktop entries's icons mkdir -p $out/share/icons/hicolor/256x256/apps ln -s $out/share/peazip/icons/peazip.png -t $out/share/icons/hicolor/256x256/apps/ mkdir $out/share/icons/hicolor/256x256/mimetypes ln -s $out/share/peazip/icons/peazip_{7z,zip,cd}.png $out/share/icons/hicolor/256x256/mimetypes/ mkdir $out/share/icons/hicolor/256x256/actions ln -s $out/share/peazip/icons/peazip_{add,extract,convert}.png $out/share/icons/hicolor/256x256/actions/ </ins> runHook postInstall '';

Discussion:
Steps to reproduce the behavior: <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --Please run and paste the result. Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]: