diff --git a/doc/doc-support/lib-function-docs.nix b/doc/doc-support/lib-function-docs.nix index 61671bd39059..51b4601975c3 100644 --- a/doc/doc-support/lib-function-docs.nix +++ b/doc/doc-support/lib-function-docs.nix @@ -95,7 +95,7 @@ stdenvNoCC.mkDerivation { fileset = ../../lib; }; - buildInputs = [ + nativeBuildInputs = [ nixdoc nix ]; diff --git a/doc/tests/manpage-urls.nix b/doc/tests/manpage-urls.nix index 214c23616009..913aebe4ebe8 100644 --- a/doc/tests/manpage-urls.nix +++ b/doc/tests/manpage-urls.nix @@ -17,7 +17,7 @@ invalidateFetcherByDrvHash ( { nativeBuildInputs = [ cacert - (python3.withPackages (p: [ + (python3.pythonOnBuildForHost.withPackages (p: [ p.aiohttp p.rich p.structlog diff --git a/lib/tests/release.nix b/lib/tests/release.nix index 5334498d0844..d83c15c511fa 100644 --- a/lib/tests/release.nix +++ b/lib/tests/release.nix @@ -1,18 +1,23 @@ { # The pkgs used for dependencies for the testing itself # Don't test properties of pkgs.lib, but rather the lib in the parent directory pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; }, + # For testing someone may edit impure.nix to return cross pkgs, use `pkgsBuildBuild` directly so everything here works. + pkgsBB ? pkgs.pkgsBuildBuild, nix ? pkgs-nixVersions.stable, nixVersions ? [ pkgs-nixVersions.minimum nix pkgs-nixVersions.latest ], - pkgs-nixVersions ? import ./nix-for-tests.nix { inherit pkgs; }, + pkgs-nixVersions ? import ./nix-for-tests.nix { pkgs = pkgsBB; }, }: let lib = import ../.; testWithNix = nix: - import ./test-with-nix.nix { inherit lib nix pkgs; }; + import ./test-with-nix.nix { + inherit lib nix; + pkgs = pkgsBB; + }; in - pkgs.symlinkJoin { + pkgsBB.symlinkJoin { name = "nixpkgs-lib-tests"; paths = map testWithNix nixVersions; } diff --git a/pkgs/applications/networking/cluster/k3s/builder.nix b/pkgs/applications/networking/cluster/k3s/builder.nix index 551aef8d8ae2..2e0a4f5fec3d 100644 --- a/pkgs/applications/networking/cluster/k3s/builder.nix +++ b/pkgs/applications/networking/cluster/k3s/builder.nix @@ -138,7 +138,7 @@ let s: mutFirstChar lib.toLower (lib.concatMapStrings (mutFirstChar lib.toUpper) (lib.splitString "-" s)); - # finds the images archive for the desired architecture, aborts in case no suitable archive is found + # finds the images archive for the desired architecture, throws in case no suitable archive is found findImagesArchive = arch: let @@ -146,17 +146,17 @@ let in lib.findFirst ( n: lib.hasInfix arch n - ) (abort "k3s: no airgap images for ${arch} available") imagesVersionsNames; + ) (throw "k3s: no airgap images for ${arch} available") imagesVersionsNames; # a shortcut that provides the images archive for the host platform. Currently only supports - # aarch64 (arm64) and x86_64 (amd64), aborts on other architectures. + # aarch64 (arm64) and x86_64 (amd64), throws on other architectures. airgapImages = fetchurl ( if stdenv.hostPlatform.isAarch64 then imagesVersions.${findImagesArchive "arm64"} else if stdenv.hostPlatform.isx86_64 then imagesVersions.${findImagesArchive "amd64"} else - abort "k3s: airgap images cannot be found automatically for architecture ${stdenv.hostPlatform.linuxArch}, consider using an image archive with an explicit architecture." + throw "k3s: airgap images cannot be found automatically for architecture ${stdenv.hostPlatform.linuxArch}, consider using an image archive with an explicit architecture." ); # so, k3s is a complicated thing to package diff --git a/pkgs/by-name/de/debase/package.nix b/pkgs/by-name/de/debase/package.nix index 1b300f1e21de..70be9b81eed6 100644 --- a/pkgs/by-name/de/debase/package.nix +++ b/pkgs/by-name/de/debase/package.nix @@ -72,7 +72,7 @@ stdenv.mkDerivation rec { else if stdenv.hostPlatform.isAarch64 then "arm64" else - abort "unsupported system: ${stdenv.system}" + throw "unsupported system: ${stdenv.system}" }" ]; diff --git a/pkgs/by-name/fr/frr/package.nix b/pkgs/by-name/fr/frr/package.nix index 29f2d42d28f8..bc96316e7111 100644 --- a/pkgs/by-name/fr/frr/package.nix +++ b/pkgs/by-name/fr/frr/package.nix @@ -33,15 +33,9 @@ , nettools , nixosTests -# FRR's configure.ac gets SNMP options by executing net-snmp-config on the build host -# This leads to compilation errors when cross compiling. -# E.g. net-snmp-config for x86_64 does not return the ARM64 paths. -# -# SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`" -# SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`" -, snmpSupport ? stdenv.buildPlatform.canExecute stdenv.hostPlatform -# other general options besides snmp support +# general options +, snmpSupport ? true , rpkiSupport ? true , numMultipath ? 64 , watchfrrSupport ? true @@ -81,9 +75,6 @@ , ospfApi ? true }: -lib.warnIf (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) - "cannot enable SNMP support due to cross-compilation issues with net-snmp-config" - stdenv.mkDerivation (finalAttrs: { pname = "frr"; version = "10.1"; @@ -194,6 +185,9 @@ stdenv.mkDerivation (finalAttrs: { (lib.strings.enableFeature ospfApi "ospfapi") # Cumulus options (lib.strings.enableFeature cumulusSupport "cumulus") + ] ++ lib.optionals snmpSupport [ + # Used during build for paths, `dev` has build shebangs so can be run during build. + "NETSNMP_CONFIG=${lib.getDev net-snmp}/bin/net-snmp-config" ]; postPatch = '' diff --git a/pkgs/by-name/ni/nim-unwrapped-2_2/package.nix b/pkgs/by-name/ni/nim-unwrapped-2_2/package.nix index 311c0f5b9d80..41307f320271 100644 --- a/pkgs/by-name/ni/nim-unwrapped-2_2/package.nix +++ b/pkgs/by-name/ni/nim-unwrapped-2_2/package.nix @@ -45,7 +45,7 @@ let else if isx86_64 then "amd64" else - abort "no Nim CPU support known for ${config}"; + throw "no Nim CPU support known for ${config}"; parseOs = platform: @@ -72,7 +72,7 @@ let else if isiOS then "iOS" else - abort "no Nim OS support known for ${config}"; + throw "no Nim OS support known for ${config}"; parsePlatform = p: { cpu = parseCpu p; diff --git a/pkgs/by-name/re/reposilite/plugins.nix b/pkgs/by-name/re/reposilite/plugins.nix index 7fbae996b0ec..a64baf95f661 100644 --- a/pkgs/by-name/re/reposilite/plugins.nix +++ b/pkgs/by-name/re/reposilite/plugins.nix @@ -3,7 +3,7 @@ makeScopeWithSplicing', }: makeScopeWithSplicing' { - otherSplices = generateSplicesForMkScope; + otherSplices = generateSplicesForMkScope "reposilitePlugins"; f = self: { diff --git a/pkgs/by-name/sa/saleae-logic/package.nix b/pkgs/by-name/sa/saleae-logic/package.nix index 27b01dc5ffe1..7d1a95418e1a 100644 --- a/pkgs/by-name/sa/saleae-logic/package.nix +++ b/pkgs/by-name/sa/saleae-logic/package.nix @@ -22,8 +22,6 @@ let in -assert stdenv.hostPlatform.system == "x86_64-linux"; - stdenv.mkDerivation rec { pname = "saleae-logic"; version = "1.2.18"; @@ -92,7 +90,7 @@ stdenv.mkDerivation rec { homepage = "https://www.saleae.com/"; sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; - platforms = platforms.linux; + platforms = intersectLists platforms.x86_64 platforms.linux; maintainers = [ maintainers.bjornfor ]; }; } diff --git a/pkgs/by-name/vi/virtual-ans/package.nix b/pkgs/by-name/vi/virtual-ans/package.nix index 4a7467da125d..e71bc00e3042 100644 --- a/pkgs/by-name/vi/virtual-ans/package.nix +++ b/pkgs/by-name/vi/virtual-ans/package.nix @@ -46,7 +46,7 @@ stdenv.mkDerivation rec { startScript = if stdenv.hostPlatform.isx86_32 then "START_LINUX_X86" else if stdenv.hostPlatform.isx86_64 then "START_LINUX_X86_64" #else if stdenv.hostPlatform.isDarwin then "START_MACOS.app" # disabled because I cannot test on Darwin - else abort "Unsupported platform: ${stdenv.hostPlatform.linuxArch}."; + else throw "Unsupported platform: ${stdenv.hostPlatform.linuxArch}."; linuxExecutable = if stdenv.hostPlatform.isx86_32 then "pixilang_linux_x86" else if stdenv.hostPlatform.isx86_64 then "pixilang_linux_x86_64" diff --git a/pkgs/development/compilers/swift/compiler/default.nix b/pkgs/development/compilers/swift/compiler/default.nix index 8e8cf798db4f..b8a415900322 100644 --- a/pkgs/development/compilers/swift/compiler/default.nix +++ b/pkgs/development/compilers/swift/compiler/default.nix @@ -541,7 +541,7 @@ in stdenv.mkDerivation { "; buildProject lldb llvm-project/lldb - ${lib.optionalString stdenv.hostPlatform.isDarwin '' + ${lib.optionalString stdenv.targetPlatform.isDarwin '' # Need to do a standalone build of concurrency for Darwin back deployment. # Based on: utils/swift_build_support/swift_build_support/products/backdeployconcurrency.py cmakeFlags=" diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 14afa3dfe6b4..7617bae86ece 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -802,7 +802,7 @@ stdenv.mkDerivation ({ buildInputs = otherBuildInputsSystem; LANG = "en_US.UTF-8"; - LOCALE_ARCHIVE = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive"; + LOCALE_ARCHIVE = lib.optionalString (stdenv.buildPlatform.libc == "glibc") "${buildPackages.glibcLocales}/lib/locale/locale-archive"; "NIX_${ghcCommandCaps}" = "${ghcEnv}/bin/${ghcCommand}"; "NIX_${ghcCommandCaps}PKG" = "${ghcEnv}/bin/${ghcCommand}-pkg"; # TODO: is this still valid? diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix index 7e926d682810..063a96dea0f1 100644 --- a/pkgs/development/interpreters/python/cpython/2.7/default.nix +++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix @@ -204,7 +204,7 @@ let ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "--disable-toolbox-glue" ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "PYTHON_FOR_BUILD=${lib.getBin buildPackages.python}/bin/python" + "PYTHON_FOR_BUILD=${lib.getBin buildPackages.python27}/bin/python" "ac_cv_buggy_getaddrinfo=no" # Assume little-endian IEEE 754 floating point when cross compiling "ac_cv_little_endian_double=yes" @@ -239,7 +239,7 @@ let nativeBuildInputs = [ autoreconfHook ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) - [ buildPackages.stdenv.cc buildPackages.python ]; + [ buildPackages.stdenv.cc buildPackages.python27 ]; mkPaths = paths: { C_INCLUDE_PATH = lib.makeSearchPathOutput "dev" "include" paths; diff --git a/pkgs/test/stdenv/gcc-stageCompare.nix b/pkgs/test/stdenv/gcc-stageCompare.nix index e5c2ed5921b3..c4a0179fb846 100644 --- a/pkgs/test/stdenv/gcc-stageCompare.nix +++ b/pkgs/test/stdenv/gcc-stageCompare.nix @@ -14,6 +14,7 @@ }: assert stdenv.cc.isGNU; + with pkgs; # rebuild gcc using the "final" stdenv let gcc-stageCompare = (gcc-unwrapped.override { @@ -25,7 +26,9 @@ let gcc-stageCompare = (gcc-unwrapped.override { }).overrideAttrs(_: { NIX_OUTPATH_USED_AS_RANDOM_SEED = stdenv.cc.cc.out; }); -in (runCommand "gcc-stageCompare" {} '' +in +assert lib.assertMsg (gcc-stageCompare ? checksum) "tests-stdenv-gcc-stageCompare: No `checksum` output in `gcc-stageCompare` see conditional in `gcc/common/checksum.nix`"; +(runCommand "gcc-stageCompare" {} '' diff -sr ${pkgs.gcc-unwrapped.checksum}/checksums ${gcc-stageCompare.checksum}/checksums && touch $out '').overrideAttrs (a: { meta = (a.meta or { }) // { platforms = lib.platforms.linux; };