From e0464e47880a69896f0fb1810f00e0de469f770a Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 24 Sep 2024 18:50:49 +0300 Subject: treewide: replace `stdenv.is` with `stdenv.hostPlatform.is` In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ``` --- pkgs/development/perl-modules/ImageExifTool/default.nix | 4 ++-- pkgs/development/perl-modules/WWW-YoutubeViewer/default.nix | 4 ++-- pkgs/development/perl-modules/strip-nondeterminism/default.nix | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'pkgs/development/perl-modules') diff --git a/pkgs/development/perl-modules/ImageExifTool/default.nix b/pkgs/development/perl-modules/ImageExifTool/default.nix index 08d207e3bbac..46efb33f23ca 100644 --- a/pkgs/development/perl-modules/ImageExifTool/default.nix +++ b/pkgs/development/perl-modules/ImageExifTool/default.nix @@ -18,9 +18,9 @@ buildPerlPackage rec { hash = "sha256-sfSnx5bS7vI0KIhBOpB5VYzP6g8oi0rR7mUTxxNWEA0="; }; - nativeBuildInputs = lib.optional stdenv.isDarwin shortenPerlShebang; + nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin shortenPerlShebang; - postInstall = lib.optionalString stdenv.isDarwin '' + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' shortenPerlShebang $out/bin/exiftool ''; diff --git a/pkgs/development/perl-modules/WWW-YoutubeViewer/default.nix b/pkgs/development/perl-modules/WWW-YoutubeViewer/default.nix index cba9ef986362..0669f5b7c7af 100644 --- a/pkgs/development/perl-modules/WWW-YoutubeViewer/default.nix +++ b/pkgs/development/perl-modules/WWW-YoutubeViewer/default.nix @@ -22,14 +22,14 @@ buildPerlPackage rec { sha256 = "9Z4fv2B0AnwtYsp7h9phnRMmHtBOMObIJvK8DmKQRxs="; }; - nativeBuildInputs = lib.optional stdenv.isDarwin shortenPerlShebang; + nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin shortenPerlShebang; propagatedBuildInputs = [ LWP LWPProtocolHttps DataDump JSON ]; - postInstall = lib.optionalString stdenv.isDarwin '' + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' shortenPerlShebang $out/bin/youtube-viewer ''; diff --git a/pkgs/development/perl-modules/strip-nondeterminism/default.nix b/pkgs/development/perl-modules/strip-nondeterminism/default.nix index e50d61b87898..fe6328ea3946 100644 --- a/pkgs/development/perl-modules/strip-nondeterminism/default.nix +++ b/pkgs/development/perl-modules/strip-nondeterminism/default.nix @@ -24,7 +24,7 @@ buildPerlPackage rec { }; strictDeps = true; - nativeBuildInputs = lib.optionals stdenv.isDarwin [ shortenPerlShebang ]; + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ shortenPerlShebang ]; buildInputs = [ ArchiveZip ArchiveCpio @@ -45,7 +45,7 @@ buildPerlPackage rec { # we don’t need the debhelper script rm $out/bin/dh_strip_nondeterminism rm $out/share/man/man1/dh_strip_nondeterminism.1 - '' + lib.optionalString stdenv.isDarwin '' + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' shortenPerlShebang $out/bin/strip-nondeterminism ''; @@ -56,7 +56,7 @@ buildPerlPackage rec { ''; # running shortenPerlShebang in postBuild results in non-functioning binary 'exec format error' - doCheck = !stdenv.isDarwin; + doCheck = !stdenv.hostPlatform.isDarwin; doInstallCheck = true; meta = with lib; { -- cgit 1.4.1