devenv
devenv copied to clipboard
Expand the scope of the `allowUnfree` flag to all the inputs
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.