msteen / nix-prefetch

Prefetch any fetcher function call, e.g. a package source
MIT License
115 stars 11 forks source link

`nix-prefetch` is broken without passing `extra-experimental-features` options on every invocation #51

Open eclairevoyant opened 1 month ago

eclairevoyant commented 1 month ago

The command below fails with an error indicating experimental features are disabled:

nix-prefetch -f /path/to/nixpkgs ``` warning: unknown experimental feature 'configurable-impure-env' warning: unknown experimental feature 'fetch-tree' warning: unknown setting 'reject-flake-config' warning: unknown experimental feature 'configurable-impure-env' warning: unknown experimental feature 'fetch-tree' warning: unknown setting 'reject-flake-config' error: … at «none»:0: (source not available) … in the left operand of the update (//) operator at /nix/store/l8a56pk5yl030acxva90p2wraxbghl2p-nix-prefetch-0.4.1/lib/nix-prefetch/prelude.nix:3:46: 2| 3| let prelude = with prelude; import ./lib.nix // { | ^ 4| fetcher = if orig.fetcher == null || elem orig.fetcher.type [ "file" "attr" ] (stack trace truncated; use '--show-trace' to show the full trace) error: experimental Nix feature 'flakes' is disabled; use '--extra-experimental-features flakes' to override ```

This forces me to add --option extra-experimental-features flakes to every invocation, which is silly

herberteuler commented 1 month ago

This is precisely the same error I have got. I wonder why nix.conf is disrespected although strace shows it has been read.

herberteuler commented 1 month ago

I know now:

$ NIX_CONFIG='extra-experimental-features = flakes' nix show-config --experimental-features nix-command | grep exp
experimental-features = nix-command

$ NIX_CONFIG='extra-experimental-features = flakes' nix show-config | grep exp
experimental-features = flakes nix-command

The command line option --experimental-features takes the highest precedence and overrides any other configurations.