10
10
} :
11
11
12
12
let
13
- call = x : if builtins . isFunction x then x args else x ;
14
-
15
- zipAttrs = set : builtins . listToAttrs (
16
- map ( name : { inherit name ; value = builtins . catAttrs name set ; } ) ( builtins . concatMap builtins . attrNames set ) ) ;
17
-
18
13
flakeExpr = flake . outputs . nixopsConfigurations . default or { } ;
19
14
20
15
nixpkgsBoot = toString <nixpkgs> ; # this will be replaced on install by nixops' nixpkgs input
@@ -49,12 +44,10 @@ in rec {
49
44
./net.nix
50
45
( { config , ... } : {
51
46
resources . imports = pluginResourceModules ++ [ deploymentInfoModule ] ;
52
- network . resourcesDefaults . imports = [
53
- ( resourceModuleArgs_ rec {
54
- inherit ( config ) nodes resources ;
55
- machines = nodes ;
56
- } )
57
- ] ;
47
+ network . resourcesDefaults = resourceModuleArgs_ rec {
48
+ inherit ( config ) nodes resources ;
49
+ machines = nodes ;
50
+ } ;
58
51
network . nodeExtraArgs = { inherit uuid deploymentName ; } ;
59
52
defaults . environment . checkConfigurationOptions = lib . mkOverride 900 checkConfigurationOptions ;
60
53
# Make NixOps's deployment.* options available.
@@ -67,7 +60,7 @@ in rec {
67
60
networks = [ net . config ] ;
68
61
69
62
# skip problematic resources entries
70
- resources = lib . attrsets . filterAttrs ( n : v : lib . lists . all ( e : e != n ) [ "deployment" "_name" "_type" ] ) net . config . resources ;
63
+ resources = removeAttrs net . config . resources [ "deployment" "_name" "_type" ] ;
71
64
defaults = [ net . config . defaults ] ;
72
65
nodes = #TODO: take options and other modules outputs for each node
73
66
lib . mapAttrs ( n : v : {
@@ -76,36 +69,28 @@ in rec {
76
69
inherit ( v . nixpkgs ) pkgs ;
77
70
} ) net . config . nodes ;
78
71
79
- importedPluginNixExprs = map
80
- ( expr : import expr )
81
- pluginNixExprs ;
82
- pluginOptions = lib . foldl ( a : e : a ++ e . options ) [ ] importedPluginNixExprs ;
72
+ importedPluginNixExprs = map import pluginNixExprs ;
73
+ pluginOptions = lib . lists . concatMap ( e : e . options ) importedPluginNixExprs ;
83
74
pluginResources = map ( e : e . resources ) importedPluginNixExprs ;
84
- pluginDeploymentConfigExporters = ( lib . foldl
85
- ( a : e : a ++ ( e . config_exporters {
86
- inherit pkgs ;
87
- inherit ( lib ) optionalAttrs ;
88
- } ) ) [ ]
89
- importedPluginNixExprs ) ;
75
+ pluginDeploymentConfigExporters = lib . lists . concatMap ( e : e . config_exporters {
76
+ inherit pkgs ;
77
+ inherit ( lib ) optionalAttrs ;
78
+ } ) importedPluginNixExprs ;
90
79
91
80
# Compute the definitions of the non-machine resources.
92
81
resourcesByType = lib . zipAttrs ( network . resources or [ ] ) ;
93
82
94
- deploymentInfoModule = {
95
- deployment = {
96
- name = deploymentName ;
97
- arguments = args ;
98
- inherit uuid ;
99
- } ;
83
+ deploymentInfoModule . deployment = {
84
+ name = deploymentName ;
85
+ arguments = args ;
86
+ inherit uuid ;
100
87
} ;
101
88
102
- defaultResourceModule = {
103
- imports = [
104
- ./resource.nix
105
- resourceModuleArgs
106
- deploymentInfoModule
107
- ] ;
108
- } ;
89
+ defaultResourceModule . imports = [
90
+ ./resource.nix
91
+ resourceModuleArgs
92
+ deploymentInfoModule
93
+ ] ;
109
94
110
95
pluginResourceModules = lib . lists . concatMap ( lib . mapAttrsToList toResourceModule ) pluginResourceLegacyReprs ;
111
96
0 commit comments