Has `config.allowUnfree` changed in `nixos-unstable`?

Sometime in the last month or so my desktop flake stopped building, complaining it cannot build unfree vscode. I trimmed it to this minimal content

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; # rev 1c9db9710cb23d60570ad4d7ab829c2d34403de3
  #inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.05"; # rev 35130d4b4f0b8c50ed2aceb909a538c66c91d4a0
  inputs.pwnvim.url = "git+https://github.com/zmre/pwnvim.git";
  inputs.pwnvim.inputs.nixpkgs.follows = "nixpkgs";

  outputs = { self, nixpkgs, pwnvim }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        config.allowUnfree = true;
      };
    in with pkgs; {
      nvim = pwnvim.packages.${system}.pwnvim;
      vscode = vscode-with-extensions.override {
        vscodeExtensions = with pkgs.vscode-extensions; [ ];
      };
      packages.${system}.default = buildEnv {
        name = "desk_default";
        paths = [ self.vscode self.nvim ];
      };
    };
}

Switching inputs.nixpkgs from nixos-unstable to nixos-23.05 enables it to build. Removing self.nvim also enables it to build. Removing the follows line causes a second nixpkgs to be pulled, but the build still fails.

It seems there is some sort of conflict with my import of pwnvim. How do I figure out what code is going wrong?

Nix is a purely functional language so, unless you pass pkgs to pwnvim somehow, pwnvim.packages has no way to access the its value, and will still create its own Nixpkgs instance, not sharing the config.

inputs.pwnvim.inputs.nixpkgs.follows = "nixpkgs"; only really ensures that pwnvim flake instantiates Nixpkgs from the same Nixpkgs revision as the top-level flake.

If you want to be able to pass config to pwnvim, the cleanest solution would probably be for pwnvim flake to expose an overlay. Then you will be able to plop it into your pkgs.

Relevant: 1000 instances of nixpkgs problem. There is also Announcing nixpkgs-unfree

2 Likes

@jtojnar, thanks for your response; it was helpful.

I tried many changes to pwnvim without success, including removing its unnecessary overlay of nixpkgs and some of flake-utils. I also tried to implement the suggested pattern in 1000 instances of nixpkgs (removing import "nixpkgs" from pwnvim). But I may not have been careful enough to try these changes properly – I have to revisit them.

As far as I know, pwnvim does not need allowUnfree – that is only for vscode in my root flake. It seems that the inclusion of pwnvim somehow changes the nixpkgs passed to vscode, removing the allowUnfree.

I’m going to keep poking at this. Hopefully it’ll help me develop a better understanding of nix and how to debug such problems.