Nix flake show and allow-import-from-derivation

I am trying out haskell.nix from input-output-hk, and running into the same issue as mentioned previously: Looking up values specified by `nixConfig` in `flake.nix` using `nix repl`

However, I added to /etc/nixos/configuration.nix nix.settings.allow-import-from-derivation = true; and performed a sudo nixos-rebuild switch --flake /etc/nixos. The setting then appeared in my /etc/nix/nix.conf file.

However, running nix flake show still exhibited the same behavior, ignoring the global setting as well as the local flake.nix setting (using a command line option succeeds).

I was just curious whether there was a bug, or whether there was any documentation on this behavior?

1 Like

What is ā€œthe same behaviourā€?

And does a ~/.config/nix/nix.conf exist? What is its content?

The behavior in question: nix flake show

error: cannot build ā€˜/nix/store/…-haskell-project-plan-to-nix-pkgs.drv^out’ during evaluation because the option ā€˜allow-import-from-derivation’ is disabled

I don’t have a .config/nix/nix.conf I am using flakes and a stand-alone home-manager

printenv NIX_CONF?

Or in general, can you share the project you have the issue with and also your system and home config?

I don’t have a NIX_CONF set

Rather than paste my configuration.nix and my home.nix etc, following this guide you should run into the same issue more quickly

The issue with the local flake.nix nixConfig setting is discussed in the discourse thread mentioned at the top

I’m pretty sure I’ll run into the issue, as I have disabled IFD explicitly. And if you run into the problem, you likely did as well. I’m just trying to figure out where.

IFD is disabled by default, as far as I can understand. Commenting out the explicit line I temporarily added in /etc/nixos/configuration.nix and rebuilding results in the entry vanishing from /etc/nix/nix.conf.

I suspect nix flake show ignores it regardless of whether it is set it in a local flake.nix or globally, which is not ideal, but fine as long as that is understood

No, IFD is enabled by default. Check man nix.conf.

3 Likes

You can also accurately verify the value of a configuration setting:

nix config show allow-import-from-derivation

If you see false then something is setting it.

2 Likes