summaryrefslogtreecommitdiff
path: root/modules/pkgs.nix
blob: d9848599cc9f7601cf36f10a37ef5590899df3ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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; };
  };
}