nixos-container: simplify 'pkgs' option type

Set the default value directly instead of using a `null` proxy value.
This commit is contained in:
Erik Arvstedt 2020-12-15 20:24:59 +01:00
parent 29385f0560
commit 77c4fc2e89
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -469,13 +469,11 @@ in
A specification of the desired configuration of this A specification of the desired configuration of this
container, as a NixOS module. container, as a NixOS module.
''; '';
type = let type = lib.mkOptionType {
confPkgs = if config.pkgs == null then pkgs else config.pkgs;
in lib.mkOptionType {
name = "Toplevel NixOS config"; name = "Toplevel NixOS config";
merge = loc: defs: (import (confPkgs.path + "/nixos/lib/eval-config.nix") { merge = loc: defs: (import (config.pkgs.path + "/nixos/lib/eval-config.nix") {
inherit system; inherit system;
pkgs = confPkgs; pkgs = config.pkgs;
modules = modules =
let let
extraConfig = { extraConfig = {
@ -525,9 +523,9 @@ in
}; };
pkgs = mkOption { pkgs = mkOption {
type = types.nullOr types.attrs; type = types.attrs;
default = null; default = pkgs;
example = literalExample "pkgs"; defaultText = "pkgs";
description = '' description = ''
Customise which nixpkgs to use for this container. Customise which nixpkgs to use for this container.
''; '';