From 40799fc06d3ec4c2d7f6cd4953d09c8af0b4be3d Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 25 Sep 2024 06:33:31 +0300 Subject: [PATCH 1/3] treewide: replace `stdenv.is` in non nix files Continuing e0464e47880a69896f0fb1810f00e0de469f770a --- CONTRIBUTING.md | 4 ++-- doc/languages-frameworks/beam.section.md | 4 ++-- doc/languages-frameworks/emscripten.section.md | 2 +- doc/languages-frameworks/perl.section.md | 4 ++-- doc/languages-frameworks/python.section.md | 2 +- doc/stdenv/platform-notes.chapter.md | 2 +- pkgs/applications/networking/browsers/brave/update.sh | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b09cbaba14cd..f3c3cfe611d2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -637,7 +637,7 @@ Names of files and directories should be in lowercase, with dashes between words ```nix { - buildInputs = lib.optional stdenv.isDarwin iconv; + buildInputs = lib.optional stdenv.hostPlatform.isDarwin iconv; } ``` @@ -645,7 +645,7 @@ Names of files and directories should be in lowercase, with dashes between words ```nix { - buildInputs = if stdenv.isDarwin then [ iconv ] else null; + buildInputs = if stdenv.hostPlatform.isDarwin then [ iconv ] else null; } ``` diff --git a/doc/languages-frameworks/beam.section.md b/doc/languages-frameworks/beam.section.md index 3653cdb337d1..2aac65900b9a 100644 --- a/doc/languages-frameworks/beam.section.md +++ b/doc/languages-frameworks/beam.section.md @@ -349,8 +349,8 @@ let nodePackages.prettier ]; - inputs = basePackages ++ lib.optionals stdenv.isLinux [ inotify-tools ] - ++ lib.optionals stdenv.isDarwin + inputs = basePackages ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify-tools ] + ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]); # define shell startup command diff --git a/doc/languages-frameworks/emscripten.section.md b/doc/languages-frameworks/emscripten.section.md index 9ce48db2c2de..d1ed62d0503f 100644 --- a/doc/languages-frameworks/emscripten.section.md +++ b/doc/languages-frameworks/emscripten.section.md @@ -84,7 +84,7 @@ One advantage is that when `pkgs.zlib` is updated, it will automatically update echo "================= /testing zlib using node =================" ''; - postPatch = pkgs.lib.optionalString pkgs.stdenv.isDarwin '' + postPatch = pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isDarwin '' substituteInPlace configure \ --replace-fail '/usr/bin/libtool' 'ar' \ --replace-fail 'AR="libtool"' 'AR="ar"' \ diff --git a/doc/languages-frameworks/perl.section.md b/doc/languages-frameworks/perl.section.md index a3d76a44f656..843d46584cdd 100644 --- a/doc/languages-frameworks/perl.section.md +++ b/doc/languages-frameworks/perl.section.md @@ -125,8 +125,8 @@ On Darwin, if a script has too many `-Idir` flags in its first line (its “sheb hash = "sha256-vOhB/FwQMC8PPvdnjDvxRpU6jAZcC6GMQfc0AH4uwKg="; }; - nativeBuildInputs = lib.optional stdenv.isDarwin shortenPerlShebang; - postInstall = lib.optionalString stdenv.isDarwin '' + nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin shortenPerlShebang; + postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' shortenPerlShebang $out/bin/exiftool ''; }; diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 77828110cc4f..946971e405d9 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1306,7 +1306,7 @@ for example: ] ++ lib.optionals (pythonAtLeast "3.8") [ # broken due to python3.8 async changes "async" - ] ++ lib.optionals stdenv.isDarwin [ + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # can fail when building with other packages "socket" ]; diff --git a/doc/stdenv/platform-notes.chapter.md b/doc/stdenv/platform-notes.chapter.md index 409c9f2e7b2e..9b0fdd149f9a 100644 --- a/doc/stdenv/platform-notes.chapter.md +++ b/doc/stdenv/platform-notes.chapter.md @@ -22,7 +22,7 @@ Some common issues when packaging software for Darwin: stdenv.mkDerivation { name = "libfoo-1.2.3"; # ... - makeFlags = lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/libfoo.dylib"; + makeFlags = lib.optional stdenv.hostPlatform.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/libfoo.dylib"; } ``` diff --git a/pkgs/applications/networking/browsers/brave/update.sh b/pkgs/applications/networking/browsers/brave/update.sh index 04fbbc349419..d08c1559d0a4 100755 --- a/pkgs/applications/networking/browsers/brave/update.sh +++ b/pkgs/applications/networking/browsers/brave/update.sh @@ -23,7 +23,7 @@ cat > $SCRIPT_DIR/default.nix << EOF callPackage ./make-brave.nix (removeAttrs args [ "callPackage" ]) ( - if stdenv.isAarch64 then + if stdenv.hostPlatform.isAarch64 then rec { pname = "brave"; version = "${latestVersionAarch64}"; @@ -31,7 +31,7 @@ callPackage ./make-brave.nix (removeAttrs args [ "callPackage" ]) hash = "${hashAarch64}"; platform = "aarch64-linux"; } - else if stdenv.isx86_64 then + else if stdenv.hostPlatform.isx86_64 then rec { pname = "brave"; version = "${latestVersionAmd64}"; From 8f3e65575083b0deac2b6f04de4af47d408cda16 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 25 Sep 2024 06:38:42 +0300 Subject: [PATCH 2/3] doc/python: correct platform conditional --- doc/languages-frameworks/python.section.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 946971e405d9..3fe588b7cc02 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1306,7 +1306,7 @@ for example: ] ++ lib.optionals (pythonAtLeast "3.8") [ # broken due to python3.8 async changes "async" - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ + ] ++ lib.optionals stdenv.buildPlatform.isDarwin [ # can fail when building with other packages "socket" ]; From 93ed3c31668cf514611b0df752726332277d54f4 Mon Sep 17 00:00:00 2001 From: Artturin Date: Wed, 25 Sep 2024 18:26:37 +0300 Subject: [PATCH 3/3] git-blame-ignore-revs: add formatting treewide --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 8a25858cfd6a..30f3d1c55349 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -160,6 +160,9 @@ ad815aebfbfe1415ff6436521d545029c803c3fb # nixos/nvidia: apply nixfmt-rfc-style (#313440) fbdcdde04a7caa007e825a8b822c75fab9adb2d6 +# treewide: reformat files which need reformatting after (#341407) +e0464e47880a69896f0fb1810f00e0de469f770a + # step-cli: format package.nix with nixfmt (#331629) fc7a83f8b62e90de5679e993d4d49ca014ea013d