diff --git a/doc/stdenv/cross-compilation.chapter.md b/doc/stdenv/cross-compilation.chapter.md index e659e1803807a..9e2dbb592bc47 100644 --- a/doc/stdenv/cross-compilation.chapter.md +++ b/doc/stdenv/cross-compilation.chapter.md @@ -150,7 +150,7 @@ depsBuildBuild = [ buildPackages.stdenv.cc ]; Add the following to your `mkDerivation` invocation. ```nix -doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; +doCheck = lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; ``` #### Package using Meson needs to run binaries for the host platform during build. {#cross-meson-runs-host-code} @@ -162,7 +162,7 @@ e.g. ``` nativeBuildInputs = [ meson -] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ +] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; ``` diff --git a/doc/stdenv/meta.chapter.md b/doc/stdenv/meta.chapter.md index c187f0602a1e1..208940eb23ca5 100644 --- a/doc/stdenv/meta.chapter.md +++ b/doc/stdenv/meta.chapter.md @@ -209,7 +209,7 @@ This means that `broken` can be used to express constraints, for example: - Does not cross compile ```nix - meta.broken = !(stdenv.buildPlatform.canExecute stdenv.hostPlatform) + meta.broken = !(lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) ``` - Broken if all of a certain set of its dependencies are broken diff --git a/lib/systems/default.nix b/lib/systems/default.nix index ada8c66e3618b..e7a299c73e64e 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -1,9 +1,100 @@ -{ lib }: - let inherit (lib.attrsets) mapAttrs; in +{ lib +}: +let + inherit (lib.attrsets) mapAttrs; + + selectEmulator = platform: pkgs: + let + qemu-user = pkgs.qemu.override { + smartcardSupport = false; + spiceSupport = false; + openGLSupport = false; + virglSupport = false; + vncSupport = false; + gtkSupport = false; + sdlSupport = false; + pulseSupport = false; + pipewireSupport = false; + smbdSupport = false; + seccompSupport = false; + enableDocs = false; + hostCpuTargets = [ "${platform.qemuArch}-linux-user" ]; + }; + wine = (pkgs.winePackagesFor "wine${toString platform.parsed.cpu.bits}").minimal; + in + if lib.systems.canExecute pkgs.stdenv.hostPlatform platform + then "${pkgs.runtimeShell} -c '\"$@\"' --" + else if platform.isWindows + then "${wine}/bin/wine${lib.optionalString (platform.parsed.cpu.bits == 64) "64"}" + else if platform.isLinux && pkgs.stdenv.hostPlatform.isLinux && platform.qemuArch != null + then "${qemu-user}/bin/qemu-${platform.qemuArch}" + else if platform.isWasi + then "${pkgs.wasmtime}/bin/wasmtime" + else if platform.isMmix + then "${pkgs.mmixware}/bin/mmix" + else null; -rec { doubles = import ./doubles.nix { inherit lib; }; + parse = import ./parse.nix { inherit lib; }; + + isCompatiblePlaceholder = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details"; + + # These definitions have to be floated out into a `let … in` binding to ensure + # that they are the same exact value struct in the evaluating Nix + # implementation. Due to a quirk in how equality is implemented, values including + # functions are considered equal if they have the same memory location as long as + # they are inside a container value and not compared directly. Thus any attribute + # set will compare equal to itself even if it contains functions. + # By floating the functions out of the attribute set construction we'll ensure + # that the functions have the same memory location regardless of what call to + # lib.systems.elaborate produced them. This ensures that platform sets will be + # equal even if they have been constructed by different calls to lib.systems.elaborate + # —as long as their other contents are the same. + # + # For details see: + # - https://github.com/NixOS/nix/issues/3371 + # - https://code.tvl.fyi/about/tvix/docs/value-pointer-equality.md + + # uncomment after 24.05 branch-off + /* + canExecutePlaceholder = _: throw "2023-06-17: `platform.canExecute` has been removed in favor of `lib.systems.canExecute platform`"; + emulatorAvailablePlaceholder = _: throw "2023-06-17: `platform.emulatorAvailable` has been removed in favor of `lib.systems.emulatorAvailable platform`"; + emulatorPlaceholder = _: throw "2023-06-17: `platform.emulator` has been removed in favor of `lib.systems.emulator platform`"; + */ + + # uncomment after 23.11 branch-off + # delete after 24.05 branch-off + /* + canExecutePlaceholder = _: lib.warn "2023-06-17: `platform.canExecute` has been removed in favor of `lib.systems.canExecute platform`" + self: plat: canExecute self plat; + emulatorAvailablePlaceholder = _: lib.warn "2023-06-17: `platform.emulatorAvailable` has been removed in favor of `lib.systems.emulatorAvailabl + self: pkgs: emulatorAvailable self pkgs; + emulatorPlaceholder = _: lib.warn "2023-06-17: `platform.emulator` has been removed in favor of `lib.systems.emulator platform`" + self: pkgs: emulator self pkgs; + */ + + # delete out after 23.11 branch-off + canExecutePlaceholder = self: plat: canExecute self plat; + emulatorAvailablePlaceholder = self: pkgs: emulatorAvailable self pkgs; + emulatorPlaceholder = self: pkgs: emulator self pkgs; + + canExecute = machinePlatform: binaryPlatform: + machinePlatform.isAndroid == binaryPlatform.isAndroid && + parse.isCompatible machinePlatform.parsed.cpu binaryPlatform.parsed.cpu + && machinePlatform.parsed.kernel == binaryPlatform.parsed.kernel; + + emulatorAvailable = platform: pkgs: (selectEmulator platform pkgs) != null; + + emulator = platform: pkgs: + if (emulatorAvailable platform pkgs) + then selectEmulator platform pkgs + else throw "Don't know how to run ${platform.config} executables."; + + +in rec { + doubles = import ./doubles.nix { inherit lib; }; + inherit parse; inspect = import ./inspect.nix { inherit lib; }; platforms = import ./platforms.nix { inherit lib; }; examples = import ./examples.nix { inherit lib; }; @@ -34,6 +125,8 @@ rec { */ flakeExposed = import ./flake-systems.nix { }; + inherit canExecute emulatorAvailable emulator; + # Elaborate a `localSystem` or `crossSystem` so that it contains everything # necessary. # @@ -53,12 +146,19 @@ rec { # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds. system = parse.doubleFromSystem final.parsed; config = parse.tripleFromSystem final.parsed; - # Determine whether we can execute binaries built for the provided platform. - canExecute = platform: - final.isAndroid == platform.isAndroid && - parse.isCompatible final.parsed.cpu platform.parsed.cpu - && final.parsed.kernel == platform.parsed.kernel; - isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details"; + + # Placeholders for removed functions that inform the user about their replacements + #isCompatible = isCompatiblePlaceholder final; + + # 2023-06-17: `platform.canExecute` is deprecated in favor of `lib.systems.canExecute platform` + canExecute = canExecutePlaceholder final; + + # 2023-06-17: `platform.emulatorAvailable` has been removed in favor of `lib.systems.emulatorAvailable platform` + emulatorAvailable = emulatorAvailablePlaceholder final; + + # 2023-06-17: `platform.emulator` has been removed in favor of `lib.systems.emulator platform` + emulator = emulatorPlaceholder final; + # Derived meta-data libc = /**/ if final.isDarwin then "libSystem" @@ -314,47 +414,8 @@ rec { if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET" else if final.isiOS then "IPHONEOS_DEPLOYMENT_TARGET" else null; - } // ( - let - selectEmulator = pkgs: - let - qemu-user = pkgs.qemu.override { - smartcardSupport = false; - spiceSupport = false; - openGLSupport = false; - virglSupport = false; - vncSupport = false; - gtkSupport = false; - sdlSupport = false; - pulseSupport = false; - pipewireSupport = false; - smbdSupport = false; - seccompSupport = false; - enableDocs = false; - hostCpuTargets = [ "${final.qemuArch}-linux-user" ]; - }; - wine = (pkgs.winePackagesFor "wine${toString final.parsed.cpu.bits}").minimal; - in - if pkgs.stdenv.hostPlatform.canExecute final - then "${pkgs.runtimeShell} -c '\"$@\"' --" - else if final.isWindows - then "${wine}/bin/wine${lib.optionalString (final.parsed.cpu.bits == 64) "64"}" - else if final.isLinux && pkgs.stdenv.hostPlatform.isLinux && final.qemuArch != null - then "${qemu-user}/bin/qemu-${final.qemuArch}" - else if final.isWasi - then "${pkgs.wasmtime}/bin/wasmtime" - else if final.isMmix - then "${pkgs.mmixware}/bin/mmix" - else null; - in { - emulatorAvailable = pkgs: (selectEmulator pkgs) != null; - - emulator = pkgs: - if (final.emulatorAvailable pkgs) - then selectEmulator pkgs - else throw "Don't know how to run ${final.config} executables."; - - }) // mapAttrs (n: v: v final.parsed) inspect.predicates + + } // mapAttrs (n: v: v final.parsed) inspect.predicates // mapAttrs (n: v: v final.gcc.arch or "default") architectures.predicates // args; in assert final.useAndroidPrebuilt -> final.isAndroid; diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index e142ff307fbd4..949bb0d955a3b 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -64,6 +64,33 @@ lib.runTests ( testunix = mseteq unix (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ cygwin ++ redox); }) + +# Uncomment after 23.11 +/* +# Verify that pointer equality doesn't influence the result of comparing two +# platform sets that are the same, but have been constructed by independent calls +# to `lib.systems.elaborate`. +// builtins.listToAttrs (builtins.map (input: { + name = "test_equality_same_argument_${input}"; + value = { + expr = lib.systems.elaborate input == lib.systems.elaborate input; + expected = true; + }; +}) [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" "x86_64-unknown-linux-musl" "powerpc64le-unknown-linux-gnu" "riscv64-linux" ]) + +# Verify that pointer equality doesn't influence the result of comparing two +# platform sets that are the same, but have been constructed by two different, +# but effectively equivalent arguments to `lib.systems.elaborate` (in one case +# we pass the `system` as a string, the other time it is placed in a skeleton +# platform attribute set). +// builtins.listToAttrs (builtins.map (system: { + name = "test_equality_equivalent_argument_${system}"; + value = { + expr = lib.systems.elaborate system == lib.systems.elaborate { inherit system; }; + expected = true; + }; +}) [ "x86_64-linux" "riscv64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-netbsd" ]) + // { test_equals_example_x86_64-linux = { expr = lib.systems.equals (lib.systems.elaborate "x86_64-linux") (lib.systems.elaborate "x86_64-linux"); @@ -79,6 +106,7 @@ lib.runTests ( expected = null; }; } +*/ # Generate test cases to assert that a change in any non-function attribute makes a platform unequal // lib.concatMapAttrs (platformAttrName: origValue: { diff --git a/nixos/modules/system/boot/binfmt.nix b/nixos/modules/system/boot/binfmt.nix index d16152ab9dec5..a755c59546442 100644 --- a/nixos/modules/system/boot/binfmt.nix +++ b/nixos/modules/system/boot/binfmt.nix @@ -28,7 +28,7 @@ let '' else interpreter; - getEmulator = system: (lib.systems.elaborate { inherit system; }).emulator pkgs; + getEmulator = system: lib.systems.emulator (lib.systems.elaborate { inherit system; }) pkgs; getQemuArch = system: (lib.systems.elaborate { inherit system; }).qemuArch; # Mapping of systems to “magicOrExtension” and “mask”. Mostly taken from: diff --git a/pkgs/applications/audio/fire/default.nix b/pkgs/applications/audio/fire/default.nix index c1ccad191602b..3183923a71db8 100644 --- a/pkgs/applications/audio/fire/default.nix +++ b/pkgs/applications/audio/fire/default.nix @@ -107,7 +107,7 @@ stdenv.mkDerivation rec { # Fails to find fp.h on its own env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-isystem ${CoreServices}/Library/Frameworks/CoreServices.framework/Versions/Current/Frameworks/CarbonCore.framework/Versions/Current/Headers/"; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck = lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; meta = with lib; { description = "Multi-band distortion plugin by Wings"; diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index c5cc91c1268d1..9962e8c72fad2 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -407,6 +407,6 @@ mkDerivation (finalAttrs: { }; meta = meta // { - broken = withNativeCompilation && !(stdenv.buildPlatform.canExecute stdenv.hostPlatform); + broken = withNativeCompilation && !(lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform); }; }) diff --git a/pkgs/applications/misc/girara/default.nix b/pkgs/applications/misc/girara/default.nix index 389359e0cd079..ce0d1ece6dc79 100644 --- a/pkgs/applications/misc/girara/default.nix +++ b/pkgs/applications/misc/girara/default.nix @@ -59,7 +59,7 @@ stdenv.mkDerivation rec { mesonFlags = [ "-Ddocs=disabled" # docs do not seem to be installed - (lib.mesonEnable "tests" (stdenv.buildPlatform.canExecute stdenv.hostPlatform)) + (lib.mesonEnable "tests" (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform)) ]; checkPhase = '' diff --git a/pkgs/applications/misc/hugo/default.nix b/pkgs/applications/misc/hugo/default.nix index ef9be284b59d6..92e853f85da66 100644 --- a/pkgs/applications/misc/hugo/default.nix +++ b/pkgs/applications/misc/hugo/default.nix @@ -33,7 +33,7 @@ buildGoModule rec { ldflags = [ "-s" "-w" "-X github.com/gohugoio/hugo/common/hugo.vendorInfo=nixpkgs" ]; - postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in '' + postInstall = let emulator = lib.systems.emulator stdenv.hostPlatform buildPackages; in '' ${emulator} $out/bin/hugo gen man installManPage man/* installShellCompletion --cmd hugo \ diff --git a/pkgs/applications/misc/raider/default.nix b/pkgs/applications/misc/raider/default.nix index cf368fbe79dca..2ae24da84eca2 100644 --- a/pkgs/applications/misc/raider/default.nix +++ b/pkgs/applications/misc/raider/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { ninja pkg-config wrapGAppsHook4 - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/applications/networking/cluster/stern/default.nix b/pkgs/applications/networking/cluster/stern/default.nix index 02ceac61989a1..3112b8270f751 100644 --- a/pkgs/applications/networking/cluster/stern/default.nix +++ b/pkgs/applications/networking/cluster/stern/default.nix @@ -20,7 +20,7 @@ buildGoModule rec { ldflags = [ "-s" "-w" "-X github.com/stern/stern/cmd.version=${version}" ]; postInstall = let - stern = if stdenv.buildPlatform.canExecute stdenv.hostPlatform then "$out" else buildPackages.stern; + stern = if lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform then "$out" else buildPackages.stern; in '' for shell in bash zsh; do diff --git a/pkgs/applications/networking/cluster/weave-gitops/default.nix b/pkgs/applications/networking/cluster/weave-gitops/default.nix index 336d840eb58ca..64e0dac4d1544 100644 --- a/pkgs/applications/networking/cluster/weave-gitops/default.nix +++ b/pkgs/applications/networking/cluster/weave-gitops/default.nix @@ -19,7 +19,7 @@ buildGoModule rec { nativeBuildInputs = [ installShellFiles ]; - postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + postInstall = lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' installShellCompletion --cmd gitops \ --bash <($out/bin/gitops completion bash 2>/dev/null) \ --fish <($out/bin/gitops completion fish 2>/dev/null) \ diff --git a/pkgs/applications/networking/remote/freerdp/default.nix b/pkgs/applications/networking/remote/freerdp/default.nix index b159bd0a996ac..418e3ae6505fe 100644 --- a/pkgs/applications/networking/remote/freerdp/default.nix +++ b/pkgs/applications/networking/remote/freerdp/default.nix @@ -51,7 +51,7 @@ , withUnfree ? false # tries to compile and run generate_argument_docbook.c -, withManPages ? stdenv.buildPlatform.canExecute stdenv.hostPlatform +, withManPages ? lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform , buildPackages }: diff --git a/pkgs/applications/networking/sync/rclone/default.nix b/pkgs/applications/networking/sync/rclone/default.nix index 26343f6a76efc..011e7a0f1487f 100644 --- a/pkgs/applications/networking/sync/rclone/default.nix +++ b/pkgs/applications/networking/sync/rclone/default.nix @@ -31,7 +31,7 @@ buildGoModule rec { postInstall = let rcloneBin = - if stdenv.buildPlatform.canExecute stdenv.hostPlatform + if lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform then "$out" else lib.getBin buildPackages.rclone; in diff --git a/pkgs/applications/science/math/eigenmath/default.nix b/pkgs/applications/science/math/eigenmath/default.nix index 603a3c4f60bf9..564e59b49e1ac 100644 --- a/pkgs/applications/science/math/eigenmath/default.nix +++ b/pkgs/applications/science/math/eigenmath/default.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { hash = "sha256-roPyRaT89I3HbyvBK/owiigMus1EeKEhhKHFsgfzp10="; }; - checkPhase = let emulator = stdenv.hostPlatform.emulator buildPackages; in '' + checkPhase = let emulator = lib.systems.emulator stdenv.hostPlatform buildPackages; in '' runHook preCheck for testcase in selftest1 selftest2; do diff --git a/pkgs/applications/version-management/gh/default.nix b/pkgs/applications/version-management/gh/default.nix index cd3c6ce6dd139..d52129c25da22 100644 --- a/pkgs/applications/version-management/gh/default.nix +++ b/pkgs/applications/version-management/gh/default.nix @@ -17,14 +17,14 @@ buildGoModule rec { buildPhase = '' runHook preBuild - make GO_LDFLAGS="-s -w" GH_VERSION=${version} bin/gh ${lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) "manpages"} + make GO_LDFLAGS="-s -w" GH_VERSION=${version} bin/gh ${lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) "manpages"} runHook postBuild ''; installPhase = '' runHook preInstall install -Dm755 bin/gh -t $out/bin - '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + '' + lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' installManPage share/man/*/*.[1-9] installShellCompletion --cmd gh \ diff --git a/pkgs/applications/window-managers/wayfire/default.nix b/pkgs/applications/window-managers/wayfire/default.nix index c633b19abc709..08252ff23ee3f 100644 --- a/pkgs/applications/window-managers/wayfire/default.nix +++ b/pkgs/applications/window-managers/wayfire/default.nix @@ -78,7 +78,7 @@ stdenv.mkDerivation (finalAttrs: { "--sysconfdir /etc" "-Duse_system_wlroots=enabled" "-Duse_system_wfconfig=enabled" - (lib.mesonEnable "wf-touch:tests" (stdenv.buildPlatform.canExecute stdenv.hostPlatform)) + (lib.mesonEnable "wf-touch:tests" (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform)) ]; passthru.providedSessions = [ "wayfire" ]; diff --git a/pkgs/applications/window-managers/wayfire/wf-config.nix b/pkgs/applications/window-managers/wayfire/wf-config.nix index 0151ad66f4c48..f56800110a39e 100644 --- a/pkgs/applications/window-managers/wayfire/wf-config.nix +++ b/pkgs/applications/window-managers/wayfire/wf-config.nix @@ -45,7 +45,7 @@ stdenv.mkDerivation (finalAttrs: { dontUseCmakeConfigure = true; mesonFlags = [ - (lib.mesonEnable "tests" (stdenv.buildPlatform.canExecute stdenv.hostPlatform)) + (lib.mesonEnable "tests" (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform)) ]; doCheck = true; diff --git a/pkgs/desktops/gnome/core/gnome-bluetooth/default.nix b/pkgs/desktops/gnome/core/gnome-bluetooth/default.nix index 0e88bb20914e1..8380c1a759883 100644 --- a/pkgs/desktops/gnome/core/gnome-bluetooth/default.nix +++ b/pkgs/desktops/gnome/core/gnome-bluetooth/default.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { docbook-xsl-nons docbook_xml_dtd_43 python3 - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/desktops/gnome/core/gucharmap/default.nix b/pkgs/desktops/gnome/core/gucharmap/default.nix index 0b2484c7cb407..418983f323b38 100644 --- a/pkgs/desktops/gnome/core/gucharmap/default.nix +++ b/pkgs/desktops/gnome/core/gucharmap/default.nix @@ -74,7 +74,7 @@ in stdenv.mkDerivation rec { libxml2 desktop-file-utils gobject-introspection - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/desktops/gnome/gdk-pixbuf-cache-builder.nix b/pkgs/desktops/gnome/gdk-pixbuf-cache-builder.nix index 22359e9a5827e..fe3c700e92679 100644 --- a/pkgs/desktops/gnome/gdk-pixbuf-cache-builder.nix +++ b/pkgs/desktops/gnome/gdk-pixbuf-cache-builder.nix @@ -31,7 +31,7 @@ runCommand "gdk-pixbuf-loaders.cache" { exit 1 fi GDK_PIXBUF_MODULEDIR="$module_dir" \ - ${stdenv.hostPlatform.emulator buildPackages} ${gdk-pixbuf.dev}/bin/gdk-pixbuf-query-loaders + ${lib.systems.emulator stdenv.hostPlatform buildPackages} ${gdk-pixbuf.dev}/bin/gdk-pixbuf-query-loaders done ) > "$out" '' diff --git a/pkgs/development/compilers/dtc/default.nix b/pkgs/development/compilers/dtc/default.nix index d9013895becc2..eafcba87dff9b 100644 --- a/pkgs/development/compilers/dtc/default.nix +++ b/pkgs/development/compilers/dtc/default.nix @@ -94,7 +94,7 @@ stdenv.mkDerivation (finalAttrs: { # we must explicitly disable this here so that mesonFlags receives # `-Dtests=disabled`; without it meson will attempt to run # hostPlatform binaries during the configurePhase. - (with stdenv; buildPlatform.canExecute hostPlatform); + (with stdenv; lib.systems.canExecute buildPlatform hostPlatform); meta = with lib; { description = "Device Tree Compiler"; diff --git a/pkgs/development/compilers/llvm/15/clang/default.nix b/pkgs/development/compilers/llvm/15/clang/default.nix index 894db1a4975f6..0177cc8c362c4 100644 --- a/pkgs/development/compilers/llvm/15/clang/default.nix +++ b/pkgs/development/compilers/llvm/15/clang/default.nix @@ -36,7 +36,7 @@ let "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen" # Added in LLVM15: diff --git a/pkgs/development/compilers/llvm/git/clang/default.nix b/pkgs/development/compilers/llvm/git/clang/default.nix index 733f5462d320c..ca0201fe95000 100644 --- a/pkgs/development/compilers/llvm/git/clang/default.nix +++ b/pkgs/development/compilers/llvm/git/clang/default.nix @@ -36,7 +36,7 @@ let "-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_HTML=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF" - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen" "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen" # Added in LLVM15: diff --git a/pkgs/development/compilers/tinygo/default.nix b/pkgs/development/compilers/tinygo/default.nix index 5901ab7f9604c..7af78fc155aa4 100644 --- a/pkgs/development/compilers/tinygo/default.nix +++ b/pkgs/development/compilers/tinygo/default.nix @@ -78,7 +78,7 @@ buildGoModule rec { buildInputs = [ llvm clang.cc ] ++ lib.optionals stdenv.isDarwin [ zlib ncurses libffi libxml2 xar ]; - doCheck = (stdenv.buildPlatform.canExecute stdenv.hostPlatform); + doCheck = (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform); inherit tinygoTests; allowGoReference = true; diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index c39c934bed643..e22966fb9cbf5 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -620,7 +620,7 @@ in package-set { inherit pkgs lib callPackage; } self // { commands: pkg: - if stdenv.buildPlatform.canExecute stdenv.hostPlatform + if lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform then lib.foldr haskellLib.__generateOptparseApplicativeCompletion pkg commands else pkg ) { }; diff --git a/pkgs/development/libraries/accountsservice/default.nix b/pkgs/development/libraries/accountsservice/default.nix index 1a5f03f635bc2..7f73c1799cb03 100644 --- a/pkgs/development/libraries/accountsservice/default.nix +++ b/pkgs/development/libraries/accountsservice/default.nix @@ -60,7 +60,7 @@ stdenv.mkDerivation rec { pkg-config python3 vala - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ # meson.build:88:2: ERROR: Can not run test applications in this cross environment. mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/amtk/default.nix b/pkgs/development/libraries/amtk/default.nix index 86d5a038a3f2b..8d590850a279c 100644 --- a/pkgs/development/libraries/amtk/default.nix +++ b/pkgs/development/libraries/amtk/default.nix @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { gobject-introspection gtk-doc docbook-xsl-nons - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix index 78ca9cfddbadf..a642eac523958 100644 --- a/pkgs/development/libraries/appstream/default.nix +++ b/pkgs/development/libraries/appstream/default.nix @@ -69,7 +69,7 @@ stdenv.mkDerivation rec { itstool vala gperf - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/at-spi2-core/default.nix b/pkgs/development/libraries/at-spi2-core/default.nix index 2a47de8d5643f..b745fbbad9885 100644 --- a/pkgs/development/libraries/at-spi2-core/default.nix +++ b/pkgs/development/libraries/at-spi2-core/default.nix @@ -7,7 +7,7 @@ , pkg-config , gobject-introspection , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , gsettings-desktop-schemas , makeWrapper , dbus diff --git a/pkgs/development/libraries/audio/libopenmpt/default.nix b/pkgs/development/libraries/audio/libopenmpt/default.nix index b8b89abc8ea7f..dae1164e89d30 100644 --- a/pkgs/development/libraries/audio/libopenmpt/default.nix +++ b/pkgs/development/libraries/audio/libopenmpt/default.nix @@ -47,7 +47,7 @@ stdenv.mkDerivation rec { (lib.strings.withFeature usePulseAudio "pulseaudio") ]; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck = lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; postFixup = '' moveToOutput share/doc $dev diff --git a/pkgs/development/libraries/ftxui/default.nix b/pkgs/development/libraries/ftxui/default.nix index b49390c61c53d..88c8ef036dc34 100644 --- a/pkgs/development/libraries/ftxui/default.nix +++ b/pkgs/development/libraries/ftxui/default.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { "-DFTXUI_BUILD_TESTS=${if doCheck then "ON" else "OFF"}" ]; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck = lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; meta = with lib; { homepage = "https://github.com/ArthurSonzogni/FTXUI"; diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix index f77daec2ea6fb..5b99135a02a45 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -19,7 +19,7 @@ , lib , testers , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , gobject-introspection }: @@ -110,7 +110,7 @@ stdenv.mkDerivation (finalAttrs: { done '' + lib.optionalString withIntrospection '' # We need to install 'loaders.cache' in lib/gdk-pixbuf-2.0/2.10.0/ - ${stdenv.hostPlatform.emulator buildPackages} $dev/bin/gdk-pixbuf-query-loaders --update-cache + ${lib.systems.emulator stdenv.hostPlatform buildPackages} $dev/bin/gdk-pixbuf-query-loaders --update-cache ''; # The fixDarwinDylibNames hook doesn't patch binaries. diff --git a/pkgs/development/libraries/geoclue/default.nix b/pkgs/development/libraries/geoclue/default.nix index c2bf28d710452..61436f76bfb2e 100644 --- a/pkgs/development/libraries/geoclue/default.nix +++ b/pkgs/development/libraries/geoclue/default.nix @@ -56,7 +56,7 @@ stdenv.mkDerivation rec { gtk-doc docbook-xsl-nons docbook_xml_dtd_412 - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/geocode-glib/default.nix b/pkgs/development/libraries/geocode-glib/default.nix index ee619aad89ead..ae5562e758543 100644 --- a/pkgs/development/libraries/geocode-glib/default.nix +++ b/pkgs/development/libraries/geocode-glib/default.nix @@ -39,7 +39,7 @@ stdenv.mkDerivation rec { gtk-doc docbook-xsl-nons gobject-introspection - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/gexiv2/default.nix b/pkgs/development/libraries/gexiv2/default.nix index 4a346fdcffcd1..7c4cb3d79f74c 100644 --- a/pkgs/development/libraries/gexiv2/default.nix +++ b/pkgs/development/libraries/gexiv2/default.nix @@ -37,7 +37,7 @@ stdenv.mkDerivation rec { docbook-xsl-nons docbook_xml_dtd_43 (python3.pythonOnBuildForHost.withPackages (ps: [ ps.pygobject3 ])) - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/gjs/default.nix b/pkgs/development/libraries/gjs/default.nix index 55425c6aa7f2f..b0362449972c8 100644 --- a/pkgs/development/libraries/gjs/default.nix +++ b/pkgs/development/libraries/gjs/default.nix @@ -57,7 +57,7 @@ in stdenv.mkDerivation rec { libxml2 # for xml-stripblanks dbus # for dbus-run-session gobject-introspection - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix index be3bee081e73e..3b0a44a9d37ea 100644 --- a/pkgs/development/libraries/glibc/default.nix +++ b/pkgs/development/libraries/glibc/default.nix @@ -95,7 +95,7 @@ in "user-defined-trusted-dirs=${libgcc}/lib" ]; - postInstall = previousAttrs.postInstall + (if stdenv.buildPlatform.canExecute stdenv.hostPlatform then '' + postInstall = previousAttrs.postInstall + (if lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform then '' echo SUPPORTED-LOCALES=C.UTF-8/UTF-8 > ../glibc-2*/localedata/SUPPORTED make -j''${NIX_BUILD_CORES:-1} localedata/install-locales '' else lib.optionalString stdenv.buildPlatform.isLinux diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix index 7ba77c14d6c81..4cb630c44128c 100644 --- a/pkgs/development/libraries/gobject-introspection/default.nix +++ b/pkgs/development/libraries/gobject-introspection/default.nix @@ -99,7 +99,7 @@ stdenv.mkDerivation (finalAttrs: { "--datadir=${placeholder "dev"}/share" "-Dcairo=disabled" "-Dgtk_doc=${lib.boolToString (stdenv.hostPlatform == stdenv.buildPlatform)}" - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ "-Dgi_cross_ldd_wrapper=${substituteAll { name = "g-ir-scanner-lddwrapper"; isExecutable = true; @@ -107,7 +107,7 @@ stdenv.mkDerivation (finalAttrs: { inherit (buildPackages) bash; buildlddtree = "${buildPackages.pax-utils}/bin/lddtree"; }}" - "-Dgi_cross_binary_wrapper=${stdenv.hostPlatform.emulator buildPackages}" + "-Dgi_cross_binary_wrapper=${lib.systems.emulator stdenv.hostPlatform buildPackages}" # can't use canExecute, we need prebuilt when cross ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "-Dgi_cross_use_prebuilt_gi=true" diff --git a/pkgs/development/libraries/gobject-introspection/wrapper.nix b/pkgs/development/libraries/gobject-introspection/wrapper.nix index 53b1a35f82125..489de8ab98fd8 100644 --- a/pkgs/development/libraries/gobject-introspection/wrapper.nix +++ b/pkgs/development/libraries/gobject-introspection/wrapper.nix @@ -28,7 +28,7 @@ let in # wrap both pkgsCrossX.buildPackages.gobject-introspection and {pkgs,pkgsSomethingExecutableOnBuildSystem).buildPackages.gobject-introspection -if (!stdenv.hostPlatform.canExecute stdenv.targetPlatform) && stdenv.targetPlatform.emulatorAvailable buildPackages +if (!lib.systems.canExecute stdenv.hostPlatform stdenv.targetPlatform) && lib.systems.emulatorAvailable stdenv.targetPlatform buildPackages then overriddenUnwrappedGir.overrideAttrs (previousAttrs: @@ -54,7 +54,7 @@ then rm "$dev/bin/g-ir-compiler" rm "$dev/bin/g-ir-scanner" export bash="${buildPackages.bash}" - export emulator=${lib.escapeShellArg (stdenv.targetPlatform.emulator buildPackages)} + export emulator=${lib.escapeShellArg (lib.systems.emulator stdenv.targetPlatform buildPackages)} export emulatorwrapper="$dev/bin/g-ir-scanner-qemuwrapper" export buildlddtree="${buildPackages.pax-utils}/bin/lddtree" diff --git a/pkgs/development/libraries/graphene/default.nix b/pkgs/development/libraries/graphene/default.nix index 2972d5712cba3..646a063800b85 100644 --- a/pkgs/development/libraries/graphene/default.nix +++ b/pkgs/development/libraries/graphene/default.nix @@ -60,7 +60,7 @@ stdenv.mkDerivation rec { gobject-introspection python3 makeWrapper - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/grilo/default.nix b/pkgs/development/libraries/grilo/default.nix index 49c957cec5dc5..600a7db5d80dc 100644 --- a/pkgs/development/libraries/grilo/default.nix +++ b/pkgs/development/libraries/grilo/default.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { gtk-doc docbook-xsl-nons docbook_xml_dtd_43 - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix index 7534ea5d08aa1..34ad73c066d92 100644 --- a/pkgs/development/libraries/gsettings-desktop-schemas/default.nix +++ b/pkgs/development/libraries/gsettings-desktop-schemas/default.nix @@ -4,7 +4,7 @@ , glib , gobject-introspection , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , meson , ninja # just for passthru diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index 27afba7833e8a..6cc009daff261 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -23,8 +23,8 @@ , at-spi2-atk , gobject-introspection , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages -, compileSchemas ? stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages +, compileSchemas ? lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , fribidi , xorg , libepoxy @@ -111,7 +111,7 @@ stdenv.mkDerivation (finalAttrs: { gtk-doc # For xmllint libxml2 - ] ++ lib.optionals ((withIntrospection || compileSchemas) && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals ((withIntrospection || compileSchemas) && !(lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform)) [ mesonEmulatorHook ] ++ lib.optionals waylandSupport [ wayland-scanner diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix index 88f373dd4afad..cc0c160f1b9f3 100644 --- a/pkgs/development/libraries/harfbuzz/default.nix +++ b/pkgs/development/libraries/harfbuzz/default.nix @@ -11,7 +11,7 @@ , ninja , gobject-introspection , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , icu , graphite2 , harfbuzz # The icu variant uses and propagates the non-icu one. diff --git a/pkgs/development/libraries/json-glib/default.nix b/pkgs/development/libraries/json-glib/default.nix index 0ca03efca0258..fcc99f7db7959 100644 --- a/pkgs/development/libraries/json-glib/default.nix +++ b/pkgs/development/libraries/json-glib/default.nix @@ -7,7 +7,7 @@ , nixosTests , pkg-config , gettext -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , buildPackages , gobject-introspection , gi-docgen diff --git a/pkgs/development/libraries/libaccounts-glib/default.nix b/pkgs/development/libraries/libaccounts-glib/default.nix index e20ad1c954d15..40058b86dc90f 100644 --- a/pkgs/development/libraries/libaccounts-glib/default.nix +++ b/pkgs/development/libraries/libaccounts-glib/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { ninja pkg-config vala - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { ]; # TODO: send patch upstream to make running tests optional - postPatch = lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + postPatch = lib.optionalString (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' substituteInPlace meson.build \ --replace "subdir('tests')" "" ''; diff --git a/pkgs/development/libraries/libcloudproviders/default.nix b/pkgs/development/libraries/libcloudproviders/default.nix index 41a51f001451b..2f5e18921ce05 100644 --- a/pkgs/development/libraries/libcloudproviders/default.nix +++ b/pkgs/development/libraries/libcloudproviders/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { vala gtk-doc docbook_xsl - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/libdazzle/default.nix b/pkgs/development/libraries/libdazzle/default.nix index ec616b4a5fab4..abccbe8437c03 100644 --- a/pkgs/development/libraries/libdazzle/default.nix +++ b/pkgs/development/libraries/libdazzle/default.nix @@ -44,7 +44,7 @@ stdenv.mkDerivation rec { glib ] ++ lib.optionals stdenv.isLinux [ xvfb-run - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/libical/default.nix b/pkgs/development/libraries/libical/default.nix index 243c26af8e58d..e186d9aabb726 100644 --- a/pkgs/development/libraries/libical/default.nix +++ b/pkgs/development/libraries/libical/default.nix @@ -14,7 +14,7 @@ , python3 , tzdata , fixDarwinDylibNames -, withIntrospection ? stdenv.hostPlatform.emulatorAvailable pkgsBuildHost +, withIntrospection ? lib.systems.emulatorAvailable stdenv.hostPlatform pkgsBuildHost , gobject-introspection , vala }: diff --git a/pkgs/development/libraries/libmanette/default.nix b/pkgs/development/libraries/libmanette/default.nix index a9e18f4023207..7bfb497c978a6 100644 --- a/pkgs/development/libraries/libmanette/default.nix +++ b/pkgs/development/libraries/libmanette/default.nix @@ -7,7 +7,7 @@ , vala , gobject-introspection , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , gtk-doc , docbook-xsl-nons , docbook_xml_dtd_43 @@ -39,7 +39,7 @@ stdenv.mkDerivation rec { gtk-doc docbook-xsl-nons docbook_xml_dtd_43 - ] ++ lib.optionals (withIntrospection && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (withIntrospection && !lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/libmbim/default.nix b/pkgs/development/libraries/libmbim/default.nix index 9965771c1531a..f9c1e7317f93e 100644 --- a/pkgs/development/libraries/libmbim/default.nix +++ b/pkgs/development/libraries/libmbim/default.nix @@ -12,7 +12,7 @@ , bash-completion , bash , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , withDocs ? stdenv.hostPlatform == stdenv.buildPlatform , gobject-introspection }: diff --git a/pkgs/development/libraries/libmediaart/default.nix b/pkgs/development/libraries/libmediaart/default.nix index a68db1389ab5f..d09f93a9d1ec8 100644 --- a/pkgs/development/libraries/libmediaart/default.nix +++ b/pkgs/development/libraries/libmediaart/default.nix @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ meson ninja pkg-config vala gtk-doc docbook_xsl docbook_xml_dtd_412 gobject-introspection ] - ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/libmtp/default.nix b/pkgs/development/libraries/libmtp/default.nix index cd6820fdab06a..39068ea4a0e94 100644 --- a/pkgs/development/libraries/libmtp/default.nix +++ b/pkgs/development/libraries/libmtp/default.nix @@ -51,7 +51,7 @@ stdenv.mkDerivation rec { configurePlatforms = [ "build" "host" ]; - makeFlags = lib.optionals (stdenv.isLinux && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + makeFlags = lib.optionals (stdenv.isLinux && !lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ "MTP_HOTPLUG=${buildPackages.libmtp}/bin/mtp-hotplug" ]; diff --git a/pkgs/development/libraries/libnotify/default.nix b/pkgs/development/libraries/libnotify/default.nix index 589703f574c61..f37a057e028d1 100644 --- a/pkgs/development/libraries/libnotify/default.nix +++ b/pkgs/development/libraries/libnotify/default.nix @@ -9,7 +9,7 @@ , gdk-pixbuf , gnome , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , gobject-introspection }: diff --git a/pkgs/development/libraries/libptytty/default.nix b/pkgs/development/libraries/libptytty/default.nix index 3ed0cf6a39d0c..16e700193d6b0 100644 --- a/pkgs/development/libraries/libptytty/default.nix +++ b/pkgs/development/libraries/libptytty/default.nix @@ -5,7 +5,7 @@ }: let - isCross = !stdenv.buildPlatform.canExecute stdenv.hostPlatform; + isCross = !lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; isStatic = stdenv.hostPlatform.isStatic; isMusl = stdenv.hostPlatform.isMusl; in diff --git a/pkgs/development/libraries/libqmi/default.nix b/pkgs/development/libraries/libqmi/default.nix index 6f7583d563b10..04293e9bdee09 100644 --- a/pkgs/development/libraries/libqmi/default.nix +++ b/pkgs/development/libraries/libqmi/default.nix @@ -17,8 +17,8 @@ , libmbim , libqrtr-glib , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages -, withMan ? stdenv.buildPlatform.canExecute stdenv.hostPlatform +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages +, withMan ? lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform }: stdenv.mkDerivation rec { @@ -48,7 +48,7 @@ stdenv.mkDerivation rec { gtk-doc docbook-xsl-nons docbook_xml_dtd_43 - ] ++ lib.optionals (withIntrospection && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (withIntrospection && !lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/libqrtr-glib/default.nix b/pkgs/development/libraries/libqrtr-glib/default.nix index 9309c48a8c6a7..f655afd7b2cec 100644 --- a/pkgs/development/libraries/libqrtr-glib/default.nix +++ b/pkgs/development/libraries/libqrtr-glib/default.nix @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { gtk-doc docbook-xsl-nons docbook_xml_dtd_43 - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index 7ba6f1963e717..388e49d778a45 100644 --- a/pkgs/development/libraries/librsvg/default.nix +++ b/pkgs/development/libraries/librsvg/default.nix @@ -21,7 +21,7 @@ , gnome , vala , writeScript -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , buildPackages , gobject-introspection , _experimental-update-script-combinators @@ -110,7 +110,7 @@ stdenv.mkDerivation (finalAttrs: { doCheck = false; # all tests fail on libtool-generated rsvg-convert not being able to find coreutils GDK_PIXBUF_QUERYLOADERS = writeScript "gdk-pixbuf-loader-loaders-wrapped" '' - ${lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (stdenv.hostPlatform.emulator buildPackages)} ${lib.getDev gdk-pixbuf}/bin/gdk-pixbuf-query-loaders + ${lib.optionalString (lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages) (lib.systems.emulator stdenv.hostPlatform buildPackages)} ${lib.getDev gdk-pixbuf}/bin/gdk-pixbuf-query-loaders ''; # librsvg only links Foundation, but it also requiers libobjc. The Framework.tbd in the 11.0 SDK @@ -143,15 +143,15 @@ stdenv.mkDerivation (finalAttrs: { # 'error: linker `cc` not found' when cross-compiling export RUSTFLAGS="-Clinker=$CC" - '' + lib.optionalString ((stdenv.buildPlatform != stdenv.hostPlatform) && (stdenv.hostPlatform.emulatorAvailable buildPackages)) '' + '' + lib.optionalString ((stdenv.buildPlatform != stdenv.hostPlatform) && (lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages)) '' # the replacement is the native conditional substituteInPlace gdk-pixbuf-loader/Makefile \ --replace 'RUN_QUERY_LOADER_TEST = false' 'RUN_QUERY_LOADER_TEST = test -z "$(DESTDIR)"' \ ''; # Not generated when cross compiling. - postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in - lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' + postInstall = let emulator = lib.systems.emulator stdenv.hostPlatform buildPackages; in + lib.optionalString (lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages) '' # Merge gdkpixbuf and librsvg loaders cat ${lib.getLib gdk-pixbuf}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache $GDK_PIXBUF/loaders.cache > $GDK_PIXBUF/loaders.cache.tmp mv $GDK_PIXBUF/loaders.cache.tmp $GDK_PIXBUF/loaders.cache diff --git a/pkgs/development/libraries/libsecret/default.nix b/pkgs/development/libraries/libsecret/default.nix index 3dfb0c295b1f4..e458544aef726 100644 --- a/pkgs/development/libraries/libsecret/default.nix +++ b/pkgs/development/libraries/libsecret/default.nix @@ -13,7 +13,7 @@ , libgcrypt , gobject-introspection , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , vala , gi-docgen , gnome diff --git a/pkgs/development/libraries/libsoup/3.x.nix b/pkgs/development/libraries/libsoup/3.x.nix index ba4d1b0cd8a61..bfb1a23077f97 100644 --- a/pkgs/development/libraries/libsoup/3.x.nix +++ b/pkgs/development/libraries/libsoup/3.x.nix @@ -11,7 +11,7 @@ , glib-networking , buildPackages , gobject-introspection -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , vala , libpsl , python3 diff --git a/pkgs/development/libraries/libsoup/default.nix b/pkgs/development/libraries/libsoup/default.nix index 6d5b0183cddae..d91ea7a63dbb6 100644 --- a/pkgs/development/libraries/libsoup/default.nix +++ b/pkgs/development/libraries/libsoup/default.nix @@ -16,7 +16,7 @@ , sqlite , glib-networking , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages }: stdenv.mkDerivation rec { diff --git a/pkgs/development/libraries/libstemmer/default.nix b/pkgs/development/libraries/libstemmer/default.nix index 3f66ee92a72e5..5dea430f624a2 100644 --- a/pkgs/development/libraries/libstemmer/default.nix +++ b/pkgs/development/libraries/libstemmer/default.nix @@ -15,7 +15,7 @@ stdenv.mkDerivation rec { prePatch = '' patchShebangs . - '' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + '' + lib.optionalString (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' substituteInPlace GNUmakefile \ --replace './snowball' '${lib.getBin buildPackages.libstemmer}/bin/snowball' ''; diff --git a/pkgs/development/libraries/libvirt-glib/default.nix b/pkgs/development/libraries/libvirt-glib/default.nix index bb855ac767ee9..febebbbed5ad5 100644 --- a/pkgs/development/libraries/libvirt-glib/default.nix +++ b/pkgs/development/libraries/libvirt-glib/default.nix @@ -11,7 +11,7 @@ , libvirt , libxml2 , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , gobject-introspection , withDocs ? stdenv.hostPlatform == stdenv.buildPlatform , gtk-doc diff --git a/pkgs/development/libraries/libwnck/default.nix b/pkgs/development/libraries/libwnck/default.nix index 2f535930ed037..5e90049892d42 100644 --- a/pkgs/development/libraries/libwnck/default.nix +++ b/pkgs/development/libraries/libwnck/default.nix @@ -51,7 +51,7 @@ stdenv.mkDerivation rec { gtk-doc docbook_xsl docbook_xml_dtd_412 - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix index 3d866a9229548..df88f4727b1ad 100644 --- a/pkgs/development/libraries/pango/default.nix +++ b/pkgs/development/libraries/pango/default.nix @@ -17,7 +17,7 @@ , glib , python3 , x11Support? !stdenv.isDarwin, libXft -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , buildPackages, gobject-introspection }: diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix index 80badcdd4dbde..9c673d18f6bf0 100644 --- a/pkgs/development/libraries/polkit/default.nix +++ b/pkgs/development/libraries/polkit/default.nix @@ -25,7 +25,7 @@ , systemdMinimal , elogind , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages # A few tests currently fail on musl (polkitunixusertest, polkitunixgrouptest, polkitidentitytest segfault). # Not yet investigated; it may be due to the "Make netgroup support optional" # patch not updating the tests correctly yet, or doing something wrong, @@ -81,7 +81,7 @@ stdenv.mkDerivation rec { ] ++ lib.optionals withIntrospection [ gobject-introspection gtk-doc - ] ++ lib.optionals (withIntrospection && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (withIntrospection && !lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/science/math/liblapack/default.nix b/pkgs/development/libraries/science/math/liblapack/default.nix index 3bf16057f835f..b92e9c1041d1f 100644 --- a/pkgs/development/libraries/science/math/liblapack/default.nix +++ b/pkgs/development/libraries/science/math/liblapack/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation (finalAttrs: { # Tries to run host platform binaries during the build # Will likely be disabled by default in 3.12, see: # https://github.com/Reference-LAPACK/lapack/issues/757 - ++ lib.optional (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) "-DTEST_FORTRAN_COMPILER=OFF"; + ++ lib.optional (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) "-DTEST_FORTRAN_COMPILER=OFF"; passthru = { inherit blas64; }; diff --git a/pkgs/development/libraries/tepl/default.nix b/pkgs/development/libraries/tepl/default.nix index 796810ade97ae..b7f8b190db332 100644 --- a/pkgs/development/libraries/tepl/default.nix +++ b/pkgs/development/libraries/tepl/default.nix @@ -33,7 +33,7 @@ stdenv.mkDerivation rec { pkg-config gtk-doc docbook-xsl-nons - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/tracker/default.nix b/pkgs/development/libraries/tracker/default.nix index c8c220927fa48..af76e77717ad8 100644 --- a/pkgs/development/libraries/tracker/default.nix +++ b/pkgs/development/libraries/tracker/default.nix @@ -10,7 +10,7 @@ , asciidoc , gobject-introspection , buildPackages -, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages +, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages , vala , python3 , gi-docgen diff --git a/pkgs/development/libraries/uhttpmock/default.nix b/pkgs/development/libraries/uhttpmock/default.nix index d22ff81c2530a..a499c41556c7f 100644 --- a/pkgs/development/libraries/uhttpmock/default.nix +++ b/pkgs/development/libraries/uhttpmock/default.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { vala gtk-doc docbook-xsl-nons - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/umockdev/default.nix b/pkgs/development/libraries/umockdev/default.nix index 1cae2c62b33c0..ba08df20bd43f 100644 --- a/pkgs/development/libraries/umockdev/default.nix +++ b/pkgs/development/libraries/umockdev/default.nix @@ -43,7 +43,7 @@ stdenv.mkDerivation (finalAttrs: { ninja pkg-config vala - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/development/libraries/yaml-cpp/0.3.0.nix b/pkgs/development/libraries/yaml-cpp/0.3.0.nix index fad3397b74b6f..66e03d84b1eb5 100644 --- a/pkgs/development/libraries/yaml-cpp/0.3.0.nix +++ b/pkgs/development/libraries/yaml-cpp/0.3.0.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { "-DBUILD_SHARED_LIBS=${lib.boolToString (!stdenv.hostPlatform.isStatic)}" ]; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck = lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; meta = with lib; { description = "A YAML parser and emitter for C++"; diff --git a/pkgs/development/libraries/yaml-cpp/default.nix b/pkgs/development/libraries/yaml-cpp/default.nix index 20d546e346b8f..1b01e32e983d0 100644 --- a/pkgs/development/libraries/yaml-cpp/default.nix +++ b/pkgs/development/libraries/yaml-cpp/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { "-DINSTALL_GTEST=false" ]; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck = lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; passthru.updateScript = gitUpdater { }; diff --git a/pkgs/development/python-modules/twisted/default.nix b/pkgs/development/python-modules/twisted/default.nix index 801adb77da376..d0730b290a76c 100644 --- a/pkgs/development/python-modules/twisted/default.nix +++ b/pkgs/development/python-modules/twisted/default.nix @@ -148,7 +148,7 @@ buildPythonPackage rec { # Generate Twisted's plug-in cache. Twisted users must do it as well. See # http://twistedmatrix.com/documents/current/core/howto/plugin.html#auto3 # and http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477103 for details. - postFixup = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + postFixup = lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' $out/bin/twistd --help > /dev/null ''; diff --git a/pkgs/development/tools/continuous-integration/fly/default.nix b/pkgs/development/tools/continuous-integration/fly/default.nix index 55df9269f9270..b38591c6d0037 100644 --- a/pkgs/development/tools/continuous-integration/fly/default.nix +++ b/pkgs/development/tools/continuous-integration/fly/default.nix @@ -23,7 +23,7 @@ buildGoModule rec { doCheck = false; - postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + postInstall = lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' installShellCompletion --cmd fly \ --bash <($out/bin/fly completion --shell bash) \ --fish <($out/bin/fly completion --shell fish) \ diff --git a/pkgs/development/tools/doctl/default.nix b/pkgs/development/tools/doctl/default.nix index 074d4f54745eb..8874ffbcf77f7 100644 --- a/pkgs/development/tools/doctl/default.nix +++ b/pkgs/development/tools/doctl/default.nix @@ -22,7 +22,7 @@ buildGoModule rec { postInstall = '' export HOME=$(mktemp -d) # attempts to write to /homeless-shelter for shell in bash fish zsh; do - ${stdenv.hostPlatform.emulator buildPackages} $out/bin/doctl completion $shell > doctl.$shell + ${lib.systems.emulator stdenv.hostPlatform buildPackages} $out/bin/doctl completion $shell > doctl.$shell installShellCompletion doctl.$shell done ''; diff --git a/pkgs/development/tools/misc/luarocks/default.nix b/pkgs/development/tools/misc/luarocks/default.nix index c8d36a1e33131..462488d32770b 100644 --- a/pkgs/development/tools/misc/luarocks/default.nix +++ b/pkgs/development/tools/misc/luarocks/default.nix @@ -79,7 +79,7 @@ stdenv.mkDerivation (finalAttrs: { lib.optionals (finalAttrs.pname == "luarocks-nix") [ file nix-prefetch-git ])} } done - '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + '' + lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' installShellCompletion --cmd luarocks \ --bash <($out/bin/luarocks completion bash) \ --fish <($out/bin/luarocks completion fish) \ diff --git a/pkgs/development/tools/misc/planus/default.nix b/pkgs/development/tools/misc/planus/default.nix index 9074debb26336..a204597778983 100644 --- a/pkgs/development/tools/misc/planus/default.nix +++ b/pkgs/development/tools/misc/planus/default.nix @@ -21,7 +21,7 @@ rustPlatform.buildRustPackage rec { installShellFiles ]; - postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + postInstall = lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' installShellCompletion --cmd planus \ --bash <($out/bin/planus generate-completions bash) \ --fish <($out/bin/planus generate-completions fish) \ diff --git a/pkgs/development/tools/misc/runme/default.nix b/pkgs/development/tools/misc/runme/default.nix index 3795476c3e163..e70beae62fe36 100644 --- a/pkgs/development/tools/misc/runme/default.nix +++ b/pkgs/development/tools/misc/runme/default.nix @@ -54,7 +54,7 @@ buildGo121Module rec { unset ldflags ''; - postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + postInstall = lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' installShellCompletion --cmd runme \ --bash <($out/bin/runme completion bash) \ --fish <($out/bin/runme completion fish) \ diff --git a/pkgs/development/tools/misc/typical/default.nix b/pkgs/development/tools/misc/typical/default.nix index 7944f14ca4d6d..c684bd989834f 100644 --- a/pkgs/development/tools/misc/typical/default.nix +++ b/pkgs/development/tools/misc/typical/default.nix @@ -26,7 +26,7 @@ rustPlatform.buildRustPackage rec { export NO_COLOR=true ''; - postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + postInstall = lib.optionalString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' installShellCompletion --cmd typical \ --bash <($out/bin/typical shell-completion bash) \ --fish <($out/bin/typical shell-completion fish) \ diff --git a/pkgs/os-specific/linux/power-profiles-daemon/default.nix b/pkgs/os-specific/linux/power-profiles-daemon/default.nix index e81f42b65a23e..2ea4f07225b65 100644 --- a/pkgs/os-specific/linux/power-profiles-daemon/default.nix +++ b/pkgs/os-specific/linux/power-profiles-daemon/default.nix @@ -58,7 +58,7 @@ stdenv.mkDerivation rec { dbus-python python-dbusmock ])) - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; @@ -88,7 +88,7 @@ stdenv.mkDerivation rec { mesonFlags = [ "-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system" "-Dgtk_doc=true" - "-Dtests=${lib.boolToString (stdenv.buildPlatform.canExecute stdenv.hostPlatform)}" + "-Dtests=${lib.boolToString (lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform)}" ]; doCheck = true; diff --git a/pkgs/servers/dante/default.nix b/pkgs/servers/dante/default.nix index 1d15bddc09f7e..fcd47393dd7af 100644 --- a/pkgs/servers/dante/default.nix +++ b/pkgs/servers/dante/default.nix @@ -2,7 +2,7 @@ , pam, libkrb5, cyrus_sasl, miniupnpc, libxcrypt }: let - remove_getaddrinfo_checks = stdenv.hostPlatform.isMips64 || !(stdenv.buildPlatform.canExecute stdenv.hostPlatform); + remove_getaddrinfo_checks = stdenv.hostPlatform.isMips64 || !(lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform); in stdenv.mkDerivation rec { pname = "dante"; diff --git a/pkgs/servers/mir/default.nix b/pkgs/servers/mir/default.nix index 078125016bf0e..2fdbd91564b25 100644 --- a/pkgs/servers/mir/default.nix +++ b/pkgs/servers/mir/default.nix @@ -152,7 +152,7 @@ stdenv.mkDerivation (finalAttrs: { "-DMIR_BUILD_PLATFORM_TEST_HARNESS=OFF" ]; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck = lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; preCheck = '' # Needs to be exactly /tmp so some failing tests don't get run, don't know why they fail yet diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix index ea50fc371981e..ae4780767adad 100644 --- a/pkgs/servers/sql/mariadb/default.nix +++ b/pkgs/servers/sql/mariadb/default.nix @@ -105,7 +105,7 @@ let ] ++ lib.optionals isCross [ # revisit this if nixpkgs supports any architecture whose stack grows upwards "-DSTACK_DIRECTION=-1" - "-DCMAKE_CROSSCOMPILING_EMULATOR=${stdenv.hostPlatform.emulator buildPackages}" + "-DCMAKE_CROSSCOMPILING_EMULATOR=${lib.systems.emulator stdenv.hostPlatform buildPackages}" ]; postInstall = lib.optionalString (!withEmbedded) '' diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 63d02c8f08570..7ead45e500864 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -37,6 +37,7 @@ let remove splitString subtractLists + systems unique ; @@ -216,8 +217,8 @@ assert attrs ? outputHash -> ( let # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when # no package has `doCheck = true`. - doCheck' = doCheck && stdenv.buildPlatform.canExecute stdenv.hostPlatform; - doInstallCheck' = doInstallCheck && stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck' = doCheck && lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; + doInstallCheck' = doInstallCheck && lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux; outputs' = outputs ++ optional separateDebugInfo' "debug"; @@ -425,7 +426,7 @@ else let "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}" ] ++ optionals (stdenv.buildPlatform.uname.release != null) [ "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}" - ] ++ optionals (stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ optionals (systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ "-DCMAKE_CROSSCOMPILING_EMULATOR=env" ]); @@ -440,7 +441,7 @@ else let crossFile = builtins.toFile "cross-file.conf" '' [properties] bindgen_clang_arguments = ['-target', '${stdenv.targetPlatform.config}'] - needs_exe_wrapper = ${boolToString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)} + needs_exe_wrapper = ${lib.boolToString (!systems.canExecute stdenv.buildPlatform stdenv.hostPlatform)} [host_machine] system = '${stdenv.targetPlatform.parsed.kernel.name}' diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 35cdb6311df32..e45e620009807 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -85,7 +85,7 @@ # compatible with or current architecture. getCompatibleTools = lib.foldl (v: system: if v != null then v - else if localSystem.canExecute (lib.systems.elaborate { inherit system; }) then archLookupTable.${system} + else if lib.systems.canExecute localSystem (lib.systems.elaborate { inherit system; }) then archLookupTable.${system} else null) null (lib.attrNames archLookupTable); archLookupTable = table.${localSystem.libc} diff --git a/pkgs/test/cc-wrapper/default.nix b/pkgs/test/cc-wrapper/default.nix index a0088751d4a24..1cce9716abb8b 100644 --- a/pkgs/test/cc-wrapper/default.nix +++ b/pkgs/test/cc-wrapper/default.nix @@ -8,7 +8,7 @@ let || (stdenv.cc.isGNU && stdenv.isLinux) ); staticLibc = lib.optionalString (stdenv.hostPlatform.libc == "glibc") "-L ${glibc.static}/lib"; - emulator = stdenv.hostPlatform.emulator buildPackages; + emulator = lib.systems.emulator stdenv.hostPlatform buildPackages; isCxx = stdenv.cc.libcxx != null; libcxxStdenvSuffix = lib.optionalString isCxx "-libcxx"; in stdenv.mkDerivation { diff --git a/pkgs/test/cross/default.nix b/pkgs/test/cross/default.nix index 71d7d5f75ef01..261e0992e703a 100644 --- a/pkgs/test/cross/default.nix +++ b/pkgs/test/cross/default.nix @@ -59,7 +59,7 @@ let crossSystem = crossSystemFun system; }; - emulator = crossPkgs.stdenv.hostPlatform.emulator pkgs; + emulator = lib.systems.emulator crossPkgs.hostPlatform pkgs; # Apply some transformation on windows to get dlls in the right # place. Unfortunately mingw doesn’t seem to be able to do linking diff --git a/pkgs/tools/graphics/gnuplot/default.nix b/pkgs/tools/graphics/gnuplot/default.nix index f0fa45e59e4d9..535de1819ba3b 100644 --- a/pkgs/tools/graphics/gnuplot/default.nix +++ b/pkgs/tools/graphics/gnuplot/default.nix @@ -68,7 +68,7 @@ in # When cross-compiling, don't build docs and demos. # Inspiration taken from https://sourceforge.net/p/gnuplot/gnuplot-main/merge-requests/10/ - makeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + makeFlags = lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ "-C src" ]; diff --git a/pkgs/tools/misc/broot/default.nix b/pkgs/tools/misc/broot/default.nix index de0fd1a115598..87ae33a145f18 100644 --- a/pkgs/tools/misc/broot/default.nix +++ b/pkgs/tools/misc/broot/default.nix @@ -48,17 +48,17 @@ rustPlatform.buildRustPackage rec { --replace "#version" "${version}" ''; - postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) '' + postInstall = lib.optionalString (lib.systems.emulatorAvailable stdenv.hostPlatform buildPackages) '' # Install shell function for bash. - ${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function bash > br.bash + ${lib.systems.emulator stdenv.hostPlatform buildPackages} $out/bin/broot --print-shell-function bash > br.bash install -Dm0444 -t $out/etc/profile.d br.bash # Install shell function for zsh. - ${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function zsh > br.zsh + ${lib.systems.emulator stdenv.hostPlatform buildPackages} $out/bin/broot --print-shell-function zsh > br.zsh install -Dm0444 br.zsh $out/share/zsh/site-functions/br # Install shell function for fish - ${stdenv.hostPlatform.emulator buildPackages} $out/bin/broot --print-shell-function fish > br.fish + ${lib.systems.emulator stdenv.hostPlatform buildPackages} $out/bin/broot --print-shell-function fish > br.fish install -Dm0444 -t $out/share/fish/vendor_functions.d br.fish '' + '' diff --git a/pkgs/tools/misc/colord/default.nix b/pkgs/tools/misc/colord/default.nix index 2a4c2c0016689..3ac6e068fcb78 100644 --- a/pkgs/tools/misc/colord/default.nix +++ b/pkgs/tools/misc/colord/default.nix @@ -76,7 +76,7 @@ stdenv.mkDerivation rec { shared-mime-info vala wrapGAppsNoGuiHook - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/tools/misc/goreleaser/default.nix b/pkgs/tools/misc/goreleaser/default.nix index d5ab9a94b84bf..113e655d65e43 100644 --- a/pkgs/tools/misc/goreleaser/default.nix +++ b/pkgs/tools/misc/goreleaser/default.nix @@ -29,7 +29,7 @@ buildGoModule rec { nativeBuildInputs = [ installShellFiles ]; postInstall = - let emulator = stdenv.hostPlatform.emulator buildPackages; + let emulator = lib.systems.emulator stdenv.hostPlatform buildPackages; in '' ${emulator} $out/bin/goreleaser man > goreleaser.1 installManPage ./goreleaser.1 diff --git a/pkgs/tools/misc/rpcsvc-proto/default.nix b/pkgs/tools/misc/rpcsvc-proto/default.nix index b84bbb7d9d511..bebe6f214d2dc 100644 --- a/pkgs/tools/misc/rpcsvc-proto/default.nix +++ b/pkgs/tools/misc/rpcsvc-proto/default.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { substituteInPlace rpcgen/rpc_main.c \ --replace 'CPP = "cpp"' \ 'CPP = "${targetPackages.stdenv.cc.targetPrefix}cpp"' - '' + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + '' + lib.optionalString (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' substituteInPlace rpcsvc/Makefile.am \ --replace '$(top_builddir)/rpcgen/rpcgen' '${buildPackages.rpcsvc-proto}/bin/rpcgen' ''; diff --git a/pkgs/tools/networking/networkmanager/default.nix b/pkgs/tools/networking/networkmanager/default.nix index 5490977df12d0..09700e1f6859a 100644 --- a/pkgs/tools/networking/networkmanager/default.nix +++ b/pkgs/tools/networking/networkmanager/default.nix @@ -168,7 +168,7 @@ stdenv.mkDerivation rec { docbook_xml_dtd_42 docbook_xml_dtd_43 pythonForDocs - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/tools/networking/networkmanager/libnma/default.nix b/pkgs/tools/networking/networkmanager/libnma/default.nix index a47b23e9634c2..0d2c86745b3d4 100644 --- a/pkgs/tools/networking/networkmanager/libnma/default.nix +++ b/pkgs/tools/networking/networkmanager/libnma/default.nix @@ -53,7 +53,7 @@ stdenv.mkDerivation rec { docbook_xml_dtd_43 libxml2 vala - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) [ mesonEmulatorHook ]; diff --git a/pkgs/tools/networking/sing-box/default.nix b/pkgs/tools/networking/sing-box/default.nix index 0d75f874a1987..22b06e564a7db 100644 --- a/pkgs/tools/networking/sing-box/default.nix +++ b/pkgs/tools/networking/sing-box/default.nix @@ -46,7 +46,7 @@ buildGoModule rec { "-X=github.com/sagernet/sing-box/constant.Version=${version}" ]; - postInstall = let emulator = stdenv.hostPlatform.emulator buildPackages; in '' + postInstall = let emulator = lib.systems.emulator stdenv.hostPlatform buildPackages; in '' installShellCompletion --cmd sing-box \ --bash <(${emulator} $out/bin/sing-box completion bash) \ --fish <(${emulator} $out/bin/sing-box completion fish) \ diff --git a/pkgs/tools/package-management/nfpm/default.nix b/pkgs/tools/package-management/nfpm/default.nix index 9d04dd026404a..e8cc4c47fd056 100644 --- a/pkgs/tools/package-management/nfpm/default.nix +++ b/pkgs/tools/package-management/nfpm/default.nix @@ -24,7 +24,7 @@ buildGoModule rec { nativeBuildInputs = [ installShellFiles ]; postInstall = - let emulator = stdenv.hostPlatform.emulator buildPackages; + let emulator = lib.systems.emulator stdenv.hostPlatform buildPackages; in '' ${emulator} $out/bin/nfpm man > nfpm.1 installManPage ./nfpm.1 diff --git a/pkgs/tools/security/browserpass/default.nix b/pkgs/tools/security/browserpass/default.nix index 73c40a718c285..f0fab148cb4b8 100644 --- a/pkgs/tools/security/browserpass/default.nix +++ b/pkgs/tools/security/browserpass/default.nix @@ -24,7 +24,7 @@ buildGoModule rec { vendorHash = "sha256-CjuH4ANP2bJDeA+o+1j+obbtk5/NVLet/OFS3Rms4r0="; - doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + doCheck = lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform; postPatch = '' # Because this Makefile will be installed to be used by the user, patch diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix index 2d7f859c809cd..74acbb6cc53e1 100644 --- a/pkgs/tools/typesetting/tex/texlive/bin.nix +++ b/pkgs/tools/typesetting/tex/texlive/bin.nix @@ -61,7 +61,7 @@ let '' + # when cross compiling, we must use himktables from PATH # (i.e. from buildPackages.texlive.bin.core.dev) - lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + lib.optionalString (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) '' sed -i 's|\./himktables|himktables|' texk/web2c/Makefile.in '' ; @@ -128,7 +128,7 @@ core = stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config - ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) (with texlive.bin.core; [ + ] ++ lib.optionals (!lib.systems.canExecute stdenv.buildPlatform stdenv.hostPlatform) (with texlive.bin.core; [ # configure: error: tangle was not found but is required when cross-compiling. # dev (himktables) is used when building hitex to generate the additional source file hitables.c web/*tangle*/ cweb/*ctangle*/ omegaware/*otangle*/ tie/*tie*/ # see "Building TeX Live" 6.4.2 Cross problems diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3712806cf012a..8e4397d57ab60 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5999,7 +5999,7 @@ with pkgs; # The throw is moved into the `makeSetupHook` derivation, so that its # outer level, but not its outPath can still be evaluated if the condition # doesn't hold. This ensures that splicing still can work correctly. - (if (!stdenv.hostPlatform.canExecute stdenv.targetPlatform) then + (if (!lib.systems.canExecute stdenv.buildPlatform stdenv.targetPlatform) then ../by-name/me/meson/emulator-hook.sh else throw "mesonEmulatorHook may only be added to nativeBuildInputs when the target binaries can't be executed; however you are attempting to use it in a situation where ${stdenv.hostPlatform.config} can execute ${stdenv.targetPlatform.config}. Consider only adding mesonEmulatorHook according to a conditional based canExecute in your package expression."); diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index 3c6feba6b812f..d6574ae5b0f11 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -244,7 +244,7 @@ in in lib.mapAttrsRecursiveCond (as: !lib.isDerivation as) (name: mkBootstrapToolsJob) # The `bootstrapTools.${platform}.bootstrapTools` derivation # *unpacks* the bootstrap-files using their own `busybox` binary, - # so it will fail unless buildPlatform.canExecute hostPlatform. + # so it will fail unless `lib.systems.canExecute buildPlatform hostPlatform`. # Unfortunately `bootstrapTools` also clobbers its own `system` # attribute, so there is no way to detect this -- we must add it # as a special case. We filter the "test" attribute (only from