Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand the scope of the allowUnfree flag to all the inputs #1090

Open
sestrella opened this issue Apr 1, 2024 · 4 comments
Open

Expand the scope of the allowUnfree flag to all the inputs #1090

sestrella opened this issue Apr 1, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@sestrella
Copy link
Contributor

sestrella commented Apr 1, 2024

Right now, it appears that setting allowUnfree = true only affects the nixpkgs input; a closer look at the generated .devenv.flake.nix file reveals the following code:

pkgs = import nixpkgs {
  inherit system;
  config = {
    allowUnfree = devenv.allowUnfree or false;
    allowBroken = devenv.allowBroken or false;
    permittedInsecurePackages = devenv.permittedInsecurePackages or [ ];
  };
  inherit overlays;
};

So far, it appears that the only way to install "unfree" packages from external flakes is to pass them as overlays to the main nixpkgs input, which may be affected by allowUnfree = true. A workaround I discovered is to prefix all devenv commands with NIXPKGS_ALLOW_UNFREE=1 or to add it directly to the direnv configuration file .envrc, as shown below:

source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0="

NIXPKGS_ALLOW_UNFREE=1 use devenv

To avoid this workaround, I am wondering if it makes sense to pass the NIXPKGS_ALLOW_UNFREE=1 environment variable to all nix commands invoked by devenv when allowUnfree is set to true. I'd be willing to submit a PR if the suggested change sounds like a viable solution for the mentioned scenario.

@sestrella sestrella added the enhancement New feature or request label Apr 1, 2024
@domenkozar
Copy link
Member

Yeah, I've been looking into this a few times, see #792.

It's tricky to fix because we don't want to use impure mode, but each invocation of import nixpkgs { .. } should respect a global config.

@SebastianCallh
Copy link

Hi! I am trying to use the proposed workaround with NIXPKGS_ALLOW_UNFREE=1 use devenv in the .envrc and running NIXPKGS_ALLOW_UNFREE=1 devenv shell in a devenv with terraform added as a language, but both approaches fail to resolve the "unfree license (‘bsl11’), refusing to evaluate" error. Can you please advise on why this might be? I would really love to use devenv.

I am on macos but use nixos-darwin for all installations if that is relevant.

@domenkozar
Copy link
Member

You also need to enable impure: true in devenv.yaml.

@SebastianCallh
Copy link

Thank you for your helpful response, that was indeed the issue. It all works now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants