Can't eval in pure mode #3

Closed
opened 2025-02-25 00:50:19 +00:00 by shelvacu · 2 comments
Contributor

pls can has pure eval 🙏

cd "$(mktemp -d)"
cat <<END > flake.nix
{
  inputs.colin = {
    url = "git+https://git.uninsane.org/colin/nix-files?rev=0b1c94d4a3ec27f37500c267e2a841983f30bd96";
    flake = false;
  };
  outputs = { colin, ... }: let
    colinpkgs = import colin { localSystem = "x86_64-linux"; };
  in {
    colinHosts = builtins.attrNames colinpkgs.hosts;
  };
}
END
nix eval --impure '.#colinHosts' #works
nix eval '.#colinHosts' #doesnt work :(

errors:

error:
       … while calling the 'attrNames' builtin
         at /nix/store/mz9azdfg8i3kgf9my8wsw3fjna29g6v8-source/flake.nix:1:178:
            1| { inputs.colin = { url = "git+https://git.uninsane.org/colin/nix-files?rev=0b1c94d4a3ec27f37500c267e2a841983f30bd96"; flake = false; }; outputs = { colin, ... }: { colinHosts = builtins.attrNames (import colin { localSystem = "x86_64-linux"; }).hosts; }; }
             |                                                                                                                                                                                  ^
            2|

       … in the right operand of the update (//) operator
         at /nix/store/wlqik2nxmn0imn1dwcdw09z3gpgmbyy6-yw6s9fsdcyyy8bydpszqbxrwgbhgbhqa-source/impure.nix:184:3:
          183|   updateScripts = builtins.mapAttrs (_: v: v.updateScript) (lib.filterAttrs (_: v: v.updateScript != "") updateInfo);
          184| } // pkgs
             |   ^
          185|

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attribute 'currentSystem' missing
       at /nix/store/wlqik2nxmn0imn1dwcdw09z3gpgmbyy6-yw6s9fsdcyyy8bydpszqbxrwgbhgbhqa-source/pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix:36:75:
           35|   #VVV config
           36|     localSystem ? if stdenv != null then stdenv.buildPlatform.system else builtins.currentSystem,  #< not available in pure mode
             |                                                                           ^
           37|     system ? if stdenv != null then stdenv.hostPlatform.system else localSystem,
pls can has pure eval 🙏 ```bash cd "$(mktemp -d)" cat <<END > flake.nix { inputs.colin = { url = "git+https://git.uninsane.org/colin/nix-files?rev=0b1c94d4a3ec27f37500c267e2a841983f30bd96"; flake = false; }; outputs = { colin, ... }: let colinpkgs = import colin { localSystem = "x86_64-linux"; }; in { colinHosts = builtins.attrNames colinpkgs.hosts; }; } END nix eval --impure '.#colinHosts' #works nix eval '.#colinHosts' #doesnt work :( ``` errors: ```text error: … while calling the 'attrNames' builtin at /nix/store/mz9azdfg8i3kgf9my8wsw3fjna29g6v8-source/flake.nix:1:178: 1| { inputs.colin = { url = "git+https://git.uninsane.org/colin/nix-files?rev=0b1c94d4a3ec27f37500c267e2a841983f30bd96"; flake = false; }; outputs = { colin, ... }: { colinHosts = builtins.attrNames (import colin { localSystem = "x86_64-linux"; }).hosts; }; } | ^ 2| … in the right operand of the update (//) operator at /nix/store/wlqik2nxmn0imn1dwcdw09z3gpgmbyy6-yw6s9fsdcyyy8bydpszqbxrwgbhgbhqa-source/impure.nix:184:3: 183| updateScripts = builtins.mapAttrs (_: v: v.updateScript) (lib.filterAttrs (_: v: v.updateScript != "") updateInfo); 184| } // pkgs | ^ 185| (stack trace truncated; use '--show-trace' to show the full, detailed trace) error: attribute 'currentSystem' missing at /nix/store/wlqik2nxmn0imn1dwcdw09z3gpgmbyy6-yw6s9fsdcyyy8bydpszqbxrwgbhgbhqa-source/pkgs/by-name/nixpkgs-bootstrap/mkNixpkgs.nix:36:75: 35| #VVV config 36| localSystem ? if stdenv != null then stdenv.buildPlatform.system else builtins.currentSystem, #< not available in pure mode | ^ 37| system ? if stdenv != null then stdenv.hostPlatform.system else localSystem, ```
Owner

should work now with d3d3e03eff1aa5b4136e0520f5484e576040fa73.

should work now with d3d3e03eff1aa5b4136e0520f5484e576040fa73.
colin closed this issue 2025-03-03 08:32:01 +00:00
Owner

feel free to reopen if you find other parts (e.g. specific packages) that don't eval in pure mode though. i want this to be pure, non-flake nix just doesn't enforce that :(

feel free to reopen if you find other parts (e.g. specific packages) that don't eval in pure mode though. i want this to be pure, non-flake nix just doesn't enforce that :(
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: colin/nix-files#3
No description provided.