diff options
Diffstat (limited to 'nixpkgs/pkgs/build-support')
39 files changed, 625 insertions, 354 deletions
diff --git a/nixpkgs/pkgs/build-support/appimage/default.nix b/nixpkgs/pkgs/build-support/appimage/default.nix index 0637964ca62f..7b9bb239402b 100644 --- a/nixpkgs/pkgs/build-support/appimage/default.nix +++ b/nixpkgs/pkgs/build-support/appimage/default.nix @@ -26,10 +26,11 @@ rec { ]; }; - extract = args@{ name ? "${args.pname}-${args.version}", src, ... }: pkgs.runCommand "${name}-extracted" { + extract = args@{ name ? "${args.pname}-${args.version}", postExtract ? "", src, ... }: pkgs.runCommand "${name}-extracted" { buildInputs = [ appimage-exec ]; } '' appimage-exec.sh -x $out ${src} + ${postExtract} ''; # for compatibility, deprecated @@ -206,6 +207,7 @@ rec { libtool.lib # for Synfigstudio xorg.libxshmfence # for apple-music-electron at-spi2-core + pciutils # for FreeCAD ]; }; } diff --git a/nixpkgs/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix b/nixpkgs/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix index 2c0c4a3d513a..a6802f4ab544 100644 --- a/nixpkgs/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix +++ b/nixpkgs/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix @@ -52,7 +52,7 @@ let # these match the host's architecture, glibc_multi is used for multilib # builds. glibcLocales must be before glibc or glibc_multi as otherwiese # the wrong LOCALE_ARCHIVE will be used where only C.UTF-8 is available. - basePkgs = with pkgs; [ + baseTargetPaths = with pkgs; [ glibcLocales (if isMultiBuild then glibc_multi else glibc) (toString gcc.cc.lib) @@ -71,7 +71,7 @@ let bzip2 xz ]; - baseMultiPkgs = with pkgsi686Linux; [ + baseMultiPaths = with pkgsi686Linux; [ (toString gcc.cc.lib) ]; @@ -132,7 +132,7 @@ let staticUsrProfileTarget = buildEnv { name = "${name}-usr-target"; # ldconfig wrapper must come first so it overrides the original ldconfig - paths = [ etcPkg ldconfig ] ++ basePkgs ++ targetPaths; + paths = [ etcPkg ldconfig ] ++ baseTargetPaths ++ targetPaths; extraOutputsToInstall = [ "out" "lib" "bin" ] ++ extraOutputsToInstall; ignoreCollisions = true; postBuild = '' @@ -168,7 +168,7 @@ let staticUsrProfileMulti = buildEnv { name = "${name}-usr-multi"; - paths = baseMultiPkgs ++ multiPaths; + paths = baseMultiPaths ++ multiPaths; extraOutputsToInstall = [ "out" "lib" ] ++ extraOutputsToInstall; ignoreCollisions = true; }; @@ -251,7 +251,7 @@ let in runCommandLocal "${name}-fhs" { passthru = { - inherit args multiPaths targetPaths ldconfig; + inherit args baseTargetPaths targetPaths baseMultiPaths multiPaths ldconfig; }; } '' mkdir -p $out diff --git a/nixpkgs/pkgs/build-support/build-fhsenv-bubblewrap/default.nix b/nixpkgs/pkgs/build-support/build-fhsenv-bubblewrap/default.nix index 5e8894d7cb33..3500e5e9216f 100644 --- a/nixpkgs/pkgs/build-support/build-fhsenv-bubblewrap/default.nix +++ b/nixpkgs/pkgs/build-support/build-fhsenv-bubblewrap/default.nix @@ -31,7 +31,7 @@ assert (pname != null || version != null) -> (name == null && pname != null); # with builtins; let - pname = if args.name != null then args.name else args.pname; + pname = if args ? name && args.name != null then args.name else args.pname; versionStr = lib.optionalString (version != null) ("-" + version); name = pname + versionStr; @@ -223,6 +223,7 @@ let bin = writeShellScript "${name}-bwrap" (bwrapCmd { initArgs = ''"$@"''; }); in runCommandLocal name { + inherit pname version; inherit meta; passthru = passthru // { diff --git a/nixpkgs/pkgs/build-support/build-graalvm-native-image/default.nix b/nixpkgs/pkgs/build-support/build-graalvm-native-image/default.nix index c3c4a7b1e57b..e25a71405089 100644 --- a/nixpkgs/pkgs/build-support/build-graalvm-native-image/default.nix +++ b/nixpkgs/pkgs/build-support/build-graalvm-native-image/default.nix @@ -13,6 +13,7 @@ , nativeImageBuildArgs ? [ (lib.optionalString stdenv.isDarwin "-H:-CheckToolchain") "-H:Name=${executable}" + "-march=compatibility" "--verbose" ] # Extra arguments to be passed to the native-image @@ -71,7 +72,5 @@ stdenv.mkDerivation ({ platforms = graalvmDrv.meta.platforms; # default to executable name mainProgram = executable; - # need to have native-image-installable-svm available - broken = !(builtins.any (p: (p.product or "") == "native-image-installable-svm") graalvmDrv.products); } // meta; } // extraArgs) diff --git a/nixpkgs/pkgs/build-support/docker/default.nix b/nixpkgs/pkgs/build-support/docker/default.nix index 1ac0a69f7451..70fd3635b745 100644 --- a/nixpkgs/pkgs/build-support/docker/default.nix +++ b/nixpkgs/pkgs/build-support/docker/default.nix @@ -446,7 +446,7 @@ rec { ''; postMount = '' - mkdir -p mnt/{dev,proc,sys} mnt${storeDir} + mkdir -p mnt/{dev,proc,sys,tmp} mnt${storeDir} # Mount /dev, /sys and the nix store as shared folders. mount --rbind /dev mnt/dev diff --git a/nixpkgs/pkgs/build-support/emacs/wrapper.nix b/nixpkgs/pkgs/build-support/emacs/wrapper.nix index 6f46bb692a43..6c1383c53304 100644 --- a/nixpkgs/pkgs/build-support/emacs/wrapper.nix +++ b/nixpkgs/pkgs/build-support/emacs/wrapper.nix @@ -32,7 +32,7 @@ in customEmacsPackages.withPackages (epkgs: [ epkgs.evil epkgs.magit ]) */ -{ lib, lndir, makeWrapper, runCommand, gcc }: +{ lib, lndir, makeBinaryWrapper, runCommand, gcc }: self: let inherit (self) emacs; @@ -50,7 +50,7 @@ runCommand (lib.appendToName "with-packages" emacs).name { inherit emacs explicitRequires; - nativeBuildInputs = [ emacs lndir makeWrapper ]; + nativeBuildInputs = [ emacs lndir makeBinaryWrapper ]; preferLocalBuild = true; allowSubstitutes = false; @@ -201,6 +201,11 @@ runCommand --subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp" \ --subst-var prog chmod +x $out/bin/$progname + # Create a “NOP” binary wrapper for the pure sake of it becoming a + # non-shebang, actual binary. See the makeBinaryWrapper docs for rationale + # (summary: it allows you to use emacs as a shebang itself on Darwin, + # e.g. #!$ {emacs}/bin/emacs --script) + wrapProgramBinary $out/bin/$progname done # Wrap MacOS app @@ -220,6 +225,7 @@ runCommand --subst-var-by wrapperSiteLispNative "$deps/share/emacs/native-lisp" \ --subst-var-by prog "$emacs/Applications/Emacs.app/Contents/MacOS/Emacs" chmod +x $out/Applications/Emacs.app/Contents/MacOS/Emacs + wrapProgramBinary $out/Applications/Emacs.app/Contents/MacOS/Emacs fi mkdir -p $out/share diff --git a/nixpkgs/pkgs/build-support/fetchbittorrent/default.nix b/nixpkgs/pkgs/build-support/fetchbittorrent/default.nix new file mode 100644 index 000000000000..916c7e7d8c94 --- /dev/null +++ b/nixpkgs/pkgs/build-support/fetchbittorrent/default.nix @@ -0,0 +1,60 @@ +{ lib, runCommand, transmission_noSystemd, rqbit, writeShellScript, formats, cacert, rsync }: +let + urlRegexp = ''.*xt=urn:bt[im]h:([^&]{64}|[^&]{40}).*''; +in +{ url +, name ? + if (builtins.match urlRegexp url) == null then + "bittorrent" + else + "bittorrent-" + builtins.head (builtins.match urlRegexp url) +, config ? if (backend == "transmission") then { } else throw "json config for configuring fetchFromBitorrent only works with the transmission backend" +, hash +, backend ? "transmission" +, recursiveHash ? true +, postFetch ? "" +, postUnpack ? "" +}: +let + afterSuccess = writeShellScript "fetch-bittorrent-done.sh" '' + ${postUnpack} + # Flatten the directory, so that only the torrent contents are in $out, not + # the folder name + shopt -s dotglob + mv -v $downloadedDirectory/*/* $out + rm -v -rf $downloadedDirectory + unset downloadedDirectory + ${postFetch} + kill $PPID + ''; + jsonConfig = (formats.json {}).generate "jsonConfig" config; +in +runCommand name { + nativeBuildInputs = [ cacert ] ++ (if (backend == "transmission" ) then [ transmission_noSystemd ] else if (backend == "rqbit") then [ rqbit ] else throw "rqbit or transmission are the only available backends for fetchbittorrent"); + outputHashAlgo = if hash != "" then null else "sha256"; + outputHash = hash; + outputHashMode = if recursiveHash then "recursive" else "flat"; + + # url will be written to the derivation, meaning it can be parsed and utilized + # by external tools, such as tools that may want to seed fetchBittorrent calls + # in nixpkgs + inherit url; +} +(if (backend == "transmission") then '' + export HOME=$TMP + export downloadedDirectory=$out/downloadedDirectory + mkdir -p $downloadedDirectory + mkdir -p $HOME/.config/transmission + cp ${jsonConfig} $HOME/.config/transmission/settings.json + function handleChild { + # This detects failures and logs the contents of the transmission fetch + find $out + exit 0 + } + trap handleChild CHLD + transmission-cli --port $(shuf -n 1 -i 49152-65535) --portmap --finish ${afterSuccess} --download-dir $downloadedDirectory --config-dir "$HOME"/.config/transmission "$url" +'' else +'' + export HOME=$TMP + rqbit --disable-dht-persistence --http-api-listen-addr "127.0.0.1:$(shuf -n 1 -i 49152-65535)" download -o $out --exit-on-finish "$url" +'') diff --git a/nixpkgs/pkgs/build-support/fetchbittorrent/tests.nix b/nixpkgs/pkgs/build-support/fetchbittorrent/tests.nix new file mode 100644 index 000000000000..fce1b3933a72 --- /dev/null +++ b/nixpkgs/pkgs/build-support/fetchbittorrent/tests.nix @@ -0,0 +1,25 @@ +{ testers, fetchFromBittorrent, ... }: + +{ + http-link = testers.invalidateFetcherByDrvHash fetchFromBittorrent { + url = "https://webtorrent.io/torrents/wired-cd.torrent"; + hash = "sha256-OCsC22WuanqoN6lPv5wDT5ZxPcEHDpZ1EgXGvz1SDYo="; + backend = "transmission"; + }; + magnet-link = testers.invalidateFetcherByDrvHash fetchFromBittorrent { + url = "magnet:?xt=urn:btih:a88fda5954e89178c372716a6a78b8180ed4dad3&dn=The+WIRED+CD+-+Rip.+Sample.+Mash.+Share&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fwired-cd.torrent"; + hash = "sha256-OCsC22WuanqoN6lPv5wDT5ZxPcEHDpZ1EgXGvz1SDYo="; + backend = "transmission"; + }; + http-link-rqbit = testers.invalidateFetcherByDrvHash fetchFromBittorrent { + url = "https://webtorrent.io/torrents/wired-cd.torrent"; + hash = "sha256-OCsC22WuanqoN6lPv5wDT5ZxPcEHDpZ1EgXGvz1SDYo="; + backend = "rqbit"; + }; + magnet-link-rqbit = testers.invalidateFetcherByDrvHash fetchFromBittorrent { + url = "magnet:?xt=urn:btih:a88fda5954e89178c372716a6a78b8180ed4dad3&dn=The+WIRED+CD+-+Rip.+Sample.+Mash.+Share&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fwired-cd.torrent"; + hash = "sha256-OCsC22WuanqoN6lPv5wDT5ZxPcEHDpZ1EgXGvz1SDYo="; + backend = "rqbit"; + }; +} + diff --git a/nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git b/nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git index 2a53fd94e7f2..feb6c9e30535 100755 --- a/nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git @@ -257,9 +257,15 @@ make_deterministic_repo(){ cd "$repo" # Remove files that contain timestamps or otherwise have non-deterministic # properties. - rm -rf .git/logs/ .git/hooks/ .git/index .git/FETCH_HEAD .git/ORIG_HEAD \ - .git/refs/remotes/origin/HEAD .git/config - + if [ -f .git ]; then + local dotgit_content=$(<.git) + local dotgit_dir="${dotgit_content#gitdir: }" + else + local dotgit_dir=".git" + fi + pushd "$dotgit_dir" + rm -rf logs/ hooks/ index FETCH_HEAD ORIG_HEAD refs/remotes/origin/HEAD config + popd # Remove all remote branches. git branch -r | while read -r branch; do clean_git branch -rD "$branch" @@ -277,7 +283,7 @@ make_deterministic_repo(){ # Do a full repack. Must run single-threaded, or else we lose determinism. clean_git config pack.threads 1 clean_git repack -A -d -f - rm -f .git/config + rm -f "$dotgit_dir/config" # Garbage collect unreferenced objects. # Note: --keep-largest-pack prevents non-deterministic ordering of packs @@ -293,9 +299,6 @@ clone_user_rev() { local rev="${3:-HEAD}" if [ -n "$fetchLFS" ]; then - tmpHomePath="$(mktemp -d "${TMPDIR:-/tmp}/nix-prefetch-git-tmp-home-XXXXXXXXXX")" - exit_handlers+=(remove_tmpHomePath) - HOME="$tmpHomePath" clean_git lfs install fi @@ -326,7 +329,7 @@ clone_user_rev() { find "$dir" -name .git -print0 | xargs -0 rm -rf else find "$dir" -name .git | while read -r gitdir; do - make_deterministic_repo "$(readlink -f "$gitdir/..")" + make_deterministic_repo "$(readlink -f "$(dirname "$gitdir")")" done fi } @@ -417,6 +420,13 @@ if test -z "$branchName"; then branchName=fetchgit fi +tmpHomePath="$(mktemp -d "${TMPDIR:-/tmp}/nix-prefetch-git-tmp-home-XXXXXXXXXX")" +exit_handlers+=(remove_tmpHomePath) +HOME="$tmpHomePath" +ln -s "$NIX_BUILD_TOP/.netrc" "$HOME/" +unset XDG_CONFIG_HOME +export GIT_CONFIG_NOSYSTEM=1 + if test -n "$builder"; then test -n "$out" -a -n "$url" -a -n "$rev" || usage mkdir -p "$out" diff --git a/nixpkgs/pkgs/build-support/kernel/make-initrd-ng.nix b/nixpkgs/pkgs/build-support/kernel/make-initrd-ng.nix index 2418838176ef..f2f7aaa6d1b6 100644 --- a/nixpkgs/pkgs/build-support/kernel/make-initrd-ng.nix +++ b/nixpkgs/pkgs/build-support/kernel/make-initrd-ng.nix @@ -54,7 +54,7 @@ in # guess may not align with u-boot's nomenclature correctly, so it can # be overridden. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list. -, uInitrdArch ? stdenvNoCC.hostPlatform.linuxArch +, uInitrdArch ? stdenvNoCC.hostPlatform.ubootArch # The name of the compression, as recognised by u-boot. # See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list. diff --git a/nixpkgs/pkgs/build-support/kernel/make-initrd-ng/Cargo.lock b/nixpkgs/pkgs/build-support/kernel/make-initrd-ng/Cargo.lock index 78ae4a01da6f..8965b8793cca 100644 --- a/nixpkgs/pkgs/build-support/kernel/make-initrd-ng/Cargo.lock +++ b/nixpkgs/pkgs/build-support/kernel/make-initrd-ng/Cargo.lock @@ -3,12 +3,6 @@ version = 3 [[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] name = "eyre" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -20,9 +14,9 @@ dependencies = [ [[package]] name = "goblin" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91766b1121940d622933a13e20665857648681816089c9bc2075c4b75a6e4f6b" +checksum = "a7666983ed0dd8d21a6f6576ee00053ca0926fb281a5522577a4dbd0f1b54143" dependencies = [ "log", "plain", @@ -37,12 +31,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "make-initrd-ng" @@ -54,9 +45,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "plain" @@ -66,18 +57,18 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "proc-macro2" -version = "1.0.42" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.20" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -93,9 +84,9 @@ dependencies = [ [[package]] name = "scroll_derive" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdbda6ac5cd1321e724fa9cee216f3a61885889b896f073b8f82322789c5250e" +checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", @@ -104,9 +95,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.98" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -115,6 +106,6 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.2" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" diff --git a/nixpkgs/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh b/nixpkgs/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh index 64ddcbd567fc..79e2c4b26860 100644 --- a/nixpkgs/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh +++ b/nixpkgs/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh @@ -16,9 +16,19 @@ npmInstallHook() { cp "${npmWorkspace-.}/$file" "$dest" done < <(@jq@ --raw-output '.[0].files | map(.path) | join("\n")' <<< "$(npm pack --json --dry-run ${npmWorkspace+--workspace=$npmWorkspace} $npmPackFlags "${npmPackFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}")") + # Based on code from Python's buildPythonPackage wrap.sh script, for + # supporting both the case when makeWrapperArgs is an array and a + # IFS-separated string. + # + # TODO: remove the string branch when __structuredAttrs are used. + if [[ "${makeWrapperArgs+defined}" == "defined" && "$(declare -p makeWrapperArgs)" =~ ^'declare -a makeWrapperArgs=' ]]; then + local -a user_args=("${makeWrapperArgs[@]}") + else + local -a user_args="(${makeWrapperArgs:-})" + fi while IFS=" " read -ra bin; do mkdir -p "$out/bin" - makeWrapper @hostNode@ "$out/bin/${bin[0]}" --add-flags "$packageOut/${bin[1]}" + makeWrapper @hostNode@ "$out/bin/${bin[0]}" --add-flags "$packageOut/${bin[1]}" "${user_args[@]}" done < <(@jq@ --raw-output '(.bin | type) as $typ | if $typ == "string" then .name + " " + .bin elif $typ == "object" then .bin | to_entries | map(.key + " " + .value) | join("\n") @@ -34,7 +44,16 @@ npmInstallHook() { if [ ! -d "$nodeModulesPath" ]; then if [ -z "${dontNpmPrune-}" ]; then - npm prune --omit=dev --no-save ${npmWorkspace+--workspace=$npmWorkspace} $npmPruneFlags "${npmPruneFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}" + if ! npm prune --omit=dev --no-save ${npmWorkspace+--workspace=$npmWorkspace} $npmPruneFlags "${npmPruneFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"; then + echo + echo + echo "ERROR: npm prune step failed" + echo + echo 'If npm tried to download additional dependencies above, try setting `dontNpmPrune = true`.' + echo + + exit 1 + fi fi find node_modules -maxdepth 1 -type d -empty -delete diff --git a/nixpkgs/pkgs/build-support/node/fetch-npm-deps/Cargo.lock b/nixpkgs/pkgs/build-support/node/fetch-npm-deps/Cargo.lock index 482eb6c7beab..4f6e177fd9ae 100644 --- a/nixpkgs/pkgs/build-support/node/fetch-npm-deps/Cargo.lock +++ b/nixpkgs/pkgs/build-support/node/fetch-npm-deps/Cargo.lock @@ -4,24 +4,24 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "async-channel" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", "event-listener", @@ -47,9 +47,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bitflags" @@ -59,9 +59,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "block-buffer" @@ -74,9 +74,9 @@ dependencies = [ [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "castaway" @@ -86,9 +86,12 @@ checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -98,33 +101,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "concurrent-queue" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" dependencies = [ "crossbeam-utils", ] [[package]] name = "cpufeatures" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] [[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] name = "crossbeam-deque" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -184,9 +177,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.63+curl-8.1.2" +version = "0.4.67+curl-8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb0fef7046022a1e2ad67a004978f0e3cacb9e3123dc62ce768f92197b771dc" +checksum = "3cc35d066510b197a0f72de863736641539957628c8a42e70e27c66849e77c34" dependencies = [ "cc", "libc", @@ -194,7 +187,7 @@ dependencies = [ "openssl-sys", "pkg-config", "vcpkg", - "winapi", + "windows-sys", ] [[package]] @@ -209,9 +202,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "env_logger" @@ -228,26 +221,15 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.1" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] name = "event-listener" version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -263,6 +245,12 @@ dependencies = [ ] [[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -295,7 +283,7 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", @@ -327,9 +315,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "http" @@ -368,24 +356,13 @@ dependencies = [ ] [[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys", -] - -[[package]] name = "is-terminal" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.2", + "rustix", "windows-sys", ] @@ -416,21 +393,21 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "libc", @@ -440,27 +417,21 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" @@ -472,16 +443,6 @@ dependencies = [ ] [[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] name = "once_cell" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -495,9 +456,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -507,9 +468,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" +checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" [[package]] name = "percent-encoding" @@ -519,18 +480,18 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", @@ -539,9 +500,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pkg-config" @@ -593,18 +554,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.29" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -641,9 +602,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -651,14 +612,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -672,53 +631,51 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.4" +version = "1.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" dependencies = [ "aho-corasick", "memchr", + "regex-automata", "regex-syntax", ] [[package]] -name = "regex-syntax" -version = "0.7.2" +name = "regex-automata" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] [[package]] -name = "rustix" -version = "0.37.22" +name = "regex-syntax" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8818fa822adcc98b18fedbb3632a6a33213c070556b5aa7c4c8cc21cff565c4c" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys", -] +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rustix" -version = "0.38.2" +version = "0.38.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aabcb0461ebd01d6b79945797c27f8529082226cb630a9865a71870ff63532a4" +checksum = "5a74ee2d7c2581cd139b42447d7d9389b889bdaad3a73f1ebb16f2a3237bb19c" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys", "windows-sys", ] [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -740,24 +697,24 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.166" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.166" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", @@ -766,9 +723,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.99" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -777,9 +734,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -788,9 +745,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -799,9 +756,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -829,9 +786,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.23" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -840,23 +797,22 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ - "autocfg", "cfg-if", - "fastrand", + "fastrand 2.0.1", "redox_syscall", - "rustix 0.37.22", + "rustix", "windows-sys", ] [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] @@ -921,9 +877,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" @@ -933,9 +889,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -948,9 +904,9 @@ dependencies = [ [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -972,15 +928,15 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "waker-fn" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -1010,9 +966,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -1034,9 +990,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1049,42 +1005,42 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/nixpkgs/pkgs/build-support/node/fetch-npm-deps/Cargo.toml b/nixpkgs/pkgs/build-support/node/fetch-npm-deps/Cargo.toml index 41347b6c2cc3..0f7735a6e827 100644 --- a/nixpkgs/pkgs/build-support/node/fetch-npm-deps/Cargo.toml +++ b/nixpkgs/pkgs/build-support/node/fetch-npm-deps/Cargo.toml @@ -6,17 +6,17 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.71" +anyhow = "1.0.75" backoff = "0.4.0" -base64 = "0.21.2" +base64 = "0.21.4" digest = "0.10.7" env_logger = "0.10.0" isahc = { version = "1.7.2", default_features = false } -rayon = "1.7.0" -serde = { version = "1.0.164", features = ["derive"] } -serde_json = "1.0.99" -sha1 = "0.10.5" -sha2 = "0.10.7" -tempfile = "3.6.0" -url = { version = "2.4.0", features = ["serde"] } -walkdir = "2.3.3" +rayon = "1.8.0" +serde = { version = "1.0.188", features = ["derive"] } +serde_json = "1.0.107" +sha1 = "0.10.6" +sha2 = "0.10.8" +tempfile = "3.8.0" +url = { version = "2.4.1", features = ["serde"] } +walkdir = "2.4.0" diff --git a/nixpkgs/pkgs/build-support/node/fetch-npm-deps/src/parse/mod.rs b/nixpkgs/pkgs/build-support/node/fetch-npm-deps/src/parse/mod.rs index b37652ffdf82..86e9120de02f 100644 --- a/nixpkgs/pkgs/build-support/node/fetch-npm-deps/src/parse/mod.rs +++ b/nixpkgs/pkgs/build-support/node/fetch-npm-deps/src/parse/mod.rs @@ -4,7 +4,7 @@ use rayon::prelude::*; use serde_json::{Map, Value}; use std::{ fs, - io::{self, Read}, + io::Write, process::{Command, Stdio}, }; use tempfile::{tempdir, TempDir}; @@ -106,7 +106,7 @@ impl Package { let specifics = match get_hosted_git_url(&resolved)? { Some(hosted) => { - let mut body = util::get_url_with_retry(&hosted)?; + let body = util::get_url_body_with_retry(&hosted)?; let workdir = tempdir()?; @@ -120,7 +120,7 @@ impl Package { .stdin(Stdio::piped()) .spawn()?; - io::copy(&mut body, &mut cmd.stdin.take().unwrap())?; + cmd.stdin.take().unwrap().write_all(&body)?; let exit = cmd.wait()?; @@ -154,13 +154,7 @@ impl Package { pub fn tarball(&self) -> anyhow::Result<Vec<u8>> { match &self.specifics { - Specifics::Registry { .. } => { - let mut body = Vec::new(); - - util::get_url_with_retry(&self.url)?.read_to_end(&mut body)?; - - Ok(body) - } + Specifics::Registry { .. } => Ok(util::get_url_body_with_retry(&self.url)?), Specifics::Git { workdir } => Ok(Command::new("tar") .args([ "--sort=name", diff --git a/nixpkgs/pkgs/build-support/node/fetch-npm-deps/src/util.rs b/nixpkgs/pkgs/build-support/node/fetch-npm-deps/src/util.rs index 7a220f681c0d..7dd928fdc43f 100644 --- a/nixpkgs/pkgs/build-support/node/fetch-npm-deps/src/util.rs +++ b/nixpkgs/pkgs/build-support/node/fetch-npm-deps/src/util.rs @@ -4,7 +4,7 @@ use isahc::{ Body, Request, RequestExt, }; use serde_json::{Map, Value}; -use std::{env, path::Path}; +use std::{env, io::Read, path::Path}; use url::Url; pub fn get_url(url: &Url) -> Result<Body, isahc::Error> { @@ -28,7 +28,7 @@ pub fn get_url(url: &Url) -> Result<Body, isahc::Error> { if let Some(host) = url.host_str() { if let Ok(npm_tokens) = env::var("NIX_NPM_TOKENS") { if let Ok(tokens) = serde_json::from_str::<Map<String, Value>>(&npm_tokens) { - if let Some(token) = tokens.get(host).and_then(|val| val.as_str()) { + if let Some(token) = tokens.get(host).and_then(serde_json::Value::as_str) { request = request.header("Authorization", format!("Bearer {token}")); } } @@ -38,15 +38,23 @@ pub fn get_url(url: &Url) -> Result<Body, isahc::Error> { Ok(request.body(())?.send()?.into_body()) } -pub fn get_url_with_retry(url: &Url) -> Result<Body, isahc::Error> { +pub fn get_url_body_with_retry(url: &Url) -> Result<Vec<u8>, isahc::Error> { retry(ExponentialBackoff::default(), || { - get_url(url).map_err(|err| { - if err.is_network() || err.is_timeout() { - backoff::Error::transient(err) - } else { - backoff::Error::permanent(err) - } - }) + get_url(url) + .and_then(|mut body| { + let mut buf = Vec::new(); + + body.read_to_end(&mut buf)?; + + Ok(buf) + }) + .map_err(|err| { + if err.is_network() || err.is_timeout() { + backoff::Error::transient(err) + } else { + backoff::Error::permanent(err) + } + }) }) .map_err(|backoff_err| match backoff_err { backoff::Error::Permanent(err) diff --git a/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/default.nix b/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/default.nix index d95b1078c162..49c2f6cbfc98 100644 --- a/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/default.nix +++ b/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/default.nix @@ -3,7 +3,7 @@ let yarnpkg-lockfile-tar = fetchurl { url = "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz"; - sha512 = "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ=="; + hash = "sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ=="; }; tests = callPackage ./tests {}; diff --git a/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/index.js b/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/index.js index 04f47362b10d..de2a09ee9041 100755 --- a/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/index.js +++ b/nixpkgs/pkgs/build-support/node/fetch-yarn-deps/index.js @@ -37,7 +37,9 @@ const downloadFileHttps = (fileName, url, expectedHash, hashType = 'sha1') => { res.on('end', () => { file.close() const h = hash.read() - if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h}`)) + if (expectedHash === undefined){ + console.log(`Warning: lockfile url ${url} doesn't end in "#<hash>" to validate against. Downloaded file had hash ${h}.`); + } else if (h != expectedHash) return reject(new Error(`hash mismatch, expected ${expectedHash}, got ${h}`)) resolve() }) res.on('error', e => reject(e)) diff --git a/nixpkgs/pkgs/build-support/ocaml/topkg.nix b/nixpkgs/pkgs/build-support/ocaml/topkg.nix new file mode 100644 index 000000000000..73be5815e44c --- /dev/null +++ b/nixpkgs/pkgs/build-support/ocaml/topkg.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchurl, ocaml, findlib, topkg, ocamlbuild, cmdliner, odoc, b0 +}: + +{ pname, version, nativeBuildInputs ? [ ], buildInputs ? [ ], ... }@args: + +lib.throwIf (args ? minimalOCamlVersion + && lib.versionOlder ocaml.version args.minimalOCamlVersion) +"${pname}-${version} is not available for OCaml ${ocaml.version}" + +stdenv.mkDerivation ({ + + dontAddStaticConfigureFlags = true; + configurePlatforms = [ ]; + strictDeps = true; + inherit (topkg) buildPhase installPhase; + +} // (builtins.removeAttrs args [ "minimalOCamlVersion" ]) // { + + name = "ocaml${ocaml.version}-${pname}-${version}"; + + nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ] ++ nativeBuildInputs; + buildInputs = [ topkg ] ++ buildInputs; + + meta = (args.meta or { }) // { + platforms = args.meta.platforms or ocaml.meta.platforms; + }; + +}) diff --git a/nixpkgs/pkgs/build-support/php/build-composer-project.nix b/nixpkgs/pkgs/build-support/php/build-composer-project.nix index 6aecf4345773..d614ca01eb71 100644 --- a/nixpkgs/pkgs/build-support/php/build-composer-project.nix +++ b/nixpkgs/pkgs/build-support/php/build-composer-project.nix @@ -17,6 +17,7 @@ let nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [ composer composer-local-repo-plugin + phpDrv phpDrv.composerHooks.composerInstallHook ]; @@ -53,6 +54,13 @@ let runHook postInstall ''; + doInstallCheck = previousAttrs.doInstallCheck or false; + installCheckPhase = previousAttrs.installCheckPhase or '' + runHook preCheckInstall + + runHook postCheckInstall + ''; + composerRepository = phpDrv.mkComposerRepository { inherit composer composer-local-repo-plugin; inherit (finalAttrs) patches pname src vendorHash version; @@ -63,6 +71,10 @@ let composerNoScripts = previousAttrs.composerNoScripts or true; }; + COMPOSER_CACHE_DIR="/dev/null"; + COMPOSER_DISABLE_NETWORK="1"; + COMPOSER_MIRROR_PATH_REPOS="1"; + meta = previousAttrs.meta or { } // { platforms = lib.platforms.all; }; diff --git a/nixpkgs/pkgs/build-support/php/build-composer-repository.nix b/nixpkgs/pkgs/build-support/php/build-composer-repository.nix index 30b0b48de751..9487b61e16cb 100644 --- a/nixpkgs/pkgs/build-support/php/build-composer-repository.nix +++ b/nixpkgs/pkgs/build-support/php/build-composer-repository.nix @@ -41,6 +41,7 @@ let nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [ composer composer-local-repo-plugin + phpDrv phpDrv.composerHooks.composerRepositoryHook ]; @@ -74,6 +75,13 @@ let runHook postInstall ''; + doInstallCheck = previousAttrs.doInstallCheck or false; + installCheckPhase = previousAttrs.installCheckPhase or '' + runHook preCheckInstall + + runHook postCheckInstall + ''; + COMPOSER_CACHE_DIR = "/dev/null"; COMPOSER_MIRROR_PATH_REPOS = "1"; COMPOSER_HTACCESS_PROTECT = "0"; diff --git a/nixpkgs/pkgs/build-support/php/build-pecl.nix b/nixpkgs/pkgs/build-support/php/build-pecl.nix index 389447e066fa..6f38a668f3a3 100644 --- a/nixpkgs/pkgs/build-support/php/build-pecl.nix +++ b/nixpkgs/pkgs/build-support/php/build-pecl.nix @@ -8,10 +8,9 @@ , nativeBuildInputs ? [ ] , postPhpize ? "" , makeFlags ? [ ] -, src ? fetchurl { +, src ? fetchurl ({ url = "https://pecl.php.net/get/${pname}-${version}.tgz"; - inherit (args) sha256; - } + } // lib.filterAttrs (attrName: _: lib.elem attrName [ "sha256" "hash" ]) args) , passthru ? { } , ... }@args: diff --git a/nixpkgs/pkgs/build-support/php/hooks/composer-install-hook.sh b/nixpkgs/pkgs/build-support/php/hooks/composer-install-hook.sh index 86d17d0f50f7..ab7756aef4f1 100644 --- a/nixpkgs/pkgs/build-support/php/hooks/composer-install-hook.sh +++ b/nixpkgs/pkgs/build-support/php/hooks/composer-install-hook.sh @@ -22,13 +22,47 @@ composerInstallConfigureHook() { fi if [[ ! -f "composer.lock" ]]; then - echo "No composer.lock file found, consider adding one to your repository to ensure reproducible builds." + composer \ + --no-ansi \ + --no-install \ + --no-interaction \ + ${composerNoDev:+--no-dev} \ + ${composerNoPlugins:+--no-plugins} \ + ${composerNoScripts:+--no-scripts} \ + update + + mkdir -p $out + cp composer.lock $out/ + + echo + echo 'No composer.lock file found, consider adding one to your repository to ensure reproducible builds.' + echo "In the meantime, a composer.lock file has been generated for you in $out/composer.lock" + echo + echo 'To fix the issue:' + echo "1. Copy the composer.lock file from $out/composer.lock to the project's source:" + echo " cp $out/composer.lock <path>" + echo '2. Add the composerLock attribute, pointing to the copied composer.lock file:' + echo ' composerLock = ./composer.lock;' + echo - if [[ -f "${composerRepository}/composer.lock" ]]; then - cp ${composerRepository}/composer.lock composer.lock - fi + exit 1 + fi - echo "Using an autogenerated composer.lock file." + echo "Validating consistency between composer.lock and ${composerRepository}/composer.lock" + if ! @cmp@ -s "composer.lock" "${composerRepository}/composer.lock"; then + echo + echo "ERROR: vendorHash is out of date" + echo + echo "composer.lock is not the same in $composerRepository" + echo + echo "To fix the issue:" + echo '1. Set vendorHash to an empty string: `vendorHash = "";`' + echo '2. Build the derivation and wait for it to fail with a hash mismatch' + echo '3. Copy the "got: sha256-..." value back into the vendorHash field' + echo ' You should have: vendorHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";' + echo + + exit 1 fi chmod +w composer.json composer.lock @@ -43,9 +77,9 @@ composerInstallBuildHook() { # because the file contains hardcoded nix store paths, we generate it here. composer-local-repo-plugin --no-ansi build-local-repo -m "${composerRepository}" . - # Remove all the repositories of type "composer" + # Remove all the repositories of type "composer" and "vcs" # from the composer.json file. - jq -r -c 'del(try .repositories[] | select(.type == "composer"))' composer.json | sponge composer.json + jq -r -c 'del(try .repositories[] | select(.type == "composer" or .type == "vcs"))' composer.json | sponge composer.json # Configure composer to disable packagist and avoid using the network. composer config repo.packagist false @@ -54,7 +88,6 @@ composerInstallBuildHook() { # Since the composer.json file has been modified in the previous step, the # composer.lock file needs to be updated. - COMPOSER_DISABLE_NETWORK=1 \ COMPOSER_ROOT_VERSION="${version}" \ composer \ --lock \ @@ -84,10 +117,7 @@ composerInstallInstallHook() { # the autoloader. # The COMPOSER_ROOT_VERSION environment variable is needed only for # vimeo/psalm. - COMPOSER_CACHE_DIR=/dev/null \ - COMPOSER_DISABLE_NETWORK=1 \ COMPOSER_ROOT_VERSION="${version}" \ - COMPOSER_MIRROR_PATH_REPOS="1" \ composer \ --no-ansi \ --no-interaction \ diff --git a/nixpkgs/pkgs/build-support/php/hooks/composer-repository-hook.sh b/nixpkgs/pkgs/build-support/php/hooks/composer-repository-hook.sh index 057acf1fcc30..2c35b11b73b4 100644 --- a/nixpkgs/pkgs/build-support/php/hooks/composer-repository-hook.sh +++ b/nixpkgs/pkgs/build-support/php/hooks/composer-repository-hook.sh @@ -17,7 +17,7 @@ composerRepositoryConfigureHook() { fi if [[ ! -f "composer.lock" ]]; then - echo "No composer.lock file found, consider adding one to your repository to ensure reproducible builds." + COMPOSER_ROOT_VERSION="${version}" \ composer \ --no-ansi \ --no-install \ @@ -26,7 +26,22 @@ composerRepositoryConfigureHook() { ${composerNoPlugins:+--no-plugins} \ ${composerNoScripts:+--no-scripts} \ update - echo "Using an autogenerated composer.lock file." + + mkdir -p $out + cp composer.lock $out/ + + echo + echo 'No composer.lock file found, consider adding one to your repository to ensure reproducible builds.' + echo "In the meantime, a composer.lock file has been generated for you in $out/composer.lock" + echo + echo 'To fix the issue:' + echo "1. Copy the composer.lock file from $out/composer.lock to the project's source:" + echo " cp $out/composer.lock <path>" + echo '2. Add the composerLock attribute, pointing to the copied composer.lock file:' + echo ' composerLock = ./composer.lock;' + echo + + exit 1 fi echo "Finished composerRepositoryConfigureHook" @@ -40,7 +55,6 @@ composerRepositoryBuildHook() { # Build the local composer repository # The command 'build-local-repo' is provided by the Composer plugin # nix-community/composer-local-repo-plugin. - COMPOSER_CACHE_DIR=/dev/null \ composer-local-repo-plugin --no-ansi build-local-repo ${composerNoDev:+--no-dev} -r repository echo "Finished composerRepositoryBuildHook" @@ -61,8 +75,8 @@ composerRepositoryInstallHook() { cp -ar repository/. $out/ - # Copy the composer.lock files to the output directory, in case it has been - # autogenerated. + # Copy the composer.lock files to the output directory, to be able to validate consistency with + # the src composer.lock file where this fixed-output derivation is used cp composer.lock $out/ echo "Finished composerRepositoryInstallHook" diff --git a/nixpkgs/pkgs/build-support/php/hooks/default.nix b/nixpkgs/pkgs/build-support/php/hooks/default.nix index e7de98647c39..240ec640723a 100644 --- a/nixpkgs/pkgs/build-support/php/hooks/default.nix +++ b/nixpkgs/pkgs/build-support/php/hooks/default.nix @@ -1,22 +1,29 @@ -{ makeSetupHook +{ lib +, makeSetupHook +, diffutils , jq , moreutils , makeBinaryWrapper -, php +, cacert +, buildPackages }: { composerRepositoryHook = makeSetupHook { name = "composer-repository-hook.sh"; - propagatedBuildInputs = [ jq moreutils php ]; + propagatedBuildInputs = [ jq moreutils cacert ]; substitutions = { }; } ./composer-repository-hook.sh; composerInstallHook = makeSetupHook { name = "composer-install-hook.sh"; - propagatedBuildInputs = [ jq makeBinaryWrapper moreutils php ]; - substitutions = { }; + propagatedBuildInputs = [ jq makeBinaryWrapper moreutils cacert ]; + substitutions = { + # Specify the stdenv's `diff` by abspath to ensure that the user's build + # inputs do not cause us to find the wrong `diff`. + cmp = "${lib.getBin buildPackages.diffutils}/bin/cmp"; + }; } ./composer-install-hook.sh; } diff --git a/nixpkgs/pkgs/build-support/php/pkgs/composer-local-repo-plugin.nix b/nixpkgs/pkgs/build-support/php/pkgs/composer-local-repo-plugin.nix index f4f1cc1ff72e..48d05b7a0008 100644 --- a/nixpkgs/pkgs/build-support/php/pkgs/composer-local-repo-plugin.nix +++ b/nixpkgs/pkgs/build-support/php/pkgs/composer-local-repo-plugin.nix @@ -1,7 +1,9 @@ -{ callPackage, stdenvNoCC, lib, fetchFromGitHub, makeBinaryWrapper }: +{ php, callPackage, stdenvNoCC, lib, fetchFromGitHub, makeBinaryWrapper }: let - composer = callPackage ./composer-phar.nix { }; + composer = callPackage ./composer-phar.nix { + inherit (php.packages.composer) version pharHash; + }; composerKeys = stdenvNoCC.mkDerivation (finalComposerKeysAttrs: { pname = "composer-keys"; @@ -27,13 +29,13 @@ let in stdenvNoCC.mkDerivation (finalAttrs: { pname = "composer-local-repo-plugin"; - version = "1.0.2"; + version = "1.0.3"; src = fetchFromGitHub { owner = "nix-community"; repo = "composer-local-repo-plugin"; rev = finalAttrs.version; - hash = "sha256-L1DPAINlYiC/HdcgDpI72OI58v8LWfhZVuS1vtNDnEw="; + hash = "sha256-fLJlxcAQ7X28GDK8PVYKxJgTzbspfWxvgRmRK4NZRIA="; }; COMPOSER_CACHE_DIR = "/dev/null"; @@ -69,7 +71,6 @@ stdenvNoCC.mkDerivation (finalAttrs: { composer global config --quiet minimum-stability dev composer global config --quiet prefer-stable true - composer global config --quiet autoloader-suffix "nixPredictableAutoloaderSuffix" composer global config --quiet apcu-autoloader false composer global config --quiet allow-plugins.nix-community/composer-local-repo-plugin true composer global config --quiet repo.packagist false diff --git a/nixpkgs/pkgs/build-support/php/pkgs/composer-phar.nix b/nixpkgs/pkgs/build-support/php/pkgs/composer-phar.nix index 3efd9098d6df..f281334ab2d9 100644 --- a/nixpkgs/pkgs/build-support/php/pkgs/composer-phar.nix +++ b/nixpkgs/pkgs/build-support/php/pkgs/composer-phar.nix @@ -10,15 +10,17 @@ , stdenvNoCC , unzip , xz + , version + , pharHash }: stdenvNoCC.mkDerivation (finalAttrs: { pname = "composer-phar"; - version = "2.6.3"; + inherit version; src = fetchurl { url = "https://github.com/composer/composer/releases/download/${finalAttrs.version}/composer.phar"; - hash = "sha256-5Yo5DKwN9FzPWj2VrpT6I57e2LeQf6LI91LwIDBPybE="; + hash = pharHash; }; dontUnpack = true; diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix index f6079b7316d6..4e3e2045e8ec 100644 --- a/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix +++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix @@ -353,6 +353,10 @@ crate_: lib.makeOverridable extraRustcOpts buildTests codegenUnits; }; dontStrip = !release; + + # We need to preserve metadata in .rlib, which might get stripped on macOS. See https://github.com/NixOS/nixpkgs/issues/218712 + stripExclude = [ "*.rlib" ]; + installPhase = installCrate crateName metadata buildTests; # depending on the test setting we are either producing something with bins diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix b/nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix index 9eab4733db64..ea15421b29fa 100644 --- a/nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix +++ b/nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix @@ -64,7 +64,6 @@ let assert cargoVendorDir == null && cargoLock == null -> !(args ? cargoSha256 && args.cargoSha256 != null) && !(args ? cargoHash && args.cargoHash != null) -> throw "cargoSha256, cargoHash, cargoVendorDir, or cargoLock must be set"; - assert buildType == "release" || buildType == "debug"; let @@ -85,14 +84,9 @@ let targetIsJSON = lib.hasSuffix ".json" target; useSysroot = targetIsJSON && !__internal_dontAddSysroot; - # see https://github.com/rust-lang/cargo/blob/964a16a28e234a3d397b2a7031d4ab4a428b1391/src/cargo/core/compiler/compile_kind.rs#L151-L168 - # the "${}" is needed to transform the path into a /nix/store path before baseNameOf - shortTarget = if targetIsJSON then - (lib.removeSuffix ".json" (builtins.baseNameOf "${target}")) - else target; - sysroot = callPackage ./sysroot { } { - inherit target shortTarget; + inherit target; + shortTarget = rust.lib.toRustTargetSpecShort stdenv.hostPlatform; RUSTFLAGS = args.RUSTFLAGS or ""; originalCargoToml = src + /Cargo.toml; # profile info is later extracted }; diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-build-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-build-hook.sh index af94e02e38ae..ed982c7ff30a 100644 --- a/nixpkgs/pkgs/build-support/rust/hooks/cargo-build-hook.sh +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-build-hook.sh @@ -17,7 +17,7 @@ cargoBuildHook() { fi if [ "${cargoBuildType}" != "debug" ]; then - cargoBuildProfileFlag="--${cargoBuildType}" + cargoBuildProfileFlag="--profile ${cargoBuildType}" fi if [ -n "${cargoBuildNoDefaultFeatures-}" ]; then @@ -30,13 +30,8 @@ cargoBuildHook() { ( set -x - env \ - "CC_@rustBuildPlatform@=@ccForBuild@" \ - "CXX_@rustBuildPlatform@=@cxxForBuild@" \ - "CC_@rustTargetPlatform@=@ccForHost@" \ - "CXX_@rustTargetPlatform@=@cxxForHost@" \ - cargo build -j $NIX_BUILD_CORES \ - --target @rustTargetPlatformSpec@ \ + @setEnv@ cargo build -j $NIX_BUILD_CORES \ + --target @rustHostPlatformSpec@ \ --frozen \ ${cargoBuildProfileFlag} \ ${cargoBuildNoDefaultFeaturesFlag} \ diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-check-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-check-hook.sh index 57fc2779cfe9..971a140ec178 100644 --- a/nixpkgs/pkgs/build-support/rust/hooks/cargo-check-hook.sh +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-check-hook.sh @@ -17,7 +17,7 @@ cargoCheckHook() { fi if [ "${cargoCheckType}" != "debug" ]; then - cargoCheckProfileFlag="--${cargoCheckType}" + cargoCheckProfileFlag="--profile ${cargoCheckType}" fi if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then @@ -29,7 +29,7 @@ cargoCheckHook() { fi argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag} - --target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}" + --target @rustHostPlatformSpec@ --frozen ${cargoTestFlags}" ( set -x diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-install-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-install-hook.sh index 69ce72669366..24a6e6fa9eb3 100644 --- a/nixpkgs/pkgs/build-support/rust/hooks/cargo-install-hook.sh +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-install-hook.sh @@ -1,7 +1,7 @@ cargoInstallPostBuildHook() { echo "Executing cargoInstallPostBuildHook" - releaseDir=target/@shortTarget@/$cargoBuildType + releaseDir=target/@targetSubdirectory@/$cargoBuildType tmpDir="${releaseDir}-tmp"; mkdir -p $tmpDir @@ -21,7 +21,7 @@ cargoInstallHook() { # rename the output dir to a architecture independent one - releaseDir=target/@shortTarget@/$cargoBuildType + releaseDir=target/@targetSubdirectory@/$cargoBuildType tmpDir="${releaseDir}-tmp"; mapfile -t targets < <(find "$NIX_BUILD_TOP" -type d | grep "${tmpDir}$") diff --git a/nixpkgs/pkgs/build-support/rust/hooks/cargo-nextest-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/cargo-nextest-hook.sh index de85683ead2a..29ba18a6a1e3 100644 --- a/nixpkgs/pkgs/build-support/rust/hooks/cargo-nextest-hook.sh +++ b/nixpkgs/pkgs/build-support/rust/hooks/cargo-nextest-hook.sh @@ -17,7 +17,7 @@ cargoNextestHook() { fi if [ "${cargoCheckType}" != "debug" ]; then - cargoCheckProfileFlag="--${cargoCheckType}" + cargoCheckProfileFlag="--cargo-profile ${cargoCheckType}" fi if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then @@ -29,7 +29,7 @@ cargoNextestHook() { fi argstr="${cargoCheckProfileFlag} ${cargoCheckNoDefaultFeaturesFlag} ${cargoCheckFeaturesFlag} - --target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}" + --target @rustHostPlatformSpec@ --frozen ${cargoTestFlags}" ( set -x diff --git a/nixpkgs/pkgs/build-support/rust/hooks/default.nix b/nixpkgs/pkgs/build-support/rust/hooks/default.nix index 2eb388fe07ba..205d085d3507 100644 --- a/nixpkgs/pkgs/build-support/rust/hooks/default.nix +++ b/nixpkgs/pkgs/build-support/rust/hooks/default.nix @@ -9,32 +9,20 @@ , rust , rustc , stdenv -, target ? rust.toRustTargetSpec stdenv.hostPlatform -}: -let - targetIsJSON = lib.hasSuffix ".json" target; +# This confusingly-named parameter indicates the *subdirectory of +# `target/` from which to copy the build artifacts. It is derived +# from a stdenv platform (or a JSON file). +, target ? rust.lib.toRustTargetSpecShort stdenv.hostPlatform +}: - # see https://github.com/rust-lang/cargo/blob/964a16a28e234a3d397b2a7031d4ab4a428b1391/src/cargo/core/compiler/compile_kind.rs#L151-L168 - # the "${}" is needed to transform the path into a /nix/store path before baseNameOf - shortTarget = if targetIsJSON then - (lib.removeSuffix ".json" (builtins.baseNameOf "${target}")) - else target; - ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; - cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; - ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; - cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; - rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform; - rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; - rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform; -in { +{ cargoBuildHook = callPackage ({ }: makeSetupHook { name = "cargo-build-hook.sh"; propagatedBuildInputs = [ cargo ]; substitutions = { - inherit ccForBuild ccForHost cxxForBuild cxxForHost - rustBuildPlatform rustTargetPlatform rustTargetPlatformSpec; + inherit (rust.envVars) rustHostPlatformSpec setEnv; }; } ./cargo-build-hook.sh) {}; @@ -43,7 +31,7 @@ in { name = "cargo-check-hook.sh"; propagatedBuildInputs = [ cargo ]; substitutions = { - inherit rustTargetPlatformSpec; + inherit (rust.envVars) rustHostPlatformSpec; }; } ./cargo-check-hook.sh) {}; @@ -52,7 +40,7 @@ in { name = "cargo-install-hook.sh"; propagatedBuildInputs = [ ]; substitutions = { - inherit shortTarget; + targetSubdirectory = target; }; } ./cargo-install-hook.sh) {}; @@ -61,7 +49,7 @@ in { name = "cargo-nextest-hook.sh"; propagatedBuildInputs = [ cargo cargo-nextest ]; substitutions = { - inherit rustTargetPlatformSpec; + inherit (rust.envVars) rustHostPlatformSpec; }; } ./cargo-nextest-hook.sh) {}; @@ -78,23 +66,26 @@ in { cargoConfig = '' [target."${rust.toRustTarget stdenv.buildPlatform}"] - "linker" = "${ccForBuild}" + "linker" = "${rust.envVars.ccForBuild}" ${lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) '' - [target."${shortTarget}"] - "linker" = "${ccForHost}" + [target."${rust.toRustTarget stdenv.hostPlatform}"] + "linker" = "${rust.envVars.ccForHost}" ''} "rustflags" = [ "-C", "target-feature=${if stdenv.hostPlatform.isStatic then "+" else "-"}crt-static" ] ''; }; } ./cargo-setup-hook.sh) {}; - maturinBuildHook = callPackage ({ }: + maturinBuildHook = callPackage ({ pkgsHostTarget }: makeSetupHook { name = "maturin-build-hook.sh"; - propagatedBuildInputs = [ cargo maturin rustc ]; + propagatedBuildInputs = [ + pkgsHostTarget.maturin + pkgsHostTarget.cargo + pkgsHostTarget.rustc + ]; substitutions = { - inherit ccForBuild ccForHost cxxForBuild cxxForHost - rustBuildPlatform rustTargetPlatform rustTargetPlatformSpec; + inherit (rust.envVars) rustTargetPlatformSpec setEnv; }; } ./maturin-build-hook.sh) {}; diff --git a/nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh b/nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh index 62d5619660c6..d5ff069290ba 100644 --- a/nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh +++ b/nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh @@ -9,12 +9,7 @@ maturinBuildHook() { ( set -x - env \ - "CC_@rustBuildPlatform@=@ccForBuild@" \ - "CXX_@rustBuildPlatform@=@cxxForBuild@" \ - "CC_@rustTargetPlatform@=@ccForHost@" \ - "CXX_@rustTargetPlatform@=@cxxForHost@" \ - maturin build \ + @setEnv@ maturin build \ --jobs=$NIX_BUILD_CORES \ --frozen \ --target @rustTargetPlatformSpec@ \ diff --git a/nixpkgs/pkgs/build-support/rust/lib/default.nix b/nixpkgs/pkgs/build-support/rust/lib/default.nix index aa5ba14c1397..ceca7323176c 100644 --- a/nixpkgs/pkgs/build-support/rust/lib/default.nix +++ b/nixpkgs/pkgs/build-support/rust/lib/default.nix @@ -1,4 +1,8 @@ -{ lib }: +{ lib +, stdenv +, buildPackages +, targetPackages +}: rec { # https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch @@ -59,8 +63,88 @@ rec { then builtins.toFile (toRustTarget platform + ".json") (builtins.toJSON platform.rustc.platform) else toRustTarget platform; + # Returns the name of the rust target if it is standard, or the + # basename of the file containing the custom target spec, without + # the .json extension. + # + # This is the name used by Cargo for target subdirectories. + toRustTargetSpecShort = platform: + lib.removeSuffix ".json" + (baseNameOf "${toRustTargetSpec platform}"); + + # When used as part of an environment variable name, triples are + # uppercased and have all hyphens replaced by underscores: + # + # https://github.com/rust-lang/cargo/pull/9169 + # https://github.com/rust-lang/cargo/issues/8285#issuecomment-634202431 + # + toRustTargetForUseInEnvVars = platform: + lib.strings.replaceStrings ["-"] ["_"] + (lib.strings.toUpper + (toRustTargetSpecShort platform)); + # Returns true if the target is no_std # https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421 IsNoStdTarget = platform: let rustTarget = toRustTarget platform; in builtins.any (t: lib.hasInfix t rustTarget) ["-none" "nvptx" "switch" "-uefi"]; + + # These environment variables must be set when using `cargo-c` and + # several other tools which do not deal well with cross + # compilation. The symptom of the problem they fix is errors due + # to buildPlatform CFLAGS being passed to the + # hostPlatform-targeted compiler -- for example, `-m64` being + # passed on a build=x86_64/host=aarch64 compilation. + envVars = let + ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; + cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; + ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; + cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; + + # Unfortunately we must use the dangerous `targetPackages` here + # because hooks are artificially phase-shifted one slot earlier + # (they go in nativeBuildInputs, so the hostPlatform looks like + # a targetPlatform to them). + ccForTarget = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc"; + cxxForTarget = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++"; + + rustBuildPlatform = toRustTarget stdenv.buildPlatform; + rustBuildPlatformSpec = toRustTargetSpec stdenv.buildPlatform; + rustHostPlatform = toRustTarget stdenv.hostPlatform; + rustHostPlatformSpec = toRustTargetSpec stdenv.hostPlatform; + rustTargetPlatform = toRustTarget stdenv.targetPlatform; + rustTargetPlatformSpec = toRustTargetSpec stdenv.targetPlatform; + in { + inherit + ccForBuild cxxForBuild rustBuildPlatform rustBuildPlatformSpec + ccForHost cxxForHost rustHostPlatform rustHostPlatformSpec + ccForTarget cxxForTarget rustTargetPlatform rustTargetPlatformSpec; + + # Prefix this onto a command invocation in order to set the + # variables needed by cargo. + # + setEnv = '' + env \ + '' + # Due to a bug in how splicing and targetPackages works, in + # situations where targetPackages is irrelevant + # targetPackages.stdenv.cc is often simply wrong. We must omit + # the following lines when rustTargetPlatform collides with + # rustHostPlatform. + + lib.optionalString (rustTargetPlatform != rustHostPlatform) '' + "CC_${toRustTargetForUseInEnvVars stdenv.targetPlatform}=${ccForTarget}" \ + "CXX_${toRustTargetForUseInEnvVars stdenv.targetPlatform}=${cxxForTarget}" \ + "CARGO_TARGET_${toRustTargetForUseInEnvVars stdenv.targetPlatform}_LINKER=${ccForTarget}" \ + '' + '' + "CC_${toRustTargetForUseInEnvVars stdenv.hostPlatform}=${ccForHost}" \ + "CXX_${toRustTargetForUseInEnvVars stdenv.hostPlatform}=${cxxForHost}" \ + "CARGO_TARGET_${toRustTargetForUseInEnvVars stdenv.hostPlatform}_LINKER=${ccForHost}" \ + '' + '' + "CC_${toRustTargetForUseInEnvVars stdenv.buildPlatform}=${ccForBuild}" \ + "CXX_${toRustTargetForUseInEnvVars stdenv.buildPlatform}=${cxxForBuild}" \ + "CARGO_TARGET_${toRustTargetForUseInEnvVars stdenv.buildPlatform}_LINKER=${ccForBuild}" \ + "CARGO_BUILD_TARGET=${rustBuildPlatform}" \ + "HOST_CC=${buildPackages.stdenv.cc}/bin/cc" \ + "HOST_CXX=${buildPackages.stdenv.cc}/bin/c++" \ + ''; + }; } diff --git a/nixpkgs/pkgs/build-support/trivial-builders/default.nix b/nixpkgs/pkgs/build-support/trivial-builders/default.nix index 8b8732af0656..f7adfad455bd 100644 --- a/nixpkgs/pkgs/build-support/trivial-builders/default.nix +++ b/nixpkgs/pkgs/build-support/trivial-builders/default.nix @@ -311,6 +311,8 @@ rec { Similar to writeShellScriptBin and writeScriptBin. Writes an executable Shell script to /nix/store/<store path>/bin/<name> and checks its syntax with shellcheck and the shell's -n option. + Individual checks can be foregone by putting them in the excludeShellChecks + list, e.g. [ "SC2016" ]. Automatically includes sane set of shellopts (errexit, nounset, pipefail) and handles creation of PATH based on runtimeInputs @@ -338,6 +340,7 @@ rec { , runtimeInputs ? [ ] , meta ? { } , checkPhase ? null + , excludeShellChecks ? [ ] }: writeTextFile { inherit name meta; @@ -363,10 +366,11 @@ rec { # but we still want to use writeShellApplication on those platforms let shellcheckSupported = lib.meta.availableOn stdenv.buildPlatform shellcheck.compiler; + excludeOption = lib.optionalString (excludeShellChecks != [ ]) "--exclude '${lib.concatStringsSep "," excludeShellChecks}'"; shellcheckCommand = lib.optionalString shellcheckSupported '' # use shellcheck which does not include docs # pandoc takes long to build and documentation isn't needed for just running the cli - ${lib.getExe (haskell.lib.compose.justStaticExecutables shellcheck.unwrapped)} "$target" + ${lib.getExe (haskell.lib.compose.justStaticExecutables shellcheck.unwrapped)} ${excludeOption} "$target" ''; in if checkPhase == null then '' diff --git a/nixpkgs/pkgs/build-support/trivial-builders/test/default.nix b/nixpkgs/pkgs/build-support/trivial-builders/test/default.nix index 683f4b9fd04f..cbd1b388ef66 100644 --- a/nixpkgs/pkgs/build-support/trivial-builders/test/default.nix +++ b/nixpkgs/pkgs/build-support/trivial-builders/test/default.nix @@ -25,6 +25,7 @@ recurseIntoAttrs { then callPackage ./references.nix {} else null; writeCBin = callPackage ./writeCBin.nix {}; + writeShellApplication = callPackage ./writeShellApplication.nix {}; writeScriptBin = callPackage ./writeScriptBin.nix {}; writeShellScript = callPackage ./write-shell-script.nix {}; writeShellScriptBin = callPackage ./writeShellScriptBin.nix {}; diff --git a/nixpkgs/pkgs/build-support/trivial-builders/test/writeShellApplication.nix b/nixpkgs/pkgs/build-support/trivial-builders/test/writeShellApplication.nix new file mode 100644 index 000000000000..6ce6f0720fcf --- /dev/null +++ b/nixpkgs/pkgs/build-support/trivial-builders/test/writeShellApplication.nix @@ -0,0 +1,29 @@ +/* + Run with: + + cd nixpkgs + nix-build -A tests.trivial-builders.writeShellApplication +*/ + +{ lib, writeShellApplication, runCommand }: +let + pkg = writeShellApplication { + name = "test-script"; + excludeShellChecks = [ "SC2016" ]; + text = '' + echo -e '#!/usr/bin/env bash\n' \ + 'echo "$SHELL"' > /tmp/something.sh # this line would normally + # ...cause shellcheck error + ''; + }; +in + assert pkg.meta.mainProgram == "test-script"; + runCommand "test-writeShellApplication" { } '' + + echo Testing if writeShellApplication builds without shellcheck error... + + target=${lib.getExe pkg} + + touch $out + '' + |