diff options
Diffstat (limited to 'modules/pkgs.nix')
| -rw-r--r-- | modules/pkgs.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/pkgs.nix b/modules/pkgs.nix new file mode 100644 index 0000000..d984859 --- /dev/null +++ b/modules/pkgs.nix @@ -0,0 +1,22 @@ +{ config, lib, ... }: + +{ + options.pkgs = lib.mkOption { + type = lib.types.nullOr (lib.types.lazyAttrsOf lib.types.raw); + default = + if (config.sources ? "nixpkgs") then + import config.sources.nixpkgs { + config = { }; + overlays = [ ]; + } + else + null; + defaultText = "if (sources has nixpkgs) import sources.nixpkgs { ... } else null"; + description = "The instance of `nixpkgs` to pass as a module argument."; + example = lib.literalExpression "import <nixpkgs> { config = { allowUnfree = true; }; }"; + }; + + config = { + _module.args = { inherit (config) pkgs; }; + }; +} |
