CLI tool for migrating PDS

feat: add rust tooling to the dev shell

nel.pet eca86638 235f5910

verified
+2358 -1
+19
.direnv/bin/nix-direnv-reload
··· 1 + #!/usr/bin/env bash 2 + set -e 3 + if [[ ! -d "/home/nel/Documents/code/desktop/pds-migrate" ]]; then 4 + echo "Cannot find source directory; Did you move it?" 5 + echo "(Looking for "/home/nel/Documents/code/desktop/pds-migrate")" 6 + echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' 7 + exit 1 8 + fi 9 + 10 + # rebuild the cache forcefully 11 + _nix_direnv_force_reload=1 direnv exec "/home/nel/Documents/code/desktop/pds-migrate" true 12 + 13 + # Update the mtime for .envrc. 14 + # This will cause direnv to reload again - but without re-building. 15 + touch "/home/nel/Documents/code/desktop/pds-migrate/.envrc" 16 + 17 + # Also update the timestamp of whatever profile_rc we have. 18 + # This makes sure that we know we are up to date. 19 + touch -r "/home/nel/Documents/code/desktop/pds-migrate/.envrc" "/home/nel/Documents/code/desktop/pds-migrate/.direnv"/*.rc
+1
.direnv/flake-inputs/1sdxl91z4didx5kp75b1ig0r2iqhmkbi-source
··· 1 + /nix/store/1sdxl91z4didx5kp75b1ig0r2iqhmkbi-source
+1
.direnv/flake-inputs/5q7582m71yjns6qj3j1naz23l9fywq2p-source
··· 1 + /nix/store/5q7582m71yjns6qj3j1naz23l9fywq2p-source
+1
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa
··· 1 + /nix/store/yf8m4zk3za054d0s7rry1k3jb22vgm36-pds-migrate-0.1.0-env
+2328
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc
··· 1 + unset shellHook 2 + PATH=${PATH:-} 3 + nix_saved_PATH="$PATH" 4 + XDG_DATA_DIRS=${XDG_DATA_DIRS:-} 5 + nix_saved_XDG_DATA_DIRS="$XDG_DATA_DIRS" 6 + AR='ar' 7 + export AR 8 + AS='as' 9 + export AS 10 + BASH='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash' 11 + CC='gcc' 12 + export CC 13 + CONFIG_SHELL='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash' 14 + export CONFIG_SHELL 15 + CXX='g++' 16 + export CXX 17 + HOSTTYPE='x86_64' 18 + HOST_PATH='/nix/store/74k8qwbfa6lm8psm2vjh2vj04fpr6c5g-openssl-3.4.1-bin/bin' 19 + IFS=' 20 + ' 21 + IN_NIX_SHELL='impure' 22 + export IN_NIX_SHELL 23 + LD='ld' 24 + export LD 25 + LINENO='76' 26 + MACHTYPE='x86_64-pc-linux-gnu' 27 + NIX_BINTOOLS='/nix/store/cadx5p7c0i06gf6h84iw9mrhx56imbv0-binutils-wrapper-2.44' 28 + export NIX_BINTOOLS 29 + NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' 30 + export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu 31 + NIX_BUILD_CORES='16' 32 + export NIX_BUILD_CORES 33 + NIX_CC='/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0' 34 + export NIX_CC 35 + NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' 36 + export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu 37 + NIX_CFLAGS_COMPILE=' -frandom-seed=yf8m4zk3za -isystem /nix/store/k0699a27nkj4c2xn67bjcpfa08nqn9l4-openssl-3.4.1-dev/include' 38 + export NIX_CFLAGS_COMPILE 39 + NIX_ENFORCE_NO_NATIVE='1' 40 + export NIX_ENFORCE_NO_NATIVE 41 + NIX_HARDENING_ENABLE='bindnow format fortify fortify3 pic relro stackclashprotection stackprotector strictoverflow zerocallusedregs' 42 + export NIX_HARDENING_ENABLE 43 + NIX_LDFLAGS='-rpath /home/nel/Documents/code/desktop/pds-migrate/outputs/out/lib -L/nix/store/byx7ahs386pskh8d5sdkrkpscfz9yyjp-openssl-3.4.1/lib' 44 + export NIX_LDFLAGS 45 + NIX_NO_SELF_RPATH='1' 46 + NIX_PKG_CONFIG_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' 47 + export NIX_PKG_CONFIG_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu 48 + NIX_STORE='/nix/store' 49 + export NIX_STORE 50 + NM='nm' 51 + export NM 52 + OBJCOPY='objcopy' 53 + export OBJCOPY 54 + OBJDUMP='objdump' 55 + export OBJDUMP 56 + OLDPWD='' 57 + export OLDPWD 58 + OPTERR='1' 59 + OSTYPE='linux-gnu' 60 + PATH='/nix/store/jk2rz2ck89rmq3l374s1k7rhjkpfa0r8-clippy-1.87.0/bin:/nix/store/rj101nks28dl7pnyk22ydhvjnvyh5ajm-rustfmt-1.87.0/bin:/nix/store/kxv1nm1vy0w65fvqfdcyn6pz1rxl7fx2-rust-analyzer-2025-06-30/bin:/nix/store/h5khrpnjj3fb182sc32fx1z75w0lhksy-pkg-config-wrapper-0.29.2/bin:/nix/store/da9jyhil64df2vydamvppz18ifcysykq-auditable-cargo-1.87.0/bin:/nix/store/qy5qx741g17vb0y2qqwivabx58chyb1n-rustc-wrapper-1.87.0/bin:/nix/store/a9fmda08s2q579c59bb62n7c0ibfrqyp-cargo-1.87.0/bin:/nix/store/1c8sm86wj45vwkb3ww2b870h9i9wna6r-patchelf-0.15.0/bin:/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin:/nix/store/sa7j7cddyblhcb3ch3ds10w7nw75yjj1-gcc-14.3.0/bin:/nix/store/mdmsnfcvxyk5ynz7nx8nhss1wig0gljx-glibc-2.40-66-bin/bin:/nix/store/psy9v2asypgl9ylg8cnzkixc7fv0snj0-coreutils-9.7/bin:/nix/store/cadx5p7c0i06gf6h84iw9mrhx56imbv0-binutils-wrapper-2.44/bin:/nix/store/z3za8hfc24wb117s50p8b10agjkgm039-binutils-2.44/bin:/nix/store/psy9v2asypgl9ylg8cnzkixc7fv0snj0-coreutils-9.7/bin:/nix/store/c14zwgl8hf1wm0izij2i16xvk8ak70cy-findutils-4.10.0/bin:/nix/store/ibx4jfwlhjg4g0s6rrxrpaxa3ka8ns4m-diffutils-3.12/bin:/nix/store/pr318zsl44jdwpk9wk0sdrn19b6in7ah-gnused-4.9/bin:/nix/store/bc6zxzjnkjp4r9nhz5imy3cypvdh6r4n-gnugrep-3.12/bin:/nix/store/nv3y7zb1cwz1h9qy7nwz0s54j8dl1kqj-gawk-5.3.2/bin:/nix/store/lp82dcnrzljyix6yigwzrlpr1smvpmb0-gnutar-1.35/bin:/nix/store/6ag5dhk7sma61p6vl0kazfmpbrq08nqh-gzip-1.14/bin:/nix/store/ykdv4id6893gmkqwdmbimq237c1xqvq7-bzip2-1.0.8-bin/bin:/nix/store/6bwp1y45zlyvpr4ja2sk1yi9v5mrs94x-gnumake-4.4.1/bin:/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin:/nix/store/c9xmgszbf6i4dfq9r953khk9d7fdqigw-patch-2.8/bin:/nix/store/ikfwx7kbwz9zr7fziiac7f57jgbh3bnv-xz-5.8.1-bin/bin:/nix/store/3pdmbqy86wsbjdazxv1n3vrmj60vn0ri-file-5.45/bin' 61 + export PATH 62 + PKG_CONFIG='pkg-config' 63 + export PKG_CONFIG 64 + PKG_CONFIG_ALLOW_CROSS='0' 65 + export PKG_CONFIG_ALLOW_CROSS 66 + PKG_CONFIG_PATH='/nix/store/k0699a27nkj4c2xn67bjcpfa08nqn9l4-openssl-3.4.1-dev/lib/pkgconfig' 67 + export PKG_CONFIG_PATH 68 + PS4='+ ' 69 + RANLIB='ranlib' 70 + export RANLIB 71 + READELF='readelf' 72 + export READELF 73 + SHELL='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash' 74 + export SHELL 75 + SIZE='size' 76 + export SIZE 77 + SOURCE_DATE_EPOCH='315532800' 78 + export SOURCE_DATE_EPOCH 79 + STRINGS='strings' 80 + export STRINGS 81 + STRIP='strip' 82 + export STRIP 83 + XDG_DATA_DIRS='/nix/store/h5khrpnjj3fb182sc32fx1z75w0lhksy-pkg-config-wrapper-0.29.2/share:/nix/store/a9fmda08s2q579c59bb62n7c0ibfrqyp-cargo-1.87.0/share:/nix/store/1c8sm86wj45vwkb3ww2b870h9i9wna6r-patchelf-0.15.0/share' 84 + export XDG_DATA_DIRS 85 + __structuredAttrs='' 86 + export __structuredAttrs 87 + _substituteStream_has_warned_replace_deprecation='false' 88 + buildInputs='/nix/store/k0699a27nkj4c2xn67bjcpfa08nqn9l4-openssl-3.4.1-dev' 89 + export buildInputs 90 + buildPhase='cargoBuildHook' 91 + builder='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash' 92 + export builder 93 + cargoBuildFeatures='' 94 + export cargoBuildFeatures 95 + cargoBuildNoDefaultFeatures='' 96 + export cargoBuildNoDefaultFeatures 97 + cargoBuildType='release' 98 + export cargoBuildType 99 + cargoCheckFeatures='' 100 + export cargoCheckFeatures 101 + cargoCheckNoDefaultFeatures='' 102 + export cargoCheckNoDefaultFeatures 103 + cargoCheckType='release' 104 + export cargoCheckType 105 + cargoDeps='/nix/store/s3m01ywncv63jakjl0rq1s4cdczh9ndm-cargo-vendor-dir' 106 + export cargoDeps 107 + checkPhase='cargoCheckHook' 108 + cmakeFlags='' 109 + export cmakeFlags 110 + configureFlags='' 111 + export configureFlags 112 + configurePhase='runHook preConfigure 113 + runHook postConfigure 114 + ' 115 + export configurePhase 116 + defaultBuildInputs='' 117 + defaultNativeBuildInputs='/nix/store/1c8sm86wj45vwkb3ww2b870h9i9wna6r-patchelf-0.15.0 /nix/store/063qqmawmq7bg75b56mgynw9s3rbx2ww-update-autotools-gnu-config-scripts-hook /nix/store/jjhw2phnaip4kg0qjas3x3fsaifi8y0w-no-broken-symlinks.sh /nix/store/cwvwai4ni9hmzaqvnvf1i5pvjh1hj36c-audit-tmpdir.sh /nix/store/4bawv6x85435v6s624sfk5cdpg9gr6yq-compress-man-pages.sh /nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh /nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh /nix/store/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh /nix/store/cq0kx53m7qhq7dvk5s96fazjlqf1bg4j-parallel.sh /nix/store/hxv896faph0rqxjq2ycxpcrbnngc95sz-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh /nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh /nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh /nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0' 118 + depsBuildBuild='' 119 + export depsBuildBuild 120 + depsBuildBuildPropagated='' 121 + export depsBuildBuildPropagated 122 + depsBuildTarget='' 123 + export depsBuildTarget 124 + depsBuildTargetPropagated='' 125 + export depsBuildTargetPropagated 126 + depsHostHost='' 127 + export depsHostHost 128 + depsHostHostPropagated='' 129 + export depsHostHostPropagated 130 + depsTargetTarget='' 131 + export depsTargetTarget 132 + depsTargetTargetPropagated='' 133 + export depsTargetTargetPropagated 134 + doCheck='1' 135 + export doCheck 136 + doInstallCheck='' 137 + export doInstallCheck 138 + dontAddDisableDepTrack='1' 139 + export dontAddDisableDepTrack 140 + declare -a envBuildBuildHooks=() 141 + declare -a envBuildHostHooks=() 142 + declare -a envBuildTargetHooks=() 143 + declare -a envHostHostHooks=('pkgConfigWrapper_addPkgConfigPath' 'ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) 144 + declare -a envHostTargetHooks=('pkgConfigWrapper_addPkgConfigPath' 'ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) 145 + declare -a envTargetTargetHooks=() 146 + declare -a fixupOutputHooks=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi' 'if [[ -z "${noAuditTmpdir-}" && -e "$prefix" ]]; then auditTmpdir "$prefix"; fi' 'if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi' '_moveLib64' '_moveSbin' '_moveSystemdUserUnits' 'patchShebangsAuto' '_pruneLibtoolFiles' '_doStrip' ) 147 + guess='16' 148 + initialPath='/nix/store/psy9v2asypgl9ylg8cnzkixc7fv0snj0-coreutils-9.7 /nix/store/c14zwgl8hf1wm0izij2i16xvk8ak70cy-findutils-4.10.0 /nix/store/ibx4jfwlhjg4g0s6rrxrpaxa3ka8ns4m-diffutils-3.12 /nix/store/pr318zsl44jdwpk9wk0sdrn19b6in7ah-gnused-4.9 /nix/store/bc6zxzjnkjp4r9nhz5imy3cypvdh6r4n-gnugrep-3.12 /nix/store/nv3y7zb1cwz1h9qy7nwz0s54j8dl1kqj-gawk-5.3.2 /nix/store/lp82dcnrzljyix6yigwzrlpr1smvpmb0-gnutar-1.35 /nix/store/6ag5dhk7sma61p6vl0kazfmpbrq08nqh-gzip-1.14 /nix/store/ykdv4id6893gmkqwdmbimq237c1xqvq7-bzip2-1.0.8-bin /nix/store/6bwp1y45zlyvpr4ja2sk1yi9v5mrs94x-gnumake-4.4.1 /nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37 /nix/store/c9xmgszbf6i4dfq9r953khk9d7fdqigw-patch-2.8 /nix/store/ikfwx7kbwz9zr7fziiac7f57jgbh3bnv-xz-5.8.1-bin /nix/store/3pdmbqy86wsbjdazxv1n3vrmj60vn0ri-file-5.45' 149 + installPhase='cargoInstallHook' 150 + mesonFlags='' 151 + export mesonFlags 152 + name='pds-migrate-0.1.0-env' 153 + export name 154 + nativeBuildInputs='/nix/store/jk2rz2ck89rmq3l374s1k7rhjkpfa0r8-clippy-1.87.0 /nix/store/rj101nks28dl7pnyk22ydhvjnvyh5ajm-rustfmt-1.87.0 /nix/store/kxv1nm1vy0w65fvqfdcyn6pz1rxl7fx2-rust-analyzer-2025-06-30 /nix/store/h5khrpnjj3fb182sc32fx1z75w0lhksy-pkg-config-wrapper-0.29.2 /nix/store/da9jyhil64df2vydamvppz18ifcysykq-auditable-cargo-1.87.0 /nix/store/81apdriflyajn8zbbj5dp17np9zpln2i-cargo-build-hook.sh /nix/store/x8iayjgr4cymnls6ggp2nm2jy094w5br-cargo-check-hook.sh /nix/store/4dk144qzhkgr8x3hdgh8ysp399fbb4bw-cargo-install-hook.sh /nix/store/d695n382m5qzpjidz471alipppivv0sz-cargo-setup-hook.sh /nix/store/qy5qx741g17vb0y2qqwivabx58chyb1n-rustc-wrapper-1.87.0 /nix/store/a9fmda08s2q579c59bb62n7c0ibfrqyp-cargo-1.87.0' 155 + export nativeBuildInputs 156 + out='/home/nel/Documents/code/desktop/pds-migrate/outputs/out' 157 + export out 158 + outputBin='out' 159 + outputDev='out' 160 + outputDevdoc='REMOVE' 161 + outputDevman='out' 162 + outputDoc='out' 163 + outputInclude='out' 164 + outputInfo='out' 165 + outputLib='out' 166 + outputMan='out' 167 + outputs='out' 168 + export outputs 169 + patches='' 170 + export patches 171 + pkg='/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0' 172 + declare -a pkgsBuildBuild=() 173 + declare -a pkgsBuildHost=('/nix/store/jk2rz2ck89rmq3l374s1k7rhjkpfa0r8-clippy-1.87.0' '/nix/store/rj101nks28dl7pnyk22ydhvjnvyh5ajm-rustfmt-1.87.0' '/nix/store/kxv1nm1vy0w65fvqfdcyn6pz1rxl7fx2-rust-analyzer-2025-06-30' '/nix/store/h5khrpnjj3fb182sc32fx1z75w0lhksy-pkg-config-wrapper-0.29.2' '/nix/store/da9jyhil64df2vydamvppz18ifcysykq-auditable-cargo-1.87.0' '/nix/store/81apdriflyajn8zbbj5dp17np9zpln2i-cargo-build-hook.sh' '/nix/store/x8iayjgr4cymnls6ggp2nm2jy094w5br-cargo-check-hook.sh' '/nix/store/4dk144qzhkgr8x3hdgh8ysp399fbb4bw-cargo-install-hook.sh' '/nix/store/d695n382m5qzpjidz471alipppivv0sz-cargo-setup-hook.sh' '/nix/store/qy5qx741g17vb0y2qqwivabx58chyb1n-rustc-wrapper-1.87.0' '/nix/store/a9fmda08s2q579c59bb62n7c0ibfrqyp-cargo-1.87.0' '/nix/store/1c8sm86wj45vwkb3ww2b870h9i9wna6r-patchelf-0.15.0' '/nix/store/063qqmawmq7bg75b56mgynw9s3rbx2ww-update-autotools-gnu-config-scripts-hook' '/nix/store/jjhw2phnaip4kg0qjas3x3fsaifi8y0w-no-broken-symlinks.sh' '/nix/store/cwvwai4ni9hmzaqvnvf1i5pvjh1hj36c-audit-tmpdir.sh' '/nix/store/4bawv6x85435v6s624sfk5cdpg9gr6yq-compress-man-pages.sh' '/nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh' '/nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh' '/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh' '/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh' '/nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh' '/nix/store/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh' '/nix/store/cq0kx53m7qhq7dvk5s96fazjlqf1bg4j-parallel.sh' '/nix/store/hxv896faph0rqxjq2ycxpcrbnngc95sz-patch-shebangs.sh' '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh' '/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh' '/nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh' '/nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh' '/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0' '/nix/store/cadx5p7c0i06gf6h84iw9mrhx56imbv0-binutils-wrapper-2.44' ) 174 + declare -a pkgsBuildTarget=() 175 + declare -a pkgsHostHost=() 176 + declare -a pkgsHostTarget=('/nix/store/k0699a27nkj4c2xn67bjcpfa08nqn9l4-openssl-3.4.1-dev' '/nix/store/74k8qwbfa6lm8psm2vjh2vj04fpr6c5g-openssl-3.4.1-bin' '/nix/store/byx7ahs386pskh8d5sdkrkpscfz9yyjp-openssl-3.4.1' ) 177 + declare -a pkgsTargetTarget=() 178 + pname='pds-migrate' 179 + export pname 180 + declare -a postBuildHooks=('cargoInstallPostBuildHook' ) 181 + declare -a postFixupHooks=('noBrokenSymlinksInAllOutputs' '_makeSymlinksRelativeInAllOutputs' '_multioutPropagateDev' ) 182 + declare -a postPatchHooks=('cargoSetupPostPatchHook' ) 183 + postUnpack='eval "$cargoDepsHook" 184 + 185 + export RUST_LOG= 186 + ' 187 + export postUnpack 188 + declare -a postUnpackHooks=('cargoSetupPostUnpackHook' '_updateSourceDateEpochFromSourceRoot' ) 189 + declare -a preConfigureHooks=('_multioutConfig' ) 190 + preConfigurePhases=' updateAutotoolsGnuConfigScriptsPhase' 191 + declare -a preFixupHooks=('_moveToShare' '_multioutDocs' '_multioutDevs' ) 192 + prefix='/home/nel/Documents/code/desktop/pds-migrate/outputs/out' 193 + declare -a propagatedBuildDepFiles=('propagated-build-build-deps' 'propagated-native-build-inputs' 'propagated-build-target-deps' ) 194 + propagatedBuildInputs='' 195 + export propagatedBuildInputs 196 + declare -a propagatedHostDepFiles=('propagated-host-host-deps' 'propagated-build-inputs' ) 197 + propagatedNativeBuildInputs='' 198 + export propagatedNativeBuildInputs 199 + declare -a propagatedTargetDepFiles=('propagated-target-target-deps' ) 200 + shell='/nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash' 201 + export shell 202 + src='/nix/store/0nqsx3vqakm0w8x26hs85019fn0wsapc-5q7582m71yjns6qj3j1naz23l9fywq2p-source' 203 + export src 204 + stdenv='/nix/store/nlqc1vm5psq2jjr5df6z25gkxkfqbvxx-stdenv-linux' 205 + export stdenv 206 + strictDeps='1' 207 + export strictDeps 208 + system='x86_64-linux' 209 + export system 210 + declare -a unpackCmdHooks=('_defaultUnpack' ) 211 + version='0.1.0' 212 + export version 213 + _activatePkgs () 214 + { 215 + 216 + local hostOffset targetOffset; 217 + local pkg; 218 + for hostOffset in "${allPlatOffsets[@]}"; 219 + do 220 + local pkgsVar="${pkgAccumVarVars[hostOffset + 1]}"; 221 + for targetOffset in "${allPlatOffsets[@]}"; 222 + do 223 + (( hostOffset <= targetOffset )) || continue; 224 + local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; 225 + local pkgsSlice="${!pkgsRef}[@]"; 226 + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; 227 + do 228 + activatePackage "$pkg" "$hostOffset" "$targetOffset"; 229 + done; 230 + done; 231 + done 232 + } 233 + _addRpathPrefix () 234 + { 235 + 236 + if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then 237 + export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; 238 + fi 239 + } 240 + _addToEnv () 241 + { 242 + 243 + local depHostOffset depTargetOffset; 244 + local pkg; 245 + for depHostOffset in "${allPlatOffsets[@]}"; 246 + do 247 + local hookVar="${pkgHookVarVars[depHostOffset + 1]}"; 248 + local pkgsVar="${pkgAccumVarVars[depHostOffset + 1]}"; 249 + for depTargetOffset in "${allPlatOffsets[@]}"; 250 + do 251 + (( depHostOffset <= depTargetOffset )) || continue; 252 + local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; 253 + if [[ -z "${strictDeps-}" ]]; then 254 + local visitedPkgs=""; 255 + for pkg in "${pkgsBuildBuild[@]}" "${pkgsBuildHost[@]}" "${pkgsBuildTarget[@]}" "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}" "${pkgsTargetTarget[@]}"; 256 + do 257 + if [[ "$visitedPkgs" = *"$pkg"* ]]; then 258 + continue; 259 + fi; 260 + runHook "${!hookRef}" "$pkg"; 261 + visitedPkgs+=" $pkg"; 262 + done; 263 + else 264 + local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; 265 + local pkgsSlice="${!pkgsRef}[@]"; 266 + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; 267 + do 268 + runHook "${!hookRef}" "$pkg"; 269 + done; 270 + fi; 271 + done; 272 + done 273 + } 274 + _allFlags () 275 + { 276 + 277 + export system pname name version; 278 + while IFS='' read -r varName; do 279 + nixTalkativeLog "@${varName}@ -> ${!varName}"; 280 + args+=("--subst-var" "$varName"); 281 + done < <(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }') 282 + } 283 + _assignFirst () 284 + { 285 + 286 + local varName="$1"; 287 + local _var; 288 + local REMOVE=REMOVE; 289 + shift; 290 + for _var in "$@"; 291 + do 292 + if [ -n "${!_var-}" ]; then 293 + eval "${varName}"="${_var}"; 294 + return; 295 + fi; 296 + done; 297 + echo; 298 + echo "error: _assignFirst: could not find a non-empty variable whose name to assign to ${varName}."; 299 + echo " The following variables were all unset or empty:"; 300 + echo " $*"; 301 + if [ -z "${out:-}" ]; then 302 + echo ' If you do not want an "out" output in your derivation, make sure to define'; 303 + echo ' the other specific required outputs. This can be achieved by picking one'; 304 + echo " of the above as an output."; 305 + echo ' You do not have to remove "out" if you want to have a different default'; 306 + echo ' output, because the first output is taken as a default.'; 307 + echo; 308 + fi; 309 + return 1 310 + } 311 + _callImplicitHook () 312 + { 313 + 314 + local def="$1"; 315 + local hookName="$2"; 316 + if declare -F "$hookName" > /dev/null; then 317 + nixTalkativeLog "calling implicit '$hookName' function hook"; 318 + "$hookName"; 319 + else 320 + if type -p "$hookName" > /dev/null; then 321 + nixTalkativeLog "sourcing implicit '$hookName' script hook"; 322 + source "$hookName"; 323 + else 324 + if [ -n "${!hookName:-}" ]; then 325 + nixTalkativeLog "evaling implicit '$hookName' string hook"; 326 + eval "${!hookName}"; 327 + else 328 + return "$def"; 329 + fi; 330 + fi; 331 + fi 332 + } 333 + _defaultUnpack () 334 + { 335 + 336 + local fn="$1"; 337 + local destination; 338 + if [ -d "$fn" ]; then 339 + destination="$(stripHash "$fn")"; 340 + if [ -e "$destination" ]; then 341 + echo "Cannot copy $fn to $destination: destination already exists!"; 342 + echo "Did you specify two \"srcs\" with the same \"name\"?"; 343 + return 1; 344 + fi; 345 + cp -r --preserve=timestamps --reflink=auto -- "$fn" "$destination"; 346 + else 347 + case "$fn" in 348 + *.tar.xz | *.tar.lzma | *.txz) 349 + ( XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn"; 350 + true ) | tar xf - --mode=+w --warning=no-timestamp 351 + ;; 352 + *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) 353 + tar xf "$fn" --mode=+w --warning=no-timestamp 354 + ;; 355 + *) 356 + return 1 357 + ;; 358 + esac; 359 + fi 360 + } 361 + _doStrip () 362 + { 363 + 364 + local -ra flags=(dontStripHost dontStripTarget); 365 + local -ra debugDirs=(stripDebugList stripDebugListTarget); 366 + local -ra allDirs=(stripAllList stripAllListTarget); 367 + local -ra stripCmds=(STRIP STRIP_FOR_TARGET); 368 + local -ra ranlibCmds=(RANLIB RANLIB_FOR_TARGET); 369 + stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin Applications Library/Frameworks}; 370 + stripDebugListTarget=${stripDebugListTarget[*]:-}; 371 + stripAllList=${stripAllList[*]:-}; 372 + stripAllListTarget=${stripAllListTarget[*]:-}; 373 + local i; 374 + for i in ${!stripCmds[@]}; 375 + do 376 + local -n flag="${flags[$i]}"; 377 + local -n debugDirList="${debugDirs[$i]}"; 378 + local -n allDirList="${allDirs[$i]}"; 379 + local -n stripCmd="${stripCmds[$i]}"; 380 + local -n ranlibCmd="${ranlibCmds[$i]}"; 381 + if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null 1>&2; then 382 + continue; 383 + fi; 384 + stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S -p}"; 385 + stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags[*]:--s -p}"; 386 + done 387 + } 388 + _eval () 389 + { 390 + 391 + if declare -F "$1" > /dev/null 2>&1; then 392 + "$@"; 393 + else 394 + eval "$1"; 395 + fi 396 + } 397 + _logHook () 398 + { 399 + 400 + if [[ -z ${NIX_LOG_FD-} ]]; then 401 + return; 402 + fi; 403 + local hookKind="$1"; 404 + local hookExpr="$2"; 405 + shift 2; 406 + if declare -F "$hookExpr" > /dev/null 2>&1; then 407 + nixTalkativeLog "calling '$hookKind' function hook '$hookExpr'" "$@"; 408 + else 409 + if type -p "$hookExpr" > /dev/null; then 410 + nixTalkativeLog "sourcing '$hookKind' script hook '$hookExpr'"; 411 + else 412 + if [[ "$hookExpr" != "_callImplicitHook"* ]]; then 413 + local exprToOutput; 414 + if [[ ${NIX_DEBUG:-0} -ge 5 ]]; then 415 + exprToOutput="$hookExpr"; 416 + else 417 + local hookExprLine; 418 + while IFS= read -r hookExprLine; do 419 + hookExprLine="${hookExprLine#"${hookExprLine%%[![:space:]]*}"}"; 420 + if [[ -n "$hookExprLine" ]]; then 421 + exprToOutput+="$hookExprLine\\n "; 422 + fi; 423 + done <<< "$hookExpr"; 424 + exprToOutput="${exprToOutput%%\\n }"; 425 + fi; 426 + nixTalkativeLog "evaling '$hookKind' string hook '$exprToOutput'"; 427 + fi; 428 + fi; 429 + fi 430 + } 431 + _makeSymlinksRelative () 432 + { 433 + 434 + local symlinkTarget; 435 + if [ "${dontRewriteSymlinks-}" ] || [ ! -e "$prefix" ]; then 436 + return; 437 + fi; 438 + while IFS= read -r -d '' f; do 439 + symlinkTarget=$(readlink "$f"); 440 + if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then 441 + continue; 442 + fi; 443 + if [ ! -e "$symlinkTarget" ]; then 444 + echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; 445 + fi; 446 + echo "rewriting symlink $f to be relative to $prefix"; 447 + ln -snrf "$symlinkTarget" "$f"; 448 + done < <(find $prefix -type l -print0) 449 + } 450 + _makeSymlinksRelativeInAllOutputs () 451 + { 452 + 453 + local output; 454 + for output in $(getAllOutputNames); 455 + do 456 + prefix="${!output}" _makeSymlinksRelative; 457 + done 458 + } 459 + _moveLib64 () 460 + { 461 + 462 + if [ "${dontMoveLib64-}" = 1 ]; then 463 + return; 464 + fi; 465 + if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then 466 + return; 467 + fi; 468 + echo "moving $prefix/lib64/* to $prefix/lib"; 469 + mkdir -p $prefix/lib; 470 + shopt -s dotglob; 471 + for i in $prefix/lib64/*; 472 + do 473 + mv --no-clobber "$i" $prefix/lib; 474 + done; 475 + shopt -u dotglob; 476 + rmdir $prefix/lib64; 477 + ln -s lib $prefix/lib64 478 + } 479 + _moveSbin () 480 + { 481 + 482 + if [ "${dontMoveSbin-}" = 1 ]; then 483 + return; 484 + fi; 485 + if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then 486 + return; 487 + fi; 488 + echo "moving $prefix/sbin/* to $prefix/bin"; 489 + mkdir -p $prefix/bin; 490 + shopt -s dotglob; 491 + for i in $prefix/sbin/*; 492 + do 493 + mv "$i" $prefix/bin; 494 + done; 495 + shopt -u dotglob; 496 + rmdir $prefix/sbin; 497 + ln -s bin $prefix/sbin 498 + } 499 + _moveSystemdUserUnits () 500 + { 501 + 502 + if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then 503 + return; 504 + fi; 505 + if [ ! -e "${prefix:?}/lib/systemd/user" ]; then 506 + return; 507 + fi; 508 + local source="$prefix/lib/systemd/user"; 509 + local target="$prefix/share/systemd/user"; 510 + echo "moving $source/* to $target"; 511 + mkdir -p "$target"; 512 + ( shopt -s dotglob; 513 + for i in "$source"/*; 514 + do 515 + mv "$i" "$target"; 516 + done ); 517 + rmdir "$source"; 518 + ln -s "$target" "$source" 519 + } 520 + _moveToShare () 521 + { 522 + 523 + if [ -n "$__structuredAttrs" ]; then 524 + if [ -z "${forceShare-}" ]; then 525 + forceShare=(man doc info); 526 + fi; 527 + else 528 + forceShare=(${forceShare:-man doc info}); 529 + fi; 530 + if [[ -z "$out" ]]; then 531 + return; 532 + fi; 533 + for d in "${forceShare[@]}"; 534 + do 535 + if [ -d "$out/$d" ]; then 536 + if [ -d "$out/share/$d" ]; then 537 + echo "both $d/ and share/$d/ exist!"; 538 + else 539 + echo "moving $out/$d to $out/share/$d"; 540 + mkdir -p $out/share; 541 + mv $out/$d $out/share/; 542 + fi; 543 + fi; 544 + done 545 + } 546 + _multioutConfig () 547 + { 548 + 549 + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${setOutputFlags-1}" ]; then 550 + return; 551 + fi; 552 + if [ -z "${shareDocName:-}" ]; then 553 + local confScript="${configureScript:-}"; 554 + if [ -z "$confScript" ] && [ -x ./configure ]; then 555 + confScript=./configure; 556 + fi; 557 + if [ -f "$confScript" ]; then 558 + local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; 559 + fi; 560 + if [ -z "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then 561 + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; 562 + fi; 563 + fi; 564 + prependToVar configureFlags --bindir="${!outputBin}"/bin --sbindir="${!outputBin}"/sbin --includedir="${!outputInclude}"/include --mandir="${!outputMan}"/share/man --infodir="${!outputInfo}"/share/info --docdir="${!outputDoc}"/share/doc/"${shareDocName}" --libdir="${!outputLib}"/lib --libexecdir="${!outputLib}"/libexec --localedir="${!outputLib}"/share/locale; 565 + prependToVar installFlags pkgconfigdir="${!outputDev}"/lib/pkgconfig m4datadir="${!outputDev}"/share/aclocal aclocaldir="${!outputDev}"/share/aclocal 566 + } 567 + _multioutDevs () 568 + { 569 + 570 + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${moveToDev-1}" ]; then 571 + return; 572 + fi; 573 + moveToOutput include "${!outputInclude}"; 574 + moveToOutput lib/pkgconfig "${!outputDev}"; 575 + moveToOutput share/pkgconfig "${!outputDev}"; 576 + moveToOutput lib/cmake "${!outputDev}"; 577 + moveToOutput share/aclocal "${!outputDev}"; 578 + for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; 579 + do 580 + echo "Patching '$f' includedir to output ${!outputInclude}"; 581 + sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; 582 + done 583 + } 584 + _multioutDocs () 585 + { 586 + 587 + local REMOVE=REMOVE; 588 + moveToOutput share/info "${!outputInfo}"; 589 + moveToOutput share/doc "${!outputDoc}"; 590 + moveToOutput share/gtk-doc "${!outputDevdoc}"; 591 + moveToOutput share/devhelp/books "${!outputDevdoc}"; 592 + moveToOutput share/man "${!outputMan}"; 593 + moveToOutput share/man/man3 "${!outputDevman}" 594 + } 595 + _multioutPropagateDev () 596 + { 597 + 598 + if [ "$(getAllOutputNames)" = "out" ]; then 599 + return; 600 + fi; 601 + local outputFirst; 602 + for outputFirst in $(getAllOutputNames); 603 + do 604 + break; 605 + done; 606 + local propagaterOutput="$outputDev"; 607 + if [ -z "$propagaterOutput" ]; then 608 + propagaterOutput="$outputFirst"; 609 + fi; 610 + if [ -z "${propagatedBuildOutputs+1}" ]; then 611 + local po_dirty="$outputBin $outputInclude $outputLib"; 612 + set +o pipefail; 613 + propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; 614 + set -o pipefail; 615 + fi; 616 + if [ -z "$propagatedBuildOutputs" ]; then 617 + return; 618 + fi; 619 + mkdir -p "${!propagaterOutput}"/nix-support; 620 + for output in $propagatedBuildOutputs; 621 + do 622 + echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; 623 + done 624 + } 625 + _nixLogWithLevel () 626 + { 627 + 628 + [[ -z ${NIX_LOG_FD-} || ${NIX_DEBUG:-0} -lt ${1:?} ]] && return 0; 629 + local logLevel; 630 + case "${1:?}" in 631 + 0) 632 + logLevel=ERROR 633 + ;; 634 + 1) 635 + logLevel=WARN 636 + ;; 637 + 2) 638 + logLevel=NOTICE 639 + ;; 640 + 3) 641 + logLevel=INFO 642 + ;; 643 + 4) 644 + logLevel=TALKATIVE 645 + ;; 646 + 5) 647 + logLevel=CHATTY 648 + ;; 649 + 6) 650 + logLevel=DEBUG 651 + ;; 652 + 7) 653 + logLevel=VOMIT 654 + ;; 655 + *) 656 + echo "_nixLogWithLevel: called with invalid log level: ${1:?}" >&"$NIX_LOG_FD"; 657 + return 1 658 + ;; 659 + esac; 660 + local callerName="${FUNCNAME[2]}"; 661 + if [[ $callerName == "_callImplicitHook" ]]; then 662 + callerName="${hookName:?}"; 663 + fi; 664 + printf "%s: %s: %s\n" "$logLevel" "$callerName" "${2:?}" >&"$NIX_LOG_FD" 665 + } 666 + _overrideFirst () 667 + { 668 + 669 + if [ -z "${!1-}" ]; then 670 + _assignFirst "$@"; 671 + fi 672 + } 673 + _pruneLibtoolFiles () 674 + { 675 + 676 + if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then 677 + return; 678 + fi; 679 + find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \; 680 + } 681 + _updateSourceDateEpochFromSourceRoot () 682 + { 683 + 684 + if [ -n "$sourceRoot" ]; then 685 + updateSourceDateEpoch "$sourceRoot"; 686 + fi 687 + } 688 + activatePackage () 689 + { 690 + 691 + local pkg="$1"; 692 + local -r hostOffset="$2"; 693 + local -r targetOffset="$3"; 694 + (( hostOffset <= targetOffset )) || exit 1; 695 + if [ -f "$pkg" ]; then 696 + nixTalkativeLog "sourcing setup hook '$pkg'"; 697 + source "$pkg"; 698 + fi; 699 + if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then 700 + addToSearchPath _PATH "$pkg/bin"; 701 + fi; 702 + if (( hostOffset <= -1 )); then 703 + addToSearchPath _XDG_DATA_DIRS "$pkg/share"; 704 + fi; 705 + if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then 706 + addToSearchPath _HOST_PATH "$pkg/bin"; 707 + fi; 708 + if [[ -f "$pkg/nix-support/setup-hook" ]]; then 709 + nixTalkativeLog "sourcing setup hook '$pkg/nix-support/setup-hook'"; 710 + source "$pkg/nix-support/setup-hook"; 711 + fi 712 + } 713 + addEnvHooks () 714 + { 715 + 716 + local depHostOffset="$1"; 717 + shift; 718 + local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; 719 + local pkgHookVar; 720 + for pkgHookVar in "${!pkgHookVarsSlice}"; 721 + do 722 + eval "${pkgHookVar}s"'+=("$@")'; 723 + done 724 + } 725 + addToSearchPath () 726 + { 727 + 728 + addToSearchPathWithCustomDelimiter ":" "$@" 729 + } 730 + addToSearchPathWithCustomDelimiter () 731 + { 732 + 733 + local delimiter="$1"; 734 + local varName="$2"; 735 + local dir="$3"; 736 + if [[ -d "$dir" && "${!varName:+${delimiter}${!varName}${delimiter}}" != *"${delimiter}${dir}${delimiter}"* ]]; then 737 + export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; 738 + fi 739 + } 740 + appendToVar () 741 + { 742 + 743 + local -n nameref="$1"; 744 + local useArray type; 745 + if [ -n "$__structuredAttrs" ]; then 746 + useArray=true; 747 + else 748 + useArray=false; 749 + fi; 750 + if type=$(declare -p "$1" 2> /dev/null); then 751 + case "${type#* }" in 752 + -A*) 753 + echo "appendToVar(): ERROR: trying to use appendToVar on an associative array, use variable+=([\"X\"]=\"Y\") instead." 1>&2; 754 + return 1 755 + ;; 756 + -a*) 757 + useArray=true 758 + ;; 759 + *) 760 + useArray=false 761 + ;; 762 + esac; 763 + fi; 764 + shift; 765 + if $useArray; then 766 + nameref=(${nameref+"${nameref[@]}"} "$@"); 767 + else 768 + nameref="${nameref-} $*"; 769 + fi 770 + } 771 + auditTmpdir () 772 + { 773 + 774 + local dir="$1"; 775 + [ -e "$dir" ] || return 0; 776 + echo "checking for references to $TMPDIR/ in $dir..."; 777 + function _processFile () 778 + { 779 + local file="$1"; 780 + if isELF "$file"; then 781 + if { 782 + printf :; 783 + patchelf --print-rpath "$file" 784 + } | grep -q -F ":$TMPDIR/"; then 785 + echo "RPATH of binary $file contains a forbidden reference to $TMPDIR/"; 786 + exit 1; 787 + fi; 788 + else 789 + if isScript "$file"; then 790 + filename=${i##*/}; 791 + dir=${i%/*}; 792 + if [ -e "$dir/.$filename-wrapped" ]; then 793 + if grep -q -F "$TMPDIR/" "$file"; then 794 + echo "wrapper script $file contains a forbidden reference to $TMPDIR/"; 795 + exit 1; 796 + fi; 797 + fi; 798 + fi; 799 + fi 800 + }; 801 + find "$dir" -type f -not -path '*/.build-id/*' -print0 | parallelMap _processFile; 802 + unset -f _processFile 803 + } 804 + bintoolsWrapper_addLDVars () 805 + { 806 + 807 + local role_post; 808 + getHostRoleEnvHook; 809 + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then 810 + export NIX_LDFLAGS${role_post}+=" -L$1/lib64"; 811 + fi; 812 + if [[ -d "$1/lib" ]]; then 813 + local -a glob=($1/lib/lib*); 814 + if [ "${#glob[*]}" -gt 0 ]; then 815 + export NIX_LDFLAGS${role_post}+=" -L$1/lib"; 816 + fi; 817 + fi 818 + } 819 + buildPhase () 820 + { 821 + 822 + runHook preBuild; 823 + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then 824 + echo "no Makefile or custom buildPhase, doing nothing"; 825 + else 826 + foundMakefile=1; 827 + local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); 828 + concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray; 829 + echoCmd 'build flags' "${flagsArray[@]}"; 830 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 831 + unset flagsArray; 832 + fi; 833 + runHook postBuild 834 + } 835 + cargoBuildHook () 836 + { 837 + 838 + echo "Executing cargoBuildHook"; 839 + runHook preBuild; 840 + export "CARGO_PROFILE_${cargoBuildType@U}_STRIP"=false; 841 + if [ -n "${buildAndTestSubdir-}" ]; then 842 + CARGO_TARGET_DIR="$(pwd)/target"; 843 + export CARGO_TARGET_DIR; 844 + pushd "${buildAndTestSubdir}"; 845 + fi; 846 + local flagsArray=("-j" "$NIX_BUILD_CORES" "--target" "x86_64-unknown-linux-gnu" "--offline"); 847 + if [ "${cargoBuildType}" != "debug" ]; then 848 + flagsArray+=("--profile" "${cargoBuildType}"); 849 + fi; 850 + if [ -n "${cargoBuildNoDefaultFeatures-}" ]; then 851 + flagsArray+=("--no-default-features"); 852 + fi; 853 + if [ -n "${cargoBuildFeatures-}" ]; then 854 + flagsArray+=("--features=$(concatStringsSep "," cargoBuildFeatures)"); 855 + fi; 856 + concatTo flagsArray cargoBuildFlags; 857 + echoCmd 'cargoBuildHook flags' "${flagsArray[@]}"; 858 + env "CC_X86_64_UNKNOWN_LINUX_GNU=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" "CXX_X86_64_UNKNOWN_LINUX_GNU=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/c++" "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" "CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu" "HOST_CC=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" "HOST_CXX=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/c++" "CC_X86_64_UNKNOWN_LINUX_GNU=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" "CXX_X86_64_UNKNOWN_LINUX_GNU=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/c++" "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" cargo build "${flagsArray[@]}"; 859 + if [ -n "${buildAndTestSubdir-}" ]; then 860 + popd; 861 + fi; 862 + runHook postBuild; 863 + echo "Finished cargoBuildHook" 864 + } 865 + cargoCheckHook () 866 + { 867 + 868 + echo "Executing cargoCheckHook"; 869 + runHook preCheck; 870 + if [[ -n "${buildAndTestSubdir-}" ]]; then 871 + pushd "${buildAndTestSubdir}"; 872 + fi; 873 + local flagsArray=("-j" "$NIX_BUILD_CORES"); 874 + export RUST_TEST_THREADS=$NIX_BUILD_CORES; 875 + if [[ ! -z ${dontUseCargoParallelTests-} ]]; then 876 + RUST_TEST_THREADS=1; 877 + fi; 878 + if [ "${cargoCheckType}" != "debug" ]; then 879 + flagsArray+=("--profile" "${cargoCheckType}"); 880 + fi; 881 + if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then 882 + flagsArray+=("--no-default-features"); 883 + fi; 884 + if [ -n "${cargoCheckFeatures-}" ]; then 885 + flagsArray+=("--features=$(concatStringsSep "," cargoCheckFeatures)"); 886 + fi; 887 + flagsArray+=("--target" "x86_64-unknown-linux-gnu" "--offline"); 888 + prependToVar checkFlags "--"; 889 + concatTo flagsArray cargoTestFlags checkFlags checkFlagsArray; 890 + echoCmd 'cargoCheckHook flags' "${flagsArray[@]}"; 891 + env "CC_X86_64_UNKNOWN_LINUX_GNU=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" "CXX_X86_64_UNKNOWN_LINUX_GNU=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/c++" "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" "CARGO_BUILD_TARGET=x86_64-unknown-linux-gnu" "HOST_CC=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" "HOST_CXX=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/c++" "CC_X86_64_UNKNOWN_LINUX_GNU=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" "CXX_X86_64_UNKNOWN_LINUX_GNU=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/c++" "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" cargo test "${flagsArray[@]}"; 892 + if [[ -n "${buildAndTestSubdir-}" ]]; then 893 + popd; 894 + fi; 895 + echo "Finished cargoCheckHook"; 896 + runHook postCheck 897 + } 898 + cargoInstallHook () 899 + { 900 + 901 + echo "Executing cargoInstallHook"; 902 + runHook preInstall; 903 + releaseDir=target/x86_64-unknown-linux-gnu/$cargoBuildType; 904 + tmpDir="${releaseDir}-tmp"; 905 + mapfile -t targets < <(find "$NIX_BUILD_TOP" -type d | grep "${tmpDir}$"); 906 + for target in "${targets[@]}"; 907 + do 908 + rm -rf "$target/../../${cargoBuildType}"; 909 + ln -srf "$target" "$target/../../"; 910 + done; 911 + mkdir -p $out/bin $out/lib; 912 + xargs -r cp -t $out/bin <<< $bins; 913 + find $tmpDir -maxdepth 1 -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" -print0 | xargs -r -0 cp -t $out/lib; 914 + find "${releaseDir}" -maxdepth 1 -name '*.dSYM' -exec cp -RLt $out/bin/ {} +; 915 + rmdir --ignore-fail-on-non-empty $out/lib $out/bin; 916 + runHook postInstall; 917 + echo "Finished cargoInstallHook" 918 + } 919 + cargoInstallPostBuildHook () 920 + { 921 + 922 + echo "Executing cargoInstallPostBuildHook"; 923 + releaseDir=target/x86_64-unknown-linux-gnu/$cargoBuildType; 924 + tmpDir="${releaseDir}-tmp"; 925 + mkdir -p $tmpDir; 926 + cp -r ${releaseDir}/* $tmpDir/; 927 + bins=$(find $tmpDir -maxdepth 1 -type f -executable ! \( -regex ".*\.\(so.[0-9.]+\|so\|a\|dylib\)" \)); 928 + echo "Finished cargoInstallPostBuildHook" 929 + } 930 + cargoSetupPostPatchHook () 931 + { 932 + 933 + echo "Executing cargoSetupPostPatchHook"; 934 + cargoDepsLockfile="$cargoDepsCopy/Cargo.lock"; 935 + srcLockfile="$(pwd)/${cargoRoot:+$cargoRoot/}Cargo.lock"; 936 + echo "Validating consistency between $srcLockfile and $cargoDepsLockfile"; 937 + if ! /nix/store/ibx4jfwlhjg4g0s6rrxrpaxa3ka8ns4m-diffutils-3.12/bin/diff $srcLockfile $cargoDepsLockfile; then 938 + if ! [ -e $srcLockfile ]; then 939 + echo "ERROR: Missing Cargo.lock from src. Expected to find it at: $srcLockfile"; 940 + echo "Hint: You can use the cargoPatches attribute to add a Cargo.lock manually to the build."; 941 + exit 1; 942 + fi; 943 + if ! [ -e $cargoDepsLockfile ]; then 944 + echo "ERROR: Missing lockfile from cargo vendor. Expected to find it at: $cargoDepsLockfile"; 945 + exit 1; 946 + fi; 947 + echo; 948 + echo "ERROR: cargoHash or cargoSha256 is out of date"; 949 + echo; 950 + echo "Cargo.lock is not the same in $cargoDepsCopy"; 951 + echo; 952 + echo "To fix the issue:"; 953 + echo '1. Set cargoHash/cargoSha256 to an empty string: `cargoHash = "";`'; 954 + echo '2. Build the derivation and wait for it to fail with a hash mismatch'; 955 + echo '3. Copy the "got: sha256-..." value back into the cargoHash field'; 956 + echo ' You should have: cargoHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";'; 957 + echo; 958 + exit 1; 959 + fi; 960 + unset cargoDepsCopy; 961 + echo "Finished cargoSetupPostPatchHook" 962 + } 963 + cargoSetupPostUnpackHook () 964 + { 965 + 966 + echo "Executing cargoSetupPostUnpackHook"; 967 + if [ -z $cargoVendorDir ]; then 968 + if [ -d "$cargoDeps" ]; then 969 + local dest=$(stripHash "$cargoDeps"); 970 + cp -Lr --reflink=auto -- "$cargoDeps" "$dest"; 971 + chmod -R +644 -- "$dest"; 972 + else 973 + unpackFile "$cargoDeps"; 974 + fi; 975 + export cargoDepsCopy="$(realpath "$(stripHash $cargoDeps)")"; 976 + else 977 + cargoDepsCopy="$(realpath "$(pwd)/$sourceRoot/${cargoRoot:+$cargoRoot/}${cargoVendorDir}")"; 978 + fi; 979 + if [ ! -d .cargo ]; then 980 + mkdir .cargo; 981 + fi; 982 + config="$cargoDepsCopy/.cargo/config.toml"; 983 + if [[ ! -e $config ]]; then 984 + config=/nix/store/q0hmsd1h8bph16h58w80nafjg48yqdbw-fetchcargo-default-config.toml; 985 + fi; 986 + tmp_config=$(mktemp); 987 + substitute $config $tmp_config --subst-var-by vendor "$cargoDepsCopy"; 988 + cat ${tmp_config} >> .cargo/config.toml; 989 + cat >> .cargo/config.toml <<'EOF' 990 + [target."x86_64-unknown-linux-gnu"] 991 + "linker" = "/nix/store/pbqah1qk4b5y14fqinr1h8zvhqy71v81-gcc-wrapper-14.3.0/bin/cc" 992 + 993 + EOF 994 + 995 + echo "Finished cargoSetupPostUnpackHook" 996 + } 997 + ccWrapper_addCVars () 998 + { 999 + 1000 + local role_post; 1001 + getHostRoleEnvHook; 1002 + if [ -d "$1/include" ]; then 1003 + export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include"; 1004 + fi; 1005 + if [ -d "$1/Library/Frameworks" ]; then 1006 + export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks"; 1007 + fi 1008 + } 1009 + checkPhase () 1010 + { 1011 + 1012 + runHook preCheck; 1013 + if [[ -z "${foundMakefile:-}" ]]; then 1014 + echo "no Makefile or custom checkPhase, doing nothing"; 1015 + runHook postCheck; 1016 + return; 1017 + fi; 1018 + if [[ -z "${checkTarget:-}" ]]; then 1019 + if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then 1020 + checkTarget="check"; 1021 + else 1022 + if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then 1023 + checkTarget="test"; 1024 + fi; 1025 + fi; 1026 + fi; 1027 + if [[ -z "${checkTarget:-}" ]]; then 1028 + echo "no check/test target in ${makefile:-Makefile}, doing nothing"; 1029 + else 1030 + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); 1031 + concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget; 1032 + echoCmd 'check flags' "${flagsArray[@]}"; 1033 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 1034 + unset flagsArray; 1035 + fi; 1036 + runHook postCheck 1037 + } 1038 + compressManPages () 1039 + { 1040 + 1041 + local dir="$1"; 1042 + if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then 1043 + return; 1044 + fi; 1045 + echo "gzipping man pages under $dir/share/man/"; 1046 + find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | xargs -0 -n1 -P "$NIX_BUILD_CORES" gzip -f; 1047 + find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | sort -z | while IFS= read -r -d '' f; do 1048 + local target; 1049 + target="$(readlink -f "$f")"; 1050 + if [ -f "$target".gz ]; then 1051 + ln -sf "$target".gz "$f".gz && rm "$f"; 1052 + fi; 1053 + done 1054 + } 1055 + concatStringsSep () 1056 + { 1057 + 1058 + local sep="$1"; 1059 + local name="$2"; 1060 + local type oldifs; 1061 + if type=$(declare -p "$name" 2> /dev/null); then 1062 + local -n nameref="$name"; 1063 + case "${type#* }" in 1064 + -A*) 1065 + echo "concatStringsSep(): ERROR: trying to use concatStringsSep on an associative array." 1>&2; 1066 + return 1 1067 + ;; 1068 + -a*) 1069 + local IFS="$(printf '\036')" 1070 + ;; 1071 + *) 1072 + local IFS=" " 1073 + ;; 1074 + esac; 1075 + local ifs_separated="${nameref[*]}"; 1076 + echo -n "${ifs_separated//"$IFS"/"$sep"}"; 1077 + fi 1078 + } 1079 + concatTo () 1080 + { 1081 + 1082 + local -; 1083 + set -o noglob; 1084 + local -n targetref="$1"; 1085 + shift; 1086 + local arg default name type; 1087 + for arg in "$@"; 1088 + do 1089 + IFS="=" read -r name default <<< "$arg"; 1090 + local -n nameref="$name"; 1091 + if [[ -z "${nameref[*]}" && -n "$default" ]]; then 1092 + targetref+=("$default"); 1093 + else 1094 + if type=$(declare -p "$name" 2> /dev/null); then 1095 + case "${type#* }" in 1096 + -A*) 1097 + echo "concatTo(): ERROR: trying to use concatTo on an associative array." 1>&2; 1098 + return 1 1099 + ;; 1100 + -a*) 1101 + targetref+=("${nameref[@]}") 1102 + ;; 1103 + *) 1104 + if [[ "$name" = *"Array" ]]; then 1105 + nixErrorLog "concatTo(): $name is not declared as array, treating as a singleton. This will become an error in future"; 1106 + targetref+=(${nameref+"${nameref[@]}"}); 1107 + else 1108 + targetref+=(${nameref-}); 1109 + fi 1110 + ;; 1111 + esac; 1112 + fi; 1113 + fi; 1114 + done 1115 + } 1116 + configurePhase () 1117 + { 1118 + 1119 + runHook preConfigure; 1120 + : "${configureScript=}"; 1121 + if [[ -z "$configureScript" && -x ./configure ]]; then 1122 + configureScript=./configure; 1123 + fi; 1124 + if [ -z "${dontFixLibtool:-}" ]; then 1125 + export lt_cv_deplibs_check_method="${lt_cv_deplibs_check_method-pass_all}"; 1126 + local i; 1127 + find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do 1128 + echo "fixing libtool script $i"; 1129 + fixLibtool "$i"; 1130 + done; 1131 + CONFIGURE_MTIME_REFERENCE=$(mktemp configure.mtime.reference.XXXXXX); 1132 + find . -executable -type f -name configure -exec grep -l 'GNU Libtool is free software; you can redistribute it and/or modify' {} \; -exec touch -r {} "$CONFIGURE_MTIME_REFERENCE" \; -exec sed -i s_/usr/bin/file_file_g {} \; -exec touch -r "$CONFIGURE_MTIME_REFERENCE" {} \;; 1133 + rm -f "$CONFIGURE_MTIME_REFERENCE"; 1134 + fi; 1135 + if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then 1136 + prependToVar configureFlags "${prefixKey:---prefix=}$prefix"; 1137 + fi; 1138 + if [[ -f "$configureScript" ]]; then 1139 + if [ -z "${dontAddDisableDepTrack:-}" ]; then 1140 + if grep -q dependency-tracking "$configureScript"; then 1141 + prependToVar configureFlags --disable-dependency-tracking; 1142 + fi; 1143 + fi; 1144 + if [ -z "${dontDisableStatic:-}" ]; then 1145 + if grep -q enable-static "$configureScript"; then 1146 + prependToVar configureFlags --disable-static; 1147 + fi; 1148 + fi; 1149 + if [ -z "${dontPatchShebangsInConfigure:-}" ]; then 1150 + patchShebangs --build "$configureScript"; 1151 + fi; 1152 + fi; 1153 + if [ -n "$configureScript" ]; then 1154 + local -a flagsArray; 1155 + concatTo flagsArray configureFlags configureFlagsArray; 1156 + echoCmd 'configure flags' "${flagsArray[@]}"; 1157 + $configureScript "${flagsArray[@]}"; 1158 + unset flagsArray; 1159 + else 1160 + echo "no configure script, doing nothing"; 1161 + fi; 1162 + runHook postConfigure 1163 + } 1164 + consumeEntire () 1165 + { 1166 + 1167 + if IFS='' read -r -d '' "$1"; then 1168 + echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; 1169 + return 1; 1170 + fi 1171 + } 1172 + distPhase () 1173 + { 1174 + 1175 + runHook preDist; 1176 + local flagsArray=(); 1177 + concatTo flagsArray distFlags distFlagsArray distTarget=dist; 1178 + echo 'dist flags: %q' "${flagsArray[@]}"; 1179 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 1180 + if [ "${dontCopyDist:-0}" != 1 ]; then 1181 + mkdir -p "$out/tarballs"; 1182 + cp -pvd ${tarballs[*]:-*.tar.gz} "$out/tarballs"; 1183 + fi; 1184 + runHook postDist 1185 + } 1186 + dumpVars () 1187 + { 1188 + 1189 + if [ "${noDumpEnvVars:-0}" != 1 ]; then 1190 + { 1191 + install -m 0600 /dev/null "$NIX_BUILD_TOP/env-vars" && export 2> /dev/null >| "$NIX_BUILD_TOP/env-vars" 1192 + } || true; 1193 + fi 1194 + } 1195 + echoCmd () 1196 + { 1197 + 1198 + printf "%s:" "$1"; 1199 + shift; 1200 + printf ' %q' "$@"; 1201 + echo 1202 + } 1203 + exitHandler () 1204 + { 1205 + 1206 + exitCode="$?"; 1207 + set +e; 1208 + if [ -n "${showBuildStats:-}" ]; then 1209 + read -r -d '' -a buildTimes < <(times); 1210 + echo "build times:"; 1211 + echo "user time for the shell ${buildTimes[0]}"; 1212 + echo "system time for the shell ${buildTimes[1]}"; 1213 + echo "user time for all child processes ${buildTimes[2]}"; 1214 + echo "system time for all child processes ${buildTimes[3]}"; 1215 + fi; 1216 + if (( "$exitCode" != 0 )); then 1217 + runHook failureHook; 1218 + if [ -n "${succeedOnFailure:-}" ]; then 1219 + echo "build failed with exit code $exitCode (ignored)"; 1220 + mkdir -p "$out/nix-support"; 1221 + printf "%s" "$exitCode" > "$out/nix-support/failed"; 1222 + exit 0; 1223 + fi; 1224 + else 1225 + runHook exitHook; 1226 + fi; 1227 + return "$exitCode" 1228 + } 1229 + findInputs () 1230 + { 1231 + 1232 + local -r pkg="$1"; 1233 + local -r hostOffset="$2"; 1234 + local -r targetOffset="$3"; 1235 + (( hostOffset <= targetOffset )) || exit 1; 1236 + local varVar="${pkgAccumVarVars[hostOffset + 1]}"; 1237 + local varRef="$varVar[$((targetOffset - hostOffset))]"; 1238 + local var="${!varRef}"; 1239 + unset -v varVar varRef; 1240 + local varSlice="$var[*]"; 1241 + case " ${!varSlice-} " in 1242 + *" $pkg "*) 1243 + return 0 1244 + ;; 1245 + esac; 1246 + unset -v varSlice; 1247 + eval "$var"'+=("$pkg")'; 1248 + if ! [ -e "$pkg" ]; then 1249 + echo "build input $pkg does not exist" 1>&2; 1250 + exit 1; 1251 + fi; 1252 + function mapOffset () 1253 + { 1254 + local -r inputOffset="$1"; 1255 + local -n outputOffset="$2"; 1256 + if (( inputOffset <= 0 )); then 1257 + outputOffset=$((inputOffset + hostOffset)); 1258 + else 1259 + outputOffset=$((inputOffset - 1 + targetOffset)); 1260 + fi 1261 + }; 1262 + local relHostOffset; 1263 + for relHostOffset in "${allPlatOffsets[@]}"; 1264 + do 1265 + local files="${propagatedDepFilesVars[relHostOffset + 1]}"; 1266 + local hostOffsetNext; 1267 + mapOffset "$relHostOffset" hostOffsetNext; 1268 + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; 1269 + local relTargetOffset; 1270 + for relTargetOffset in "${allPlatOffsets[@]}"; 1271 + do 1272 + (( "$relHostOffset" <= "$relTargetOffset" )) || continue; 1273 + local fileRef="${files}[$relTargetOffset - $relHostOffset]"; 1274 + local file="${!fileRef}"; 1275 + unset -v fileRef; 1276 + local targetOffsetNext; 1277 + mapOffset "$relTargetOffset" targetOffsetNext; 1278 + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; 1279 + [[ -f "$pkg/nix-support/$file" ]] || continue; 1280 + local pkgNext; 1281 + read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; 1282 + for pkgNext in $pkgNext; 1283 + do 1284 + findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; 1285 + done; 1286 + done; 1287 + done 1288 + } 1289 + fixLibtool () 1290 + { 1291 + 1292 + local search_path; 1293 + for flag in $NIX_LDFLAGS; 1294 + do 1295 + case $flag in 1296 + -L*) 1297 + search_path+=" ${flag#-L}" 1298 + ;; 1299 + esac; 1300 + done; 1301 + sed -i "$1" -e "s^eval \(sys_lib_search_path=\).*^\1'${search_path:-}'^" -e 's^eval sys_lib_.+search_path=.*^^' 1302 + } 1303 + fixupPhase () 1304 + { 1305 + 1306 + local output; 1307 + for output in $(getAllOutputNames); 1308 + do 1309 + if [ -e "${!output}" ]; then 1310 + chmod -R u+w,u-s,g-s "${!output}"; 1311 + fi; 1312 + done; 1313 + runHook preFixup; 1314 + local output; 1315 + for output in $(getAllOutputNames); 1316 + do 1317 + prefix="${!output}" runHook fixupOutput; 1318 + done; 1319 + recordPropagatedDependencies; 1320 + if [ -n "${setupHook:-}" ]; then 1321 + mkdir -p "${!outputDev}/nix-support"; 1322 + substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; 1323 + fi; 1324 + if [ -n "${setupHooks:-}" ]; then 1325 + mkdir -p "${!outputDev}/nix-support"; 1326 + local hook; 1327 + for hook in ${setupHooks[@]}; 1328 + do 1329 + local content; 1330 + consumeEntire content < "$hook"; 1331 + substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; 1332 + unset -v content; 1333 + done; 1334 + unset -v hook; 1335 + fi; 1336 + if [ -n "${propagatedUserEnvPkgs[*]:-}" ]; then 1337 + mkdir -p "${!outputBin}/nix-support"; 1338 + printWords "${propagatedUserEnvPkgs[@]}" > "${!outputBin}/nix-support/propagated-user-env-packages"; 1339 + fi; 1340 + runHook postFixup 1341 + } 1342 + genericBuild () 1343 + { 1344 + 1345 + export GZIP_NO_TIMESTAMPS=1; 1346 + if [ -f "${buildCommandPath:-}" ]; then 1347 + source "$buildCommandPath"; 1348 + return; 1349 + fi; 1350 + if [ -n "${buildCommand:-}" ]; then 1351 + eval "$buildCommand"; 1352 + return; 1353 + fi; 1354 + if [ -z "${phases[*]:-}" ]; then 1355 + phases="${prePhases[*]:-} unpackPhase patchPhase ${preConfigurePhases[*]:-} configurePhase ${preBuildPhases[*]:-} buildPhase checkPhase ${preInstallPhases[*]:-} installPhase ${preFixupPhases[*]:-} fixupPhase installCheckPhase ${preDistPhases[*]:-} distPhase ${postPhases[*]:-}"; 1356 + fi; 1357 + for curPhase in ${phases[*]}; 1358 + do 1359 + runPhase "$curPhase"; 1360 + done 1361 + } 1362 + getAllOutputNames () 1363 + { 1364 + 1365 + if [ -n "$__structuredAttrs" ]; then 1366 + echo "${!outputs[*]}"; 1367 + else 1368 + echo "$outputs"; 1369 + fi 1370 + } 1371 + getHostRole () 1372 + { 1373 + 1374 + getRole "$hostOffset" 1375 + } 1376 + getHostRoleEnvHook () 1377 + { 1378 + 1379 + getRole "$depHostOffset" 1380 + } 1381 + getRole () 1382 + { 1383 + 1384 + case $1 in 1385 + -1) 1386 + role_post='_FOR_BUILD' 1387 + ;; 1388 + 0) 1389 + role_post='' 1390 + ;; 1391 + 1) 1392 + role_post='_FOR_TARGET' 1393 + ;; 1394 + *) 1395 + echo "binutils-wrapper-2.44: used as improper sort of dependency" 1>&2; 1396 + return 1 1397 + ;; 1398 + esac 1399 + } 1400 + getTargetRole () 1401 + { 1402 + 1403 + getRole "$targetOffset" 1404 + } 1405 + getTargetRoleEnvHook () 1406 + { 1407 + 1408 + getRole "$depTargetOffset" 1409 + } 1410 + getTargetRoleWrapper () 1411 + { 1412 + 1413 + case $targetOffset in 1414 + -1) 1415 + export NIX_BINTOOLS_WRAPPER_TARGET_BUILD_x86_64_unknown_linux_gnu=1 1416 + ;; 1417 + 0) 1418 + export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1 1419 + ;; 1420 + 1) 1421 + export NIX_BINTOOLS_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu=1 1422 + ;; 1423 + *) 1424 + echo "binutils-wrapper-2.44: used as improper sort of dependency" 1>&2; 1425 + return 1 1426 + ;; 1427 + esac 1428 + } 1429 + installCheckPhase () 1430 + { 1431 + 1432 + runHook preInstallCheck; 1433 + if [[ -z "${foundMakefile:-}" ]]; then 1434 + echo "no Makefile or custom installCheckPhase, doing nothing"; 1435 + else 1436 + if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} "${installCheckTarget:-installcheck}" > /dev/null 2>&1; then 1437 + echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; 1438 + else 1439 + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); 1440 + concatTo flagsArray makeFlags makeFlagsArray installCheckFlags installCheckFlagsArray installCheckTarget=installcheck; 1441 + echoCmd 'installcheck flags' "${flagsArray[@]}"; 1442 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 1443 + unset flagsArray; 1444 + fi; 1445 + fi; 1446 + runHook postInstallCheck 1447 + } 1448 + installPhase () 1449 + { 1450 + 1451 + runHook preInstall; 1452 + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then 1453 + echo "no Makefile or custom installPhase, doing nothing"; 1454 + runHook postInstall; 1455 + return; 1456 + else 1457 + foundMakefile=1; 1458 + fi; 1459 + if [ -n "$prefix" ]; then 1460 + mkdir -p "$prefix"; 1461 + fi; 1462 + local flagsArray=(${enableParallelInstalling:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); 1463 + concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install; 1464 + echoCmd 'install flags' "${flagsArray[@]}"; 1465 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 1466 + unset flagsArray; 1467 + runHook postInstall 1468 + } 1469 + isELF () 1470 + { 1471 + 1472 + local fn="$1"; 1473 + local fd; 1474 + local magic; 1475 + exec {fd}< "$fn"; 1476 + read -r -n 4 -u "$fd" magic; 1477 + exec {fd}>&-; 1478 + if [ "$magic" = 'ELF' ]; then 1479 + return 0; 1480 + else 1481 + return 1; 1482 + fi 1483 + } 1484 + isMachO () 1485 + { 1486 + 1487 + local fn="$1"; 1488 + local fd; 1489 + local magic; 1490 + exec {fd}< "$fn"; 1491 + read -r -n 4 -u "$fd" magic; 1492 + exec {fd}>&-; 1493 + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xcf") || "$magic" = $(echo -ne "\xcf\xfa\xed\xfe") ]]; then 1494 + return 0; 1495 + else 1496 + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xce") || "$magic" = $(echo -ne "\xce\xfa\xed\xfe") ]]; then 1497 + return 0; 1498 + else 1499 + if [[ "$magic" = $(echo -ne "\xca\xfe\xba\xbe") || "$magic" = $(echo -ne "\xbe\xba\xfe\xca") ]]; then 1500 + return 0; 1501 + else 1502 + return 1; 1503 + fi; 1504 + fi; 1505 + fi 1506 + } 1507 + isScript () 1508 + { 1509 + 1510 + local fn="$1"; 1511 + local fd; 1512 + local magic; 1513 + exec {fd}< "$fn"; 1514 + read -r -n 2 -u "$fd" magic; 1515 + exec {fd}>&-; 1516 + if [[ "$magic" =~ \#! ]]; then 1517 + return 0; 1518 + else 1519 + return 1; 1520 + fi 1521 + } 1522 + mapOffset () 1523 + { 1524 + 1525 + local -r inputOffset="$1"; 1526 + local -n outputOffset="$2"; 1527 + if (( inputOffset <= 0 )); then 1528 + outputOffset=$((inputOffset + hostOffset)); 1529 + else 1530 + outputOffset=$((inputOffset - 1 + targetOffset)); 1531 + fi 1532 + } 1533 + moveToOutput () 1534 + { 1535 + 1536 + local patt="$1"; 1537 + local dstOut="$2"; 1538 + local output; 1539 + for output in $(getAllOutputNames); 1540 + do 1541 + if [ "${!output}" = "$dstOut" ]; then 1542 + continue; 1543 + fi; 1544 + local srcPath; 1545 + for srcPath in "${!output}"/$patt; 1546 + do 1547 + if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then 1548 + continue; 1549 + fi; 1550 + if [ "$dstOut" = REMOVE ]; then 1551 + echo "Removing $srcPath"; 1552 + rm -r "$srcPath"; 1553 + else 1554 + local dstPath="$dstOut${srcPath#${!output}}"; 1555 + echo "Moving $srcPath to $dstPath"; 1556 + if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then 1557 + rmdir "$srcPath" --ignore-fail-on-non-empty; 1558 + if [ -d "$srcPath" ]; then 1559 + mv -t "$dstPath" "$srcPath"/*; 1560 + rmdir "$srcPath"; 1561 + fi; 1562 + else 1563 + mkdir -p "$(readlink -m "$dstPath/..")"; 1564 + mv "$srcPath" "$dstPath"; 1565 + fi; 1566 + fi; 1567 + local srcParent="$(readlink -m "$srcPath/..")"; 1568 + if [ -n "$(find "$srcParent" -maxdepth 0 -type d -empty 2> /dev/null)" ]; then 1569 + echo "Removing empty $srcParent/ and (possibly) its parents"; 1570 + rmdir -p --ignore-fail-on-non-empty "$srcParent" 2> /dev/null || true; 1571 + fi; 1572 + done; 1573 + done 1574 + } 1575 + nixChattyLog () 1576 + { 1577 + 1578 + _nixLogWithLevel 5 "$*" 1579 + } 1580 + nixDebugLog () 1581 + { 1582 + 1583 + _nixLogWithLevel 6 "$*" 1584 + } 1585 + nixErrorLog () 1586 + { 1587 + 1588 + _nixLogWithLevel 0 "$*" 1589 + } 1590 + nixInfoLog () 1591 + { 1592 + 1593 + _nixLogWithLevel 3 "$*" 1594 + } 1595 + nixLog () 1596 + { 1597 + 1598 + [[ -z ${NIX_LOG_FD-} ]] && return 0; 1599 + local callerName="${FUNCNAME[1]}"; 1600 + if [[ $callerName == "_callImplicitHook" ]]; then 1601 + callerName="${hookName:?}"; 1602 + fi; 1603 + printf "%s: %s\n" "$callerName" "$*" >&"$NIX_LOG_FD" 1604 + } 1605 + nixNoticeLog () 1606 + { 1607 + 1608 + _nixLogWithLevel 2 "$*" 1609 + } 1610 + nixTalkativeLog () 1611 + { 1612 + 1613 + _nixLogWithLevel 4 "$*" 1614 + } 1615 + nixVomitLog () 1616 + { 1617 + 1618 + _nixLogWithLevel 7 "$*" 1619 + } 1620 + nixWarnLog () 1621 + { 1622 + 1623 + _nixLogWithLevel 1 "$*" 1624 + } 1625 + noBrokenSymlinks () 1626 + { 1627 + 1628 + local -r output="${1:?}"; 1629 + local path; 1630 + local pathParent; 1631 + local symlinkTarget; 1632 + local -i numDanglingSymlinks=0; 1633 + local -i numReflexiveSymlinks=0; 1634 + local -i numUnreadableSymlinks=0; 1635 + if [[ ! -e $output ]]; then 1636 + nixWarnLog "skipping non-existent output $output"; 1637 + return 0; 1638 + fi; 1639 + nixInfoLog "running on $output"; 1640 + while IFS= read -r -d '' path; do 1641 + pathParent="$(dirname "$path")"; 1642 + if ! symlinkTarget="$(readlink "$path")"; then 1643 + nixErrorLog "the symlink $path is unreadable"; 1644 + numUnreadableSymlinks+=1; 1645 + continue; 1646 + fi; 1647 + if [[ $symlinkTarget == /* ]]; then 1648 + nixInfoLog "symlink $path points to absolute target $symlinkTarget"; 1649 + else 1650 + nixInfoLog "symlink $path points to relative target $symlinkTarget"; 1651 + symlinkTarget="$(realpath --no-symlinks --canonicalize-missing "$pathParent/$symlinkTarget")"; 1652 + fi; 1653 + if [[ $symlinkTarget != "$NIX_STORE"/* ]]; then 1654 + nixInfoLog "symlink $path points outside the Nix store; ignoring"; 1655 + continue; 1656 + fi; 1657 + if [[ $path == "$symlinkTarget" ]]; then 1658 + nixErrorLog "the symlink $path is reflexive"; 1659 + numReflexiveSymlinks+=1; 1660 + else 1661 + if [[ ! -e $symlinkTarget ]]; then 1662 + nixErrorLog "the symlink $path points to a missing target: $symlinkTarget"; 1663 + numDanglingSymlinks+=1; 1664 + else 1665 + nixDebugLog "the symlink $path is irreflexive and points to a target which exists"; 1666 + fi; 1667 + fi; 1668 + done < <(find "$output" -type l -print0); 1669 + if ((numDanglingSymlinks > 0 || numReflexiveSymlinks > 0 || numUnreadableSymlinks > 0)); then 1670 + nixErrorLog "found $numDanglingSymlinks dangling symlinks, $numReflexiveSymlinks reflexive symlinks and $numUnreadableSymlinks unreadable symlinks"; 1671 + exit 1; 1672 + fi; 1673 + return 0 1674 + } 1675 + noBrokenSymlinksInAllOutputs () 1676 + { 1677 + 1678 + if [[ -z ${dontCheckForBrokenSymlinks-} ]]; then 1679 + for output in $(getAllOutputNames); 1680 + do 1681 + noBrokenSymlinks "${!output}"; 1682 + done; 1683 + fi 1684 + } 1685 + parallelMap () 1686 + { 1687 + 1688 + function _wrapper () 1689 + { 1690 + while IFS= read -r -d '' job; do 1691 + "$@" "$job"; 1692 + done 1693 + }; 1694 + parallelRun _wrapper "$@"; 1695 + unset -f _wrapper 1696 + } 1697 + parallelRun () 1698 + { 1699 + 1700 + local pids; 1701 + local lock; 1702 + pids=(); 1703 + lock=$(mktemp -u); 1704 + mkfifo "$lock"; 1705 + for ((i=0; i<NIX_BUILD_CORES; i++)) 1706 + do 1707 + { 1708 + exec 3< "$lock"; 1709 + exec 4> "$lock"; 1710 + local job; 1711 + while :; do 1712 + read -r -n1 > /dev/null 0<&3; 1713 + if ! IFS= read -r -d '' job; then 1714 + printf 'x' 1>&4; 1715 + break; 1716 + fi; 1717 + printf 'y' 1>&4; 1718 + printf '%s\0' "$job"; 1719 + done | "$@" 1720 + } & pids[$i]=$!; 1721 + done; 1722 + printf 'a' > "$lock" & for pid in "${pids[@]}"; 1723 + do 1724 + if ! wait "$pid"; then 1725 + echo "A parallel job failed with exit code $? (check for errors above)" 1>&2; 1726 + echo -e "Failing Command:\n $@" 1>&2; 1727 + exit 1; 1728 + fi; 1729 + done; 1730 + rm "$lock" 1731 + } 1732 + patchELF () 1733 + { 1734 + 1735 + local dir="$1"; 1736 + [ -e "$dir" ] || return 0; 1737 + echo "shrinking RPATHs of ELF executables and libraries in $dir"; 1738 + local i; 1739 + while IFS= read -r -d '' i; do 1740 + if [[ "$i" =~ .build-id ]]; then 1741 + continue; 1742 + fi; 1743 + if ! isELF "$i"; then 1744 + continue; 1745 + fi; 1746 + echo "shrinking $i"; 1747 + patchelf --shrink-rpath "$i" || true; 1748 + done < <(find "$dir" -type f -print0) 1749 + } 1750 + patchPhase () 1751 + { 1752 + 1753 + runHook prePatch; 1754 + local -a patchesArray; 1755 + concatTo patchesArray patches; 1756 + for i in "${patchesArray[@]}"; 1757 + do 1758 + echo "applying patch $i"; 1759 + local uncompress=cat; 1760 + case "$i" in 1761 + *.gz) 1762 + uncompress="gzip -d" 1763 + ;; 1764 + *.bz2) 1765 + uncompress="bzip2 -d" 1766 + ;; 1767 + *.xz) 1768 + uncompress="xz -d" 1769 + ;; 1770 + *.lzma) 1771 + uncompress="lzma -d" 1772 + ;; 1773 + esac; 1774 + local -a flagsArray; 1775 + concatTo flagsArray patchFlags=-p1; 1776 + $uncompress < "$i" 2>&1 | patch "${flagsArray[@]}"; 1777 + done; 1778 + runHook postPatch 1779 + } 1780 + patchShebangs () 1781 + { 1782 + 1783 + local pathName; 1784 + local update=false; 1785 + while [[ $# -gt 0 ]]; do 1786 + case "$1" in 1787 + --host) 1788 + pathName=HOST_PATH; 1789 + shift 1790 + ;; 1791 + --build) 1792 + pathName=PATH; 1793 + shift 1794 + ;; 1795 + --update) 1796 + update=true; 1797 + shift 1798 + ;; 1799 + --) 1800 + shift; 1801 + break 1802 + ;; 1803 + -* | --*) 1804 + echo "Unknown option $1 supplied to patchShebangs" 1>&2; 1805 + return 1 1806 + ;; 1807 + *) 1808 + break 1809 + ;; 1810 + esac; 1811 + done; 1812 + echo "patching script interpreter paths in $@"; 1813 + local f; 1814 + local oldPath; 1815 + local newPath; 1816 + local arg0; 1817 + local args; 1818 + local oldInterpreterLine; 1819 + local newInterpreterLine; 1820 + if [[ $# -eq 0 ]]; then 1821 + echo "No arguments supplied to patchShebangs" 1>&2; 1822 + return 0; 1823 + fi; 1824 + local f; 1825 + while IFS= read -r -d '' f; do 1826 + isScript "$f" || continue; 1827 + read -r oldInterpreterLine < "$f" || [ "$oldInterpreterLine" ]; 1828 + read -r oldPath arg0 args <<< "${oldInterpreterLine:2}"; 1829 + if [[ -z "${pathName:-}" ]]; then 1830 + if [[ -n $strictDeps && $f == "$NIX_STORE"* ]]; then 1831 + pathName=HOST_PATH; 1832 + else 1833 + pathName=PATH; 1834 + fi; 1835 + fi; 1836 + if [[ "$oldPath" == *"/bin/env" ]]; then 1837 + if [[ $arg0 == "-S" ]]; then 1838 + arg0=${args%% *}; 1839 + [[ "$args" == *" "* ]] && args=${args#* } || args=; 1840 + newPath="$(PATH="${!pathName}" type -P "env" || true)"; 1841 + args="-S $(PATH="${!pathName}" type -P "$arg0" || true) $args"; 1842 + else 1843 + if [[ $arg0 == "-"* || $arg0 == *"="* ]]; then 1844 + echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" 1>&2; 1845 + exit 1; 1846 + else 1847 + newPath="$(PATH="${!pathName}" type -P "$arg0" || true)"; 1848 + fi; 1849 + fi; 1850 + else 1851 + if [[ -z $oldPath ]]; then 1852 + oldPath="/bin/sh"; 1853 + fi; 1854 + newPath="$(PATH="${!pathName}" type -P "$(basename "$oldPath")" || true)"; 1855 + args="$arg0 $args"; 1856 + fi; 1857 + newInterpreterLine="$newPath $args"; 1858 + newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}; 1859 + if [[ -n "$oldPath" && ( "$update" == true || "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ) ]]; then 1860 + if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then 1861 + echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; 1862 + escapedInterpreterLine=${newInterpreterLine//\\/\\\\}; 1863 + timestamp=$(stat --printf "%y" "$f"); 1864 + sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"; 1865 + touch --date "$timestamp" "$f"; 1866 + fi; 1867 + fi; 1868 + done < <(find "$@" -type f -perm -0100 -print0) 1869 + } 1870 + patchShebangsAuto () 1871 + { 1872 + 1873 + if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; then 1874 + if [[ "$output" != out && "$output" = "$outputDev" ]]; then 1875 + patchShebangs --build "$prefix"; 1876 + else 1877 + patchShebangs --host "$prefix"; 1878 + fi; 1879 + fi 1880 + } 1881 + pkgConfigWrapper_addPkgConfigPath () 1882 + { 1883 + 1884 + local role_post; 1885 + getHostRoleEnvHook; 1886 + addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig"; 1887 + addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig" 1888 + } 1889 + prependToVar () 1890 + { 1891 + 1892 + local -n nameref="$1"; 1893 + local useArray type; 1894 + if [ -n "$__structuredAttrs" ]; then 1895 + useArray=true; 1896 + else 1897 + useArray=false; 1898 + fi; 1899 + if type=$(declare -p "$1" 2> /dev/null); then 1900 + case "${type#* }" in 1901 + -A*) 1902 + echo "prependToVar(): ERROR: trying to use prependToVar on an associative array." 1>&2; 1903 + return 1 1904 + ;; 1905 + -a*) 1906 + useArray=true 1907 + ;; 1908 + *) 1909 + useArray=false 1910 + ;; 1911 + esac; 1912 + fi; 1913 + shift; 1914 + if $useArray; then 1915 + nameref=("$@" ${nameref+"${nameref[@]}"}); 1916 + else 1917 + nameref="$* ${nameref-}"; 1918 + fi 1919 + } 1920 + printLines () 1921 + { 1922 + 1923 + (( "$#" > 0 )) || return 0; 1924 + printf '%s\n' "$@" 1925 + } 1926 + printWords () 1927 + { 1928 + 1929 + (( "$#" > 0 )) || return 0; 1930 + printf '%s ' "$@" 1931 + } 1932 + recordPropagatedDependencies () 1933 + { 1934 + 1935 + declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); 1936 + declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); 1937 + local propagatedInputsIndex; 1938 + for propagatedInputsIndex in "${!flatVars[@]}"; 1939 + do 1940 + local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; 1941 + local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; 1942 + [[ -n "${!propagatedInputsSlice}" ]] || continue; 1943 + mkdir -p "${!outputDev}/nix-support"; 1944 + printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; 1945 + done 1946 + } 1947 + runHook () 1948 + { 1949 + 1950 + local hookName="$1"; 1951 + shift; 1952 + local hooksSlice="${hookName%Hook}Hooks[@]"; 1953 + local hook; 1954 + for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; 1955 + do 1956 + _logHook "$hookName" "$hook" "$@"; 1957 + _eval "$hook" "$@"; 1958 + done; 1959 + return 0 1960 + } 1961 + runOneHook () 1962 + { 1963 + 1964 + local hookName="$1"; 1965 + shift; 1966 + local hooksSlice="${hookName%Hook}Hooks[@]"; 1967 + local hook ret=1; 1968 + for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; 1969 + do 1970 + _logHook "$hookName" "$hook" "$@"; 1971 + if _eval "$hook" "$@"; then 1972 + ret=0; 1973 + break; 1974 + fi; 1975 + done; 1976 + return "$ret" 1977 + } 1978 + runPhase () 1979 + { 1980 + 1981 + local curPhase="$*"; 1982 + if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then 1983 + return; 1984 + fi; 1985 + if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then 1986 + return; 1987 + fi; 1988 + if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then 1989 + return; 1990 + fi; 1991 + if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then 1992 + return; 1993 + fi; 1994 + if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then 1995 + return; 1996 + fi; 1997 + if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then 1998 + return; 1999 + fi; 2000 + if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then 2001 + return; 2002 + fi; 2003 + if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then 2004 + return; 2005 + fi; 2006 + if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then 2007 + return; 2008 + fi; 2009 + showPhaseHeader "$curPhase"; 2010 + dumpVars; 2011 + local startTime endTime; 2012 + startTime=$(date +"%s"); 2013 + eval "${!curPhase:-$curPhase}"; 2014 + endTime=$(date +"%s"); 2015 + showPhaseFooter "$curPhase" "$startTime" "$endTime"; 2016 + if [ "$curPhase" = unpackPhase ]; then 2017 + [ -n "${sourceRoot:-}" ] && chmod +x -- "${sourceRoot}"; 2018 + cd -- "${sourceRoot:-.}"; 2019 + fi 2020 + } 2021 + showPhaseFooter () 2022 + { 2023 + 2024 + local phase="$1"; 2025 + local startTime="$2"; 2026 + local endTime="$3"; 2027 + local delta=$(( endTime - startTime )); 2028 + (( delta < 30 )) && return; 2029 + local H=$((delta/3600)); 2030 + local M=$((delta%3600/60)); 2031 + local S=$((delta%60)); 2032 + echo -n "$phase completed in "; 2033 + (( H > 0 )) && echo -n "$H hours "; 2034 + (( M > 0 )) && echo -n "$M minutes "; 2035 + echo "$S seconds" 2036 + } 2037 + showPhaseHeader () 2038 + { 2039 + 2040 + local phase="$1"; 2041 + echo "Running phase: $phase"; 2042 + if [[ -z ${NIX_LOG_FD-} ]]; then 2043 + return; 2044 + fi; 2045 + printf "@nix { \"action\": \"setPhase\", \"phase\": \"%s\" }\n" "$phase" >&"$NIX_LOG_FD" 2046 + } 2047 + stripDirs () 2048 + { 2049 + 2050 + local cmd="$1"; 2051 + local ranlibCmd="$2"; 2052 + local paths="$3"; 2053 + local stripFlags="$4"; 2054 + local excludeFlags=(); 2055 + local pathsNew=; 2056 + [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1; 2057 + [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1; 2058 + local pattern; 2059 + if [ -n "${stripExclude:-}" ]; then 2060 + for pattern in "${stripExclude[@]}"; 2061 + do 2062 + excludeFlags+=(-a '!' '(' -name "$pattern" -o -wholename "$prefix/$pattern" ')'); 2063 + done; 2064 + fi; 2065 + local p; 2066 + for p in ${paths}; 2067 + do 2068 + if [ -e "$prefix/$p" ]; then 2069 + pathsNew="${pathsNew} $prefix/$p"; 2070 + fi; 2071 + done; 2072 + paths=${pathsNew}; 2073 + if [ -n "${paths}" ]; then 2074 + echo "stripping (with command $cmd and flags $stripFlags) in $paths"; 2075 + local striperr; 2076 + striperr="$(mktemp --tmpdir="$TMPDIR" 'striperr.XXXXXX')"; 2077 + find $paths -type f "${excludeFlags[@]}" -a '!' -path "$prefix/lib/debug/*" -printf '%D-%i,%p\0' | sort -t, -k1,1 -u -z | cut -d, -f2- -z | xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2> "$striperr" || exit_code=$?; 2078 + [[ "$exit_code" = 123 || -z "$exit_code" ]] || ( cat "$striperr" 1>&2 && exit 1 ); 2079 + rm "$striperr"; 2080 + find $paths -name '*.a' -type f -exec $ranlibCmd '{}' \; 2> /dev/null; 2081 + fi 2082 + } 2083 + stripHash () 2084 + { 2085 + 2086 + local strippedName casematchOpt=0; 2087 + strippedName="$(basename -- "$1")"; 2088 + shopt -q nocasematch && casematchOpt=1; 2089 + shopt -u nocasematch; 2090 + if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then 2091 + echo "${strippedName:33}"; 2092 + else 2093 + echo "$strippedName"; 2094 + fi; 2095 + if (( casematchOpt )); then 2096 + shopt -s nocasematch; 2097 + fi 2098 + } 2099 + substitute () 2100 + { 2101 + 2102 + local input="$1"; 2103 + local output="$2"; 2104 + shift 2; 2105 + if [ ! -f "$input" ]; then 2106 + echo "substitute(): ERROR: file '$input' does not exist" 1>&2; 2107 + return 1; 2108 + fi; 2109 + local content; 2110 + consumeEntire content < "$input"; 2111 + if [ -e "$output" ]; then 2112 + chmod +w "$output"; 2113 + fi; 2114 + substituteStream content "file '$input'" "$@" > "$output" 2115 + } 2116 + substituteAll () 2117 + { 2118 + 2119 + local input="$1"; 2120 + local output="$2"; 2121 + local -a args=(); 2122 + _allFlags; 2123 + substitute "$input" "$output" "${args[@]}" 2124 + } 2125 + substituteAllInPlace () 2126 + { 2127 + 2128 + local fileName="$1"; 2129 + shift; 2130 + substituteAll "$fileName" "$fileName" "$@" 2131 + } 2132 + substituteAllStream () 2133 + { 2134 + 2135 + local -a args=(); 2136 + _allFlags; 2137 + substituteStream "$1" "$2" "${args[@]}" 2138 + } 2139 + substituteInPlace () 2140 + { 2141 + 2142 + local -a fileNames=(); 2143 + for arg in "$@"; 2144 + do 2145 + if [[ "$arg" = "--"* ]]; then 2146 + break; 2147 + fi; 2148 + fileNames+=("$arg"); 2149 + shift; 2150 + done; 2151 + if ! [[ "${#fileNames[@]}" -gt 0 ]]; then 2152 + echo "substituteInPlace called without any files to operate on (files must come before options!)" 1>&2; 2153 + return 1; 2154 + fi; 2155 + for file in "${fileNames[@]}"; 2156 + do 2157 + substitute "$file" "$file" "$@"; 2158 + done 2159 + } 2160 + substituteStream () 2161 + { 2162 + 2163 + local var=$1; 2164 + local description=$2; 2165 + shift 2; 2166 + while (( "$#" )); do 2167 + local replace_mode="$1"; 2168 + case "$1" in 2169 + --replace) 2170 + if ! "$_substituteStream_has_warned_replace_deprecation"; then 2171 + echo "substituteStream() in derivation $name: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. ($description)" 1>&2; 2172 + _substituteStream_has_warned_replace_deprecation=true; 2173 + fi; 2174 + replace_mode='--replace-warn' 2175 + ;& 2176 + --replace-quiet | --replace-warn | --replace-fail) 2177 + pattern="$2"; 2178 + replacement="$3"; 2179 + shift 3; 2180 + if ! [[ "${!var}" == *"$pattern"* ]]; then 2181 + if [ "$replace_mode" == --replace-warn ]; then 2182 + printf "substituteStream() in derivation $name: WARNING: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; 2183 + else 2184 + if [ "$replace_mode" == --replace-fail ]; then 2185 + printf "substituteStream() in derivation $name: ERROR: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; 2186 + return 1; 2187 + fi; 2188 + fi; 2189 + fi; 2190 + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' 2191 + ;; 2192 + --subst-var) 2193 + local varName="$2"; 2194 + shift 2; 2195 + if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then 2196 + echo "substituteStream() in derivation $name: ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; 2197 + return 1; 2198 + fi; 2199 + if [ -z ${!varName+x} ]; then 2200 + echo "substituteStream() in derivation $name: ERROR: variable \$$varName is unset" 1>&2; 2201 + return 1; 2202 + fi; 2203 + pattern="@$varName@"; 2204 + replacement="${!varName}"; 2205 + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' 2206 + ;; 2207 + --subst-var-by) 2208 + pattern="@$2@"; 2209 + replacement="$3"; 2210 + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; 2211 + shift 3 2212 + ;; 2213 + *) 2214 + echo "substituteStream() in derivation $name: ERROR: Invalid command line argument: $1" 1>&2; 2215 + return 1 2216 + ;; 2217 + esac; 2218 + done; 2219 + printf "%s" "${!var}" 2220 + } 2221 + unpackFile () 2222 + { 2223 + 2224 + curSrc="$1"; 2225 + echo "unpacking source archive $curSrc"; 2226 + if ! runOneHook unpackCmd "$curSrc"; then 2227 + echo "do not know how to unpack source archive $curSrc"; 2228 + exit 1; 2229 + fi 2230 + } 2231 + unpackPhase () 2232 + { 2233 + 2234 + runHook preUnpack; 2235 + if [ -z "${srcs:-}" ]; then 2236 + if [ -z "${src:-}" ]; then 2237 + echo 'variable $src or $srcs should point to the source'; 2238 + exit 1; 2239 + fi; 2240 + srcs="$src"; 2241 + fi; 2242 + local -a srcsArray; 2243 + concatTo srcsArray srcs; 2244 + local dirsBefore=""; 2245 + for i in *; 2246 + do 2247 + if [ -d "$i" ]; then 2248 + dirsBefore="$dirsBefore $i "; 2249 + fi; 2250 + done; 2251 + for i in "${srcsArray[@]}"; 2252 + do 2253 + unpackFile "$i"; 2254 + done; 2255 + : "${sourceRoot=}"; 2256 + if [ -n "${setSourceRoot:-}" ]; then 2257 + runOneHook setSourceRoot; 2258 + else 2259 + if [ -z "$sourceRoot" ]; then 2260 + for i in *; 2261 + do 2262 + if [ -d "$i" ]; then 2263 + case $dirsBefore in 2264 + *\ $i\ *) 2265 + 2266 + ;; 2267 + *) 2268 + if [ -n "$sourceRoot" ]; then 2269 + echo "unpacker produced multiple directories"; 2270 + exit 1; 2271 + fi; 2272 + sourceRoot="$i" 2273 + ;; 2274 + esac; 2275 + fi; 2276 + done; 2277 + fi; 2278 + fi; 2279 + if [ -z "$sourceRoot" ]; then 2280 + echo "unpacker appears to have produced no directories"; 2281 + exit 1; 2282 + fi; 2283 + echo "source root is $sourceRoot"; 2284 + if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then 2285 + chmod -R u+w -- "$sourceRoot"; 2286 + fi; 2287 + runHook postUnpack 2288 + } 2289 + updateAutotoolsGnuConfigScriptsPhase () 2290 + { 2291 + 2292 + if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then 2293 + return; 2294 + fi; 2295 + for script in config.sub config.guess; 2296 + do 2297 + for f in $(find . -type f -name "$script"); 2298 + do 2299 + echo "Updating Autotools / GNU config script to a newer upstream version: $f"; 2300 + cp -f "/nix/store/s3dj57ywp7j6az9xbc3yssjlwnlw335q-gnu-config-2024-01-01/$script" "$f"; 2301 + done; 2302 + done 2303 + } 2304 + updateSourceDateEpoch () 2305 + { 2306 + 2307 + local path="$1"; 2308 + [[ $path == -* ]] && path="./$path"; 2309 + local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ "%p"\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1)); 2310 + local time="${res[0]//\.[0-9]*/}"; 2311 + local newestFile="${res[1]}"; 2312 + if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then 2313 + echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; 2314 + export SOURCE_DATE_EPOCH="$time"; 2315 + local now="$(date +%s)"; 2316 + if [ "$time" -gt $((now - 60)) ]; then 2317 + echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; 2318 + fi; 2319 + fi 2320 + } 2321 + PATH="$PATH${nix_saved_PATH:+:$nix_saved_PATH}" 2322 + XDG_DATA_DIRS="$XDG_DATA_DIRS${nix_saved_XDG_DATA_DIRS:+:$nix_saved_XDG_DATA_DIRS}" 2323 + export NIX_BUILD_TOP="$(mktemp -d -t nix-shell.XXXXXX)" 2324 + export TMP="$NIX_BUILD_TOP" 2325 + export TMPDIR="$NIX_BUILD_TOP" 2326 + export TEMP="$NIX_BUILD_TOP" 2327 + export TEMPDIR="$NIX_BUILD_TOP" 2328 + eval "${shellHook:-}"
+8 -1
flake.nix
··· 15 15 default = pkgs.callPackage ./nix/package.nix {}; 16 16 }); 17 17 devShells = forAllSystems (system: pkgs: { 18 - default = self.packages.${system}.default; 18 + default = self.packages.${system}.default.overrideAttrs (prev: { 19 + nativeBuildInputs = with pkgs; [ 20 + # Additional rust tooling 21 + clippy 22 + rustfmt 23 + rust-analyzer 24 + ] ++ (prev.nativeBuildInputs or [ ]); 25 + }); 19 26 }); 20 27 }; 21 28 }