|
12 | 12 | let |
13 | 13 | flakeExpr = flake.outputs.nixopsConfigurations.default or { }; |
14 | 14 |
|
15 | | - nixpkgsBoot = toString <nixpkgs> ; # this will be replaced on install by nixops' nixpkgs input |
16 | | - libBoot = import "${nixpkgsBoot}/lib"; |
| 15 | + nixpkgsBoot = <nixpkgs> ; # this will be replaced on install by nixops' nixpkgs input |
| 16 | + libOf = nixpkgs: import /${nixpkgs}/lib; |
| 17 | + libBoot = libOf nixpkgsBoot; |
17 | 18 |
|
18 | | - evalModules = lib: modules: lib.evalModules { |
| 19 | + evalMod = lib: mod: lib.evalModules { |
19 | 20 | specialArgs = args // { inherit lib system; }; |
20 | | - modules = modules ++ networkExprs ++ [ |
21 | | - flakeExpr |
| 21 | + modules = networkExprs ++ [ |
| 22 | + ./net.nix mod flakeExpr |
22 | 23 | { |
23 | | - options.nixpkgs = lib.mkOption { |
24 | | - type = lib.types.path; |
25 | | - description = "Path to the nixpkgs instance used to buld the machines."; |
26 | | - defaultText = lib.literalDocBook "The 'nixpkgs' input to either the provided flake or nixops' own."; |
27 | | - default = flake.inputs.nixpkgs or nixpkgsBoot; |
28 | | - }; |
| 24 | + nixpkgs = lib.mkDefault flake.inputs.nixpkgs or nixpkgsBoot; |
| 25 | + network.nodeExtraArgs = { inherit uuid deploymentName; }; |
| 26 | + defaults.environment.checkConfigurationOptions = lib.mkOverride 900 checkConfigurationOptions; |
29 | 27 | } |
30 | 28 | ]; |
31 | 29 | }; |
32 | 30 |
|
33 | | - inherit ((evalModules libBoot [{ |
34 | | - _module.freeformType = with libBoot.types;attrsOf anything; |
35 | | - }]).config) nixpkgs; |
36 | | - |
| 31 | + inherit ((evalMod libBoot { _module.check = false; }).config) nixpkgs; |
37 | 32 | pkgs = nixpkgs.legacyPackages.${system} or (import nixpkgs { inherit system; }); |
38 | | - lib = nixpkgs.lib or pkgs.lib or (builtins.tryEval (import "${nixpkgs}/lib")).value or libBoot; |
| 33 | + lib = nixpkgs.lib or pkgs.lib or (builtins.tryEval (libOf nixpkgs)).value or libBoot; |
39 | 34 |
|
40 | 35 | in rec { |
41 | 36 | inherit nixpkgs; |
42 | 37 |
|
43 | | - net = evalModules lib [ |
44 | | - ./net.nix |
45 | | - ({ config, ... }: { |
46 | | - resources.imports = pluginResourceModules ++ [ deploymentInfoModule ]; |
47 | | - network.resourcesDefaults = resourceModuleArgs_ rec{ |
48 | | - inherit (config) nodes resources; |
49 | | - machines = nodes; |
50 | | - }; |
51 | | - network.nodeExtraArgs = { inherit uuid deploymentName; }; |
52 | | - defaults.environment.checkConfigurationOptions = lib.mkOverride 900 checkConfigurationOptions; |
53 | | - # Make NixOps's deployment.* options available. |
54 | | - defaults.imports = pluginOptions ++ [ deploymentInfoModule ]; |
55 | | - }) |
56 | | - ]; |
| 38 | + net = evalMod lib ({ config, ... }: { |
| 39 | + resources.imports = pluginResourceModules ++ [ deploymentInfoModule ]; |
| 40 | + network.resourcesDefaults = resourceModuleArgs_ rec{ |
| 41 | + inherit (config) nodes resources; |
| 42 | + machines = nodes; |
| 43 | + }; |
| 44 | + # Make NixOps's deployment.* options available. |
| 45 | + defaults.imports = pluginOptions ++ [ deploymentInfoModule ]; |
| 46 | + }); |
57 | 47 |
|
58 | 48 | # for backward compatibility |
59 | 49 | network = lib.mapAttrs (n: v: [v]) net.config; |
|
0 commit comments