|
28 | 28 | default = null;
|
29 | 29 | type = nullOr (lib.mkOptionType {
|
30 | 30 | name = "Toplevel NixOS config";
|
31 |
| - merge = loc: defs: (import "${toString config.pkgs.path}/nixos/lib/eval-config.nix" { |
| 31 | + merge = loc: defs: (import "${config.nixpkgs}/nixos/lib/eval-config.nix" { |
32 | 32 | modules =
|
33 | 33 | let
|
34 |
| - extraConfig = { |
| 34 | + extraConfig = ({ lib, ... }: { |
35 | 35 | _file = "module at ${__curPos.file}:${toString __curPos.line}";
|
36 | 36 | config = {
|
37 | 37 | networking.hostName = lib.mkDefault name;
|
38 | 38 | };
|
39 |
| - }; |
| 39 | + }); |
40 | 40 | in [
|
41 | 41 | extraConfig
|
42 | 42 | ../microvm
|
43 | 43 | ] ++ (map (x: x.value) defs);
|
44 | 44 | prefix = [ "microvm" "vms" name "config" ];
|
45 | 45 | inherit (config) specialArgs pkgs;
|
46 |
| - inherit (config.pkgs) system; |
| 46 | + system = if config.pkgs != null then config.pkgs.system else pkgs.system; |
47 | 47 | });
|
48 | 48 | });
|
49 | 49 | };
|
50 | 50 |
|
| 51 | + nixpkgs = mkOption { |
| 52 | + type = types.path; |
| 53 | + default = if config.pkgs != null then config.pkgs.path else pkgs.path; |
| 54 | + defaultText = literalExpression "pkgs.path"; |
| 55 | + description = lib.mdDoc '' |
| 56 | + This option is only respected when `config` is specified. |
| 57 | + The nixpkgs path to use for the MicroVM. Defaults to the host's nixpkgs. |
| 58 | + ''; |
| 59 | + }; |
| 60 | + |
51 | 61 | pkgs = mkOption {
|
52 |
| - type = types.unspecified; |
| 62 | + type = types.nullOr types.unspecified; |
53 | 63 | default = pkgs;
|
54 | 64 | defaultText = literalExpression "pkgs";
|
55 | 65 | description = lib.mdDoc ''
|
56 | 66 | This option is only respected when `config` is specified.
|
57 | 67 | The package set to use for the MicroVM. Must be a nixpkgs package set with the microvm overlay. Determines the system of the MicroVM.
|
| 68 | + If set to null, a new package set will be instantiated. |
58 | 69 | '';
|
59 | 70 | };
|
60 | 71 |
|
|
0 commit comments