Hello! I am stuck!
I’ve been working on moving my configuration to a flake, and I’ve used the 20.03 and master branches as inputs for packages. I can successfully build a configuration that uses unstable packages - but ONLY when they are ‘free’
I’m stuck because I’ve allowed unfree packages from my 20.03 branch. Why does the config not apply everywhere?
I’m using the generic configuration.nix
- inside the package listing, I have tried importing GNU Hello as my control, and VSCode as my test.
...
vscode # always works
# unstable.vscode # never works
# hello # always works
unstable.hello # always works
...
my flake.nix is as follows:
{
inputs = {
nixpkgs-unstable.url = "github:nixos/nixpkgs/master";
nixpkgs.url = "github:nixos/nixpkgs/nixos-20.03";
};
outputs = {self, nixpkgs, nixpkgs-unstable}:
let
unstableOverlay = final: prev: {
unstable = nixpkgs-unstable.legacyPackages."x86_64-linux";
nixpkgs-unstable.config.allowUnfree = true; # snake eyes!
};
in {
nixosConfigurations.MyComputer = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({
nixpkgs = {
overlays = [ unstableOverlay ];
config.allowUnfree = true; # this is the only allowUnfree that's actually doing anything
};
})
./configuration.nix
];
};
};
}
I would expect that somewhere I can provide config.allowUnfree=true;
to get unfree packages from 20.03 and master, but I always get this error.
Package ‘vscode-1.48.2’ in /nix/store/r14s33j91sbz7kc511hxxaxpnzcmv86d-source/pkgs/applications/editors/vscode/vscode.nix:40 has an unfree license (‘unfree’), refusing to evaluate.
a) For `nixos-rebuild` you can set
{ nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.
b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
(use '--show-trace' to show detailed location information)
I’ve also tried adding nixpkgs.config.allowUnfree = true;
to the configuration.nix
but I have the same issue.
I have tried adding unstable.config.allowUnfree = true;
but I suspect this is nonesense, Nix did not appreciate me trying. (option does not exist)
I’ve also triple checked my ~/.config/nixpkgs/config.nix
file, and event copied it into /root/.config/nix/
just for fun.
Any advice? I suppose I can just cast 20.03 into the fire but I feel like a real solution must exist somewhere