From ff323fdaa7cbaa1887569dc8b453169c31ff66e1 Mon Sep 17 00:00:00 2001 From: Luka Boulagnon Date: Tue, 1 Sep 2026 13:58:52 +0200 Subject: [PATCH] chore: switch stdenv.is* to stdenv.hostPlatform.is* Update pkgs.stdenv.is* as it has been deprecated from nixpkgs: https://github.com/NixOS/nixpkgs/commit/4bb4cff ``` stdenv: deprecate is* aliases in favor of hostPlatform.is* These shorthands hide the platform distinction and are unfit for cross-compilation. Wrap them in `lib.warn` so each access prints a deprecation notice, and gate them on `config.allowAliases` so they can be removed entirely. ``` The commit introduces a deprecation notice: ```nix lib.warn "stdenv.${name} is deprecated, use stdenv.hostPlatform.${name} instead" value ``` --- lib/default.nix | 2 +- .../modules/home/home-shared.nix | 4 ++-- .../modules/nixos/host-shared.nix | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index c1575fb..7efd41c 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -341,7 +341,7 @@ in rec { home.homeDirectory = let username = config.home.username; - homeDir = if pkgs.stdenv.isDarwin then "/Users/${username}" else "/home/${username}"; + homeDir = if pkgs.stdenv.hostPlatform.isDarwin then "/Users/${username}" else "/home/${username}"; in lib.mkDefault homeDir; } diff --git a/templates/nixos-and-darwin-shared-homes/modules/home/home-shared.nix b/templates/nixos-and-darwin-shared-homes/modules/home/home-shared.nix index 7725489..cb2ee8c 100644 --- a/templates/nixos-and-darwin-shared-homes/modules/home/home-shared.nix +++ b/templates/nixos-and-darwin-shared-homes/modules/home/home-shared.nix @@ -2,13 +2,13 @@ { # only available on linux, disabled on macos - services.ssh-agent.enable = pkgs.stdenv.isLinux; + services.ssh-agent.enable = pkgs.stdenv.hostPlatform.isLinux; home.packages = [ pkgs.ripgrep ] ++ ( # you can access the host configuration using osConfig. - pkgs.lib.optionals (osConfig.programs.vim.enable && pkgs.stdenv.isDarwin) [ pkgs.skhd ] + pkgs.lib.optionals (osConfig.programs.vim.enable && pkgs.stdenv.hostPlatform.isDarwin) [ pkgs.skhd ] ); home.stateVersion = "24.11"; # initial home-manager state diff --git a/templates/nixos-and-darwin-shared-homes/modules/nixos/host-shared.nix b/templates/nixos-and-darwin-shared-homes/modules/nixos/host-shared.nix index 56c2953..1dc405a 100644 --- a/templates/nixos-and-darwin-shared-homes/modules/nixos/host-shared.nix +++ b/templates/nixos-and-darwin-shared-homes/modules/nixos/host-shared.nix @@ -3,8 +3,8 @@ programs.vim.enable = true; - # you can check if host is darwin by using pkgs.stdenv.isDarwin + # you can check if host is darwin by using pkgs.stdenv.hostPlatform.isDarwin environment.systemPackages = [ pkgs.btop - ] ++ (pkgs.lib.optionals pkgs.stdenv.isDarwin [ pkgs.xbar ]); + ] ++ (pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin [ pkgs.xbar ]); }