Trouble Referencing Inputs in Sub-Module

There are a couple of points here:

  1. The way nix.nix is written is that it’s trying to set an option called “inputs.nixpkgs.config.allowUnfree”[*] rather than try to reference something coming in from inputs. This option does not exist. Change it to just nixpkgs.config, since it affects only the main pkgs instance that is used in the system, one that’s effectively created when you call nixpkgs.lib.nixosSystem.

    inputs is actually perfectly accessible in your code, but you are not reading from it (at least in the code snippets in the post).

  2. If you want to use unstable nixpkgs while using stable nixpkgs for the majority of the system, you have a couple of options

    a. Use an overlay.

    Or

    b. Create isolated instances of pkgs-unstable in individual modules:

     ```nix
     # somefile.nix
     { inputs, pkgs, ... }:
     let
         pkgs-unstable = import inputs.nixpkgs {
             inherit (pkgs) system;
         };
     in
     {
         environment.systemPackages = [ pkgs-unstable.hello ];
     }
     ```
    

[*] not literally that, but an option with this path.

1 Like