Skip to content

[Bug] evaluation warning: 'system' has been renamed to/replaced by 'stdenv.hostPlatform.system' #37

@charliie-dev

Description

@charliie-dev

Description

When running home-manager switch with charmbracelet/nur packages, the log will show an warning:

evaluation warning: 'system' has been renamed to/replaced by 'stdenv.hostPlatform.system'

since pkgs.system is deprecated in NixOS 25.11, and 25.11 just got branched out. I think it's time to fix those warnings.


I traced the issue via adding

(self: super: {
  system = builtins.throw "Do not read pkgs.system; use stdenv.hostPlatform.system";
})

to nixpkgs' overlays and running NIX_SHOW_TRACES=1 home-manager switch --show-trace.
Both pkgs.nur.repos.charmbracelet.glow and pkgs.nur.repos.charmbracelet.crush shows similar errors:

...while calling the 'derivationStrict' builtin
         at «nix-internal»/derivation-internal.nix:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'glow-2.1.1'
         whose name attribute is located at «github:nixos/nixpkgs/5ae3b07»/pkgs/stdenv/generic/make-derivation.nix:541:13while evaluating attribute 'sourceRoot' of derivation 'glow-2.1.1'
         at /nix/store/50ci4i5gz83g6x33116vrp64xf1k4lyw-source/pkgs/glow/default.nix:45:3:
           44|
           45|   sourceRoot = sourceRootMap.${system};
             |   ^
           46|

       … while calling the 'throw' builtin
         at /Users/charles/.config/home-manager/modules/hosts/m3pro.nix:22:20:
           21|         (self: super: {
           22|           system = builtins.throw "Do not read pkgs.system; use stdenv.hostPlatform.system";
             |                    ^
           23|         })

       error: Do not read pkgs.system; use stdenv.hostPlatform.system

and

...while evaluating derivation 'crush-0.18.6'
         whose name attribute is located at «github:nixos/nixpkgs/5ae3b07»/pkgs/stdenv/generic/make-derivation.nix:541:13while evaluating attribute 'sourceRoot' of derivation 'crush-0.18.6'
         at /nix/store/50ci4i5gz83g6x33116vrp64xf1k4lyw-source/pkgs/crush/default.nix:45:3:
           44|
           45|   sourceRoot = sourceRootMap.${system};
             |   ^
           46|

       … while calling the 'throw' builtin
         at /Users/charles/.config/home-manager/modules/hosts/m3pro.nix:22:20:
           21|         (self: super: {
           22|           system = builtins.throw "Do not read pkgs.system; use stdenv.hostPlatform.system";
             |                    ^
           23|         })

       error: Do not read pkgs.system; use stdenv.hostPlatform.system

My current workaround is patching the files by patching pkgs/crush/default.nix with:

{
-  system ? builtins.currentSystem
, lib
, fetchurl
, installShellFiles
, stdenvNoCC
}:
let 
+ inherit (stdenvNoCC.hostPlatform) system;

  shaMap = {
    i686-linux     = "1jzrjyynagjs1kdj48c799mb5qa12sr5x4aqhh905i7ngjidm67n";
    x86_64-linux   = "035kyby7r1dwms0lgywhbj6k3c6gc5bgx26a7fjnvzfy43mjksd6";
    armv7l-linux   = "0yapkhwfrzw9giaangzds7fdnfrcl13bldvfk1jj04l31kvsapgx";
    aarch64-linux  = "0s8vdr5apa9gi7aayw6ah7xdxdqzfskpvq36xv29nvfn08k2q3xz";
    x86_64-darwin  = "1pl60rvhgj0j1rxl2ghpwibcn2x4siw561g5yafx4dyqs7g0fhz8";
    aarch64-darwin = "1w4hikw7yzhfxrkk2srs0yqy02n54diq42f1ms0h1gsbl9f20yhg";
  };
...
in 
...

-  system = system;
...

With this patch, the warning is now gone.

Version

master

Environment

macOS 26.1 and Ubuntu 24.05 / ghostty / nix (Determinate Nix 3.13.2) 2.32.4 with home-manager 25.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions