[Nix#9369] Setting pure-eval for nix3 commands has not effect #100

Open
opened 2024-03-16 06:44:54 +00:00 by lix-bot · 0 comments
Member

Upstream-Issue: NixOS/nix#9369

Describe the bug

Consider the following flake.nix:

{
  outputs = { self, nixpkgs }: {
    packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.runCommand "test" {} ''
      echo ${builtins.currentSystem} > $out
    '';
  };
}
$ nix build --impure

Works, but using --option eval-impure but has no effect:

$ nix build --option eval-impure true
error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'test'
         whose name attribute is located at /nix/store/14lilc4c4h0001f7cwjvpmv1vihj46wp-source/pkgs/stdenv/generic/make-derivation.nix:348:7

       … while evaluating attribute 'buildCommand' of derivation 'test'

         at /nix/store/14lilc4c4h0001f7cwjvpmv1vihj46wp-source/pkgs/build-support/trivial-builders/default.nix:87:14:

           86|       enableParallelBuilding = true;
           87|       inherit buildCommand name;
             |              ^
           88|       passAsFile = [ "buildCommand" ]

       error: attribute 'currentSystem' missing

       at /nix/store/9bh6bpckhyxzg838bl4qs8n4h7vnhqa7-source/flake.nix:4:14:

            3|     packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.runCommand "test" {} ''
            4|       echo ${builtins.currentSystem} > $out
             |              ^
            5|     '';

Expected behavior

Setting documented options is respected.

nix-env --version output nix-env (Nix) 2.18.1

Rational:

Because of the sheer amounts of nix options many high-level wrapper only expose --option as a single nob to access all underlying configuration.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/9369 **Describe the bug** Consider the following flake.nix: ``` { outputs = { self, nixpkgs }: { packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.runCommand "test" {} '' echo ${builtins.currentSystem} > $out ''; }; } ``` ``` $ nix build --impure ``` Works, but using `--option eval-impure` but has no effect: ``` $ nix build --option eval-impure true error: … while calling the 'derivationStrict' builtin at /builtin/derivation.nix:9:12: (source not available) … while evaluating derivation 'test' whose name attribute is located at /nix/store/14lilc4c4h0001f7cwjvpmv1vihj46wp-source/pkgs/stdenv/generic/make-derivation.nix:348:7 … while evaluating attribute 'buildCommand' of derivation 'test' at /nix/store/14lilc4c4h0001f7cwjvpmv1vihj46wp-source/pkgs/build-support/trivial-builders/default.nix:87:14: 86| enableParallelBuilding = true; 87| inherit buildCommand name; | ^ 88| passAsFile = [ "buildCommand" ] error: attribute 'currentSystem' missing at /nix/store/9bh6bpckhyxzg838bl4qs8n4h7vnhqa7-source/flake.nix:4:14: 3| packages.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.runCommand "test" {} '' 4| echo ${builtins.currentSystem} > $out | ^ 5| ''; ``` **Expected behavior** Setting documented options is respected. **`nix-env --version` output** nix-env (Nix) 2.18.1 Rational: Because of the sheer amounts of nix options many high-level wrapper only expose `--option` as a single nob to access all underlying configuration.
lix-bot added the
bug
imported
labels 2024-03-16 06:44:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#100
No description provided.