From b93845b2bbec60617c467714ddf2b023ecd618c8 Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Thu, 20 Aug 2026 13:31:52 +0200 Subject: [PATCH] nix: fix usage of `isLinux`, `isDarwin` `stdenv.{isLinux,isDarwin}` are deprecated on newer versions of `nixpkgs`. --- default.nix | 4 ++-- flake.nix | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/default.nix b/default.nix index 779146433..c0fb61d98 100644 --- a/default.nix +++ b/default.nix @@ -42,7 +42,7 @@ in [ installShellFiles ] - ++ lib.optionals stdenv.isLinux [ + ++ lib.optionals stdenv.hostPlatform.isLinux [ mold ]; buildInputs = []; @@ -58,7 +58,7 @@ in env = { RUST_BACKTRACE = 1; CARGO_INCREMENTAL = "0"; # https://github.com/rust-lang/rust/issues/139110 - RUSTFLAGS = lib.optionalString stdenv.isLinux "-C link-arg=-fuse-ld=mold"; + RUSTFLAGS = lib.optionalString stdenv.hostPlatform.isLinux "-C link-arg=-fuse-ld=mold"; NIX_JJ_GIT_HASH = gitRev; }; diff --git a/flake.nix b/flake.nix index adfd503db..fa5722005 100644 --- a/flake.nix +++ b/flake.nix @@ -53,9 +53,13 @@ # But, whenever we are running CI builds or checks, we want to use a # smaller closure. This reduces the CI impact on fresh clones/VMs, etc. - rustMinimalPlatform = - let platform = pkgs.rust-bin.selectLatestNightlyWith (t: t.minimal); - in pkgs.makeRustPlatform { rustc = platform; cargo = platform; }; + rustMinimalPlatform = let + platform = pkgs.rust-bin.selectLatestNightlyWith (t: t.minimal); + in + pkgs.makeRustPlatform { + rustc = platform; + cargo = platform; + }; in { formatter = pkgs.alejandra; @@ -111,9 +115,9 @@ # efficient than the defaults. these noticeably improve link time even for # medium sized rust projects like jj rustLinkerFlags = - if pkgs.stdenv.isLinux + if pkgs.stdenv.hostPlatform.isLinux then ["-fuse-ld=mold" "-Wl,--compress-debug-sections=zstd"] - else if pkgs.stdenv.isDarwin + else if pkgs.stdenv.hostPlatform.isDarwin then # on darwin, /usr/bin/ld actually looks at the environment variable # $DEVELOPER_DIR, which is set by the nix stdenv, and if set,