From 77c4fc2e89eca27e7ba559ed5b0f053a5ef122ce Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 15 Dec 2020 20:24:59 +0100 Subject: [PATCH] nixos-container: simplify 'pkgs' option type Set the default value directly instead of using a `null` proxy value. --- nixos/modules/virtualisation/nixos-containers.nix | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index df9031c7e9e..5949c54052c 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -469,13 +469,11 @@ in A specification of the desired configuration of this container, as a NixOS module. ''; - type = let - confPkgs = if config.pkgs == null then pkgs else config.pkgs; - in lib.mkOptionType { + type = lib.mkOptionType { 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; - pkgs = confPkgs; + pkgs = config.pkgs; modules = let extraConfig = { @@ -525,9 +523,9 @@ in }; pkgs = mkOption { - type = types.nullOr types.attrs; - default = null; - example = literalExample "pkgs"; + type = types.attrs; + default = pkgs; + defaultText = "pkgs"; description = '' Customise which nixpkgs to use for this container. '';