confctl 1.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.editorconfig +1 -1
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +30 -1
- data/README.md +4 -9
- data/confctl.gemspec +14 -14
- data/docs/carrier.md +150 -0
- data/lib/confctl/cli/app.rb +19 -0
- data/lib/confctl/cli/cluster.rb +214 -49
- data/lib/confctl/cli/configuration.rb +7 -2
- data/lib/confctl/cli/gen_data.rb +19 -1
- data/lib/confctl/cli/generation.rb +47 -16
- data/lib/confctl/generation/build.rb +42 -1
- data/lib/confctl/generation/build_list.rb +10 -0
- data/lib/confctl/generation/host.rb +9 -5
- data/lib/confctl/generation/host_list.rb +22 -7
- data/lib/confctl/generation/unified.rb +5 -0
- data/lib/confctl/generation/unified_list.rb +10 -0
- data/lib/confctl/git_repo_mirror.rb +2 -2
- data/lib/confctl/machine.rb +105 -11
- data/lib/confctl/machine_control.rb +10 -2
- data/lib/confctl/machine_list.rb +18 -1
- data/lib/confctl/machine_status.rb +51 -4
- data/lib/confctl/nix.rb +90 -22
- data/lib/confctl/nix_copy.rb +5 -5
- data/lib/confctl/null_logger.rb +7 -0
- data/lib/confctl/swpins/specs/git.rb +1 -1
- data/lib/confctl/swpins/specs/git_rev.rb +1 -1
- data/lib/confctl/system_command.rb +3 -2
- data/lib/confctl/version.rb +1 -1
- data/libexec/auto-rollback.rb +106 -0
- data/man/man8/confctl-options.nix.8 +165 -1
- data/man/man8/confctl-options.nix.8.md +165 -1
- data/man/man8/confctl.8 +109 -73
- data/man/man8/confctl.8.md +86 -55
- data/nix/evaluator.nix +26 -7
- data/nix/lib/default.nix +64 -17
- data/nix/lib/machine/default.nix +14 -11
- data/nix/lib/machine/info.nix +3 -3
- data/nix/modules/cluster/default.nix +162 -3
- data/nix/modules/confctl/carrier/base.nix +35 -0
- data/nix/modules/confctl/carrier/carrier-env.rb +81 -0
- data/nix/modules/confctl/carrier/netboot/build-netboot-server.rb +962 -0
- data/nix/modules/confctl/carrier/netboot/nixos.nix +185 -0
- data/nix/modules/confctl/kexec-netboot/default.nix +36 -0
- data/nix/modules/confctl/kexec-netboot/kexec-netboot.8.adoc +62 -0
- data/nix/modules/confctl/kexec-netboot/kexec-netboot.rb +455 -0
- data/nix/modules/system-list.nix +10 -0
- metadata +17 -7
- data/.ruby-version +0 -1
data/man/man8/confctl.8.md
CHANGED
@@ -38,6 +38,11 @@ similarly to shell patterns, see
|
|
38
38
|
<http://ruby-doc.org/core/File.html#method-c-fnmatch-3F> for more
|
39
39
|
information.
|
40
40
|
|
41
|
+
## GENERATION OFFSETS
|
42
|
+
Generations can be selected by *offset*. `0` is the current (last) generation.
|
43
|
+
`1` is the first (oldest) generation, `2` the second generation, etc. `-1` is
|
44
|
+
the generation before last and so on.
|
45
|
+
|
41
46
|
## GLOBAL OPTIONS
|
42
47
|
`-c`, `--color` `always`|`never`|`auto`
|
43
48
|
Set output color mode. Defaults to `auto`, which enables colors when
|
@@ -113,6 +118,9 @@ information.
|
|
113
118
|
`-j`, `--max-jobs` *number*
|
114
119
|
Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
|
115
120
|
|
121
|
+
`--cores` *number*
|
122
|
+
Number of CPU cores to use, passed to `nix-build`. See man nix-build(1).
|
123
|
+
|
116
124
|
`confctl deploy` [*options*] [*machine-pattern* [`boot`|`switch`|`test`|`dry-activate`]]
|
117
125
|
Deploy either a new or an existing build generation to matching machines.
|
118
126
|
|
@@ -134,7 +142,7 @@ information.
|
|
134
142
|
`-y`, `--yes`
|
135
143
|
Do not ask for confirmation on standard input, assume the answer is yes.
|
136
144
|
|
137
|
-
`-g`, `--generation` *generation*|`current`
|
145
|
+
`-g`, `--generation` *generation*|*offset*|`current`
|
138
146
|
Do not build a new generation, but deploy an existing generation.
|
139
147
|
|
140
148
|
`--outdated`
|
@@ -165,6 +173,12 @@ information.
|
|
165
173
|
`--copy-only`
|
166
174
|
Do not activate the copied closures.
|
167
175
|
|
176
|
+
`--enable-auto-rollback`
|
177
|
+
Enable auto-rollback on deploy even if it is not enabled in machine configuration.
|
178
|
+
|
179
|
+
`--disable-auto-rollback`
|
180
|
+
Disable auto-rollback on deploy if it is enabled in machine configuration.
|
181
|
+
|
168
182
|
`--reboot`
|
169
183
|
Applicable only when *switch-action* is `boot`. Reboot the machine after the
|
170
184
|
configuration is activated.
|
@@ -176,6 +190,9 @@ information.
|
|
176
190
|
`-j`, `--max-jobs` *number*
|
177
191
|
Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
|
178
192
|
|
193
|
+
`--cores` *number*
|
194
|
+
Number of CPU cores to use, passed to `nix-build`. See man nix-build(1).
|
195
|
+
|
179
196
|
`--no-health-checks`
|
180
197
|
Do not run configured health checks. Health checks are run by default
|
181
198
|
when *switch-action* is `switch`, `test` or `boot` with `--reboot`.
|
@@ -216,7 +233,7 @@ information.
|
|
216
233
|
`-y`, `--yes`
|
217
234
|
Do not ask for confirmation on standard input, assume the answer is yes.
|
218
235
|
|
219
|
-
`-g`, `--generation` *generation*|`current`|`none`
|
236
|
+
`-g`, `--generation` *generation*|*offset*|`current`|`none`
|
220
237
|
Check status against a selected generation instead of a new build. If set
|
221
238
|
to `none`, only the currently configured software pins are checked and not
|
222
239
|
the system version itself.
|
@@ -224,6 +241,9 @@ information.
|
|
224
241
|
`-j`, `--max-jobs` *number*
|
225
242
|
Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
|
226
243
|
|
244
|
+
`--cores` *number*
|
245
|
+
Number of CPU cores to use, passed to `nix-build`. See man nix-build(1).
|
246
|
+
|
227
247
|
`confctl changelog` [*options*] [*machine-pattern* [*sw-pattern*]]
|
228
248
|
Show differences in deployed and configured software pins. For git software
|
229
249
|
pins, it's a git log.
|
@@ -249,7 +269,7 @@ information.
|
|
249
269
|
`-y`, `--yes`
|
250
270
|
Do not ask for confirmation on standard input, assume the answer is yes.
|
251
271
|
|
252
|
-
`-g`, `--generation` *generation*|`current`
|
272
|
+
`-g`, `--generation` *generation*|*offset*|`current`
|
253
273
|
Show changelog against software pins from a selected generation instead
|
254
274
|
of the current configuration.
|
255
275
|
|
@@ -267,6 +287,9 @@ information.
|
|
267
287
|
`-j`, `--max-jobs` *number*
|
268
288
|
Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
|
269
289
|
|
290
|
+
`--cores` *number*
|
291
|
+
Number of CPU cores to use, passed to `nix-build`. See man nix-build(1).
|
292
|
+
|
270
293
|
`confctl diff` [*options*] [*machine-pattern* [*sw-pattern*]]
|
271
294
|
Show differences in deployed and configured software pins. For git software
|
272
295
|
pins, it's a git diff.
|
@@ -292,7 +315,7 @@ information.
|
|
292
315
|
`-y`, `--yes`
|
293
316
|
Do not ask for confirmation on standard input, assume the answer is yes.
|
294
317
|
|
295
|
-
`-g`, `--generation` *generation*|`current`
|
318
|
+
`-g`, `--generation` *generation*|*offset*|`current`
|
296
319
|
Show diff against software pins from a selected generation instead
|
297
320
|
of the current configuration.
|
298
321
|
|
@@ -304,6 +327,9 @@ information.
|
|
304
327
|
`-j`, `--max-jobs` *number*
|
305
328
|
Maximum number of build jobs, passed to `nix-build`. See man nix-build(1).
|
306
329
|
|
330
|
+
`--cores` *number*
|
331
|
+
Number of CPU cores to use, passed to `nix-build`. See man nix-build(1).
|
332
|
+
|
307
333
|
`confctl test-connection` [*options*] [*machine-pattern*]
|
308
334
|
Try to open a SSH connection to the selected machines. This command can be
|
309
335
|
used to confirm SSH host keys of the selected machines.
|
@@ -381,7 +407,7 @@ information.
|
|
381
407
|
`-y`, `--yes`
|
382
408
|
Do not ask for confirmation on standard input, assume the answer is yes.
|
383
409
|
|
384
|
-
`confctl generation ls` [*machine-pattern* [*generation-pattern*]|*n*`d
|
410
|
+
`confctl generation ls` [*machine-pattern* [*generation-pattern*]|*n*`d`|*offset*|`old`]
|
385
411
|
List all or selected generations. By default only local build generations
|
386
412
|
are listed.
|
387
413
|
|
@@ -400,11 +426,13 @@ information.
|
|
400
426
|
`-r`, `--remote`
|
401
427
|
List remote generations found on deployed machines.
|
402
428
|
|
403
|
-
`confctl generation rm` [*machine-pattern* [*generation-pattern*|*n*`d
|
429
|
+
`confctl generation rm` [*machine-pattern* [*generation-pattern*|*n*`d`|*offset*|`old`]]
|
404
430
|
Remove selected generations.
|
405
431
|
|
406
432
|
*n*`d` will remove generations older than *n* days.
|
407
433
|
|
434
|
+
*offset* will remove generations at a specific offset, see `GENERATION OFFSETS`.
|
435
|
+
|
408
436
|
`old` will remove all generations except the current one, i.e. the one that
|
409
437
|
was built by `confctl build` the last.
|
410
438
|
|
@@ -461,6 +489,9 @@ information.
|
|
461
489
|
`-r`, `--remote`
|
462
490
|
Consider generations found on deployed machines.
|
463
491
|
|
492
|
+
`--no-gc`, `--no-collect-garbage`
|
493
|
+
Do not run the garbage collector even if it is enabled in configuration.
|
494
|
+
|
464
495
|
`--max-concurrent-gc` *n*
|
465
496
|
Run `nix-collect-garbage` at most on *n* machines at the same time.
|
466
497
|
Defaults to `5`.
|
@@ -516,16 +547,16 @@ information.
|
|
516
547
|
Update selected or all software packages that have been configured to support
|
517
548
|
this command. The usual case for git is to pin to the current branch head.
|
518
549
|
|
519
|
-
|
520
|
-
|
550
|
+
`--[no-]commit`
|
551
|
+
Commit changed swpins files to git. Disabled by default.
|
521
552
|
|
522
|
-
|
523
|
-
|
524
|
-
|
553
|
+
`--[no-]changelog`
|
554
|
+
Include changelog in the commit message when `--commit` is used. Enabled by
|
555
|
+
default.
|
525
556
|
|
526
|
-
|
527
|
-
|
528
|
-
|
557
|
+
`-d`, `--downgrade`
|
558
|
+
Use when the new version is older than the previously set version. Used for
|
559
|
+
generating changelog for the commit message.
|
529
560
|
|
530
561
|
`confctl swpins channel ls` [*channel-pattern* [*sw-pattern*]]
|
531
562
|
List existing channels with pinned software packages.
|
@@ -535,32 +566,32 @@ information.
|
|
535
566
|
of *version* depends on the type of the software pin, for git it is a git
|
536
567
|
reference, e.g. a revision.
|
537
568
|
|
538
|
-
|
539
|
-
|
569
|
+
`--[no-]commit`
|
570
|
+
Commit changed swpins files to git. Disabled by default.
|
540
571
|
|
541
|
-
|
542
|
-
|
543
|
-
|
572
|
+
`--[no-]changelog`
|
573
|
+
Include changelog in the commit message when `--commit` is used. Enabled by
|
574
|
+
default.
|
544
575
|
|
545
|
-
|
546
|
-
|
547
|
-
|
576
|
+
`-d`, `--downgrade`
|
577
|
+
Use when the new version is older than the previously set version. Used for
|
578
|
+
generating changelog for the commit message.
|
548
579
|
|
549
580
|
`confctl swpins channel update` [*channel-pattern* [*sw-pattern*]]
|
550
581
|
Update selected or all software packages in channels that have been configured
|
551
582
|
to support this command. The usual case for git is to pin to the current
|
552
583
|
branch head.
|
553
584
|
|
554
|
-
|
555
|
-
|
585
|
+
`--[no-]commit`
|
586
|
+
Commit changed swpins files to git. Disabled by default.
|
556
587
|
|
557
|
-
|
558
|
-
|
559
|
-
|
588
|
+
`--[no-]changelog`
|
589
|
+
Include changelog in the commit message when `--commit` is used. Enabled by
|
590
|
+
default.
|
560
591
|
|
561
|
-
|
562
|
-
|
563
|
-
|
592
|
+
`-d`, `--downgrade`
|
593
|
+
Use when the new version is older than the previously set version. Used for
|
594
|
+
generating changelog for the commit message.
|
564
595
|
|
565
596
|
`confctl swpins core ls` [*sw-pattern*]
|
566
597
|
List core software packages used internally by confctl.
|
@@ -570,47 +601,47 @@ information.
|
|
570
601
|
of *version* depends on the type of the software pin, for git it is a git
|
571
602
|
reference, e.g. a revision.
|
572
603
|
|
573
|
-
|
574
|
-
|
604
|
+
`--[no-]commit`
|
605
|
+
Commit changed swpins files to git. Disabled by default.
|
575
606
|
|
576
|
-
|
577
|
-
|
578
|
-
|
607
|
+
`--[no-]changelog`
|
608
|
+
Include changelog in the commit message when `--commit` is used. Enabled by
|
609
|
+
default.
|
579
610
|
|
580
|
-
|
581
|
-
|
582
|
-
|
611
|
+
`-d`, `--downgrade`
|
612
|
+
Use when the new version is older than the previously set version. Used for
|
613
|
+
generating changelog for the commit message.
|
583
614
|
|
584
615
|
`confctl swpins core update` [*sw-pattern*]
|
585
616
|
Update selected or all core software packages that have been configured
|
586
617
|
to support this command. The usual case for git is to pin to the current
|
587
618
|
branch head.
|
588
619
|
|
589
|
-
|
590
|
-
|
620
|
+
`--[no-]commit`
|
621
|
+
Commit changed swpins files to git. Disabled by default.
|
591
622
|
|
592
|
-
|
593
|
-
|
594
|
-
|
623
|
+
`--[no-]changelog`
|
624
|
+
Include changelog in the commit message when `--commit` is used. Enabled by
|
625
|
+
default.
|
595
626
|
|
596
|
-
|
597
|
-
|
598
|
-
|
627
|
+
`-d`, `--downgrade`
|
628
|
+
Use when the new version is older than the previously set version. Used for
|
629
|
+
generating changelog for the commit message.
|
599
630
|
|
600
631
|
`confctl swpins update`
|
601
632
|
Update software pins that have been configured for updates, including pins
|
602
633
|
in all channels, all machine-specific pins and the core pins.
|
603
634
|
|
604
|
-
|
605
|
-
|
635
|
+
`--[no-]commit`
|
636
|
+
Commit changed swpins files to git. Disabled by default.
|
606
637
|
|
607
|
-
|
608
|
-
|
609
|
-
|
638
|
+
`--[no-]changelog`
|
639
|
+
Include changelog in the commit message when `--commit` is used. Enabled by
|
640
|
+
default.
|
610
641
|
|
611
|
-
|
612
|
-
|
613
|
-
|
642
|
+
`-d`, `--downgrade`
|
643
|
+
Use when the new version is older than the previously set version. Used for
|
644
|
+
generating changelog for the commit message.
|
614
645
|
|
615
646
|
`confctl swpins reconfigure`
|
616
647
|
Regenerate all confctl-managed software pin files according to the Nix
|
@@ -650,5 +681,5 @@ Report bugs to https://github.com/vpsfreecz/confctl/issues.
|
|
650
681
|
|
651
682
|
## ABOUT
|
652
683
|
`confctl` was originally developed for the purposes of
|
653
|
-
[vpsFree.cz](https://vpsfree.org) and its cluster
|
684
|
+
[vpsFree.cz](https://vpsfree.org) and its cluster
|
654
685
|
[configuration](https://github.com/vpsfreecz/vpsfree-cz-configuration).
|
data/nix/evaluator.nix
CHANGED
@@ -18,8 +18,8 @@ let
|
|
18
18
|
nameValuePairs = builtins.map (m: {
|
19
19
|
name = m.name;
|
20
20
|
value = {
|
21
|
-
inherit (m) name;
|
22
|
-
}
|
21
|
+
inherit (m) name alias clusterName carrier metaConfig;
|
22
|
+
};
|
23
23
|
}) machines;
|
24
24
|
|
25
25
|
machinesAttrs = builtins.listToAttrs nameValuePairs;
|
@@ -53,7 +53,7 @@ let
|
|
53
53
|
import ./lib/swpins/eval.nix {
|
54
54
|
inherit (arg) confDir;
|
55
55
|
name = m.name;
|
56
|
-
channels = m.
|
56
|
+
channels = m.metaConfig.swpins.channels;
|
57
57
|
pkgs = corePkgs.pkgs;
|
58
58
|
lib = corePkgs.lib;
|
59
59
|
};
|
@@ -70,17 +70,36 @@ let
|
|
70
70
|
value = buildToplevel fullMachinesAttrs.${host};
|
71
71
|
}) arg.machines);
|
72
72
|
|
73
|
-
buildToplevel =
|
73
|
+
buildToplevel = machine:
|
74
|
+
let
|
75
|
+
machineConfig = (evalMachine machine).config;
|
76
|
+
|
77
|
+
buildAttr = coreLib.attrByPath machine.build.attribute null machineConfig;
|
78
|
+
|
79
|
+
result =
|
80
|
+
if isNull buildAttr then
|
81
|
+
abort "Attribute 'config.${coreLib.concatStringsSep "." machine.build.attribute}' not found on machine ${machine.name}"
|
82
|
+
else
|
83
|
+
buildAttr;
|
84
|
+
in {
|
85
|
+
attribute = result;
|
86
|
+
|
87
|
+
autoRollback = corePkgs.substituteAll {
|
88
|
+
src = ../libexec/auto-rollback.rb;
|
89
|
+
isExecutable = true;
|
90
|
+
ruby = nixpkgs.ruby;
|
91
|
+
};
|
92
|
+
};
|
74
93
|
|
75
|
-
evalMachine =
|
94
|
+
evalMachine = machine:
|
76
95
|
let
|
77
96
|
importPath = {
|
78
97
|
nixos = <nixpkgs/nixos/lib/eval-config.nix>;
|
79
98
|
vpsadminos = <vpsadminos/os/default.nix>;
|
80
99
|
};
|
81
100
|
|
82
|
-
evalConfig = import importPath.${
|
83
|
-
modules = [
|
101
|
+
evalConfig = import importPath.${machine.metaConfig.spin} {
|
102
|
+
modules = machine.extraModules ++ [ machine.build.toplevel ];
|
84
103
|
};
|
85
104
|
in evalConfig;
|
86
105
|
|
data/nix/lib/default.nix
CHANGED
@@ -1,29 +1,74 @@
|
|
1
1
|
{ confDir, coreLib, corePkgs }:
|
2
2
|
with coreLib;
|
3
3
|
let
|
4
|
-
machine = import ./machine { inherit confDir corePkgs coreLib
|
4
|
+
machine = import ./machine { inherit confDir corePkgs coreLib findMetaConfig; };
|
5
5
|
|
6
|
-
|
6
|
+
findMetaConfig =
|
7
7
|
{ cluster, name }:
|
8
8
|
cluster.${name};
|
9
9
|
|
10
10
|
makeMachine =
|
11
|
-
{ name,
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
{ name, metaConfig, carrier ? null, alias ? null, clusterName ? null, extraModules ? [], buildAttribute ? null }:
|
12
|
+
let
|
13
|
+
ensuredClusterName = if isNull clusterName then name else clusterName;
|
14
|
+
in {
|
15
|
+
inherit name alias metaConfig carrier extraModules;
|
16
|
+
clusterName = ensuredClusterName;
|
17
|
+
|
18
|
+
build = {
|
19
|
+
attribute = if isNull buildAttribute then metaConfig.buildAttribute else buildAttribute;
|
20
|
+
toplevel = buildConfig { name = ensuredClusterName; inherit metaConfig; };
|
21
|
+
};
|
15
22
|
};
|
16
23
|
|
17
24
|
buildConfig =
|
18
|
-
{ name,
|
19
|
-
if !
|
25
|
+
{ name, metaConfig }:
|
26
|
+
if !metaConfig.managed then
|
20
27
|
null
|
21
|
-
else if
|
22
|
-
machine.nixos { inherit name
|
23
|
-
else if
|
24
|
-
machine.vpsadminos { inherit name
|
28
|
+
else if metaConfig.spin == "nixos" then
|
29
|
+
machine.nixos { inherit name metaConfig; }
|
30
|
+
else if metaConfig.spin == "vpsadminos" then
|
31
|
+
machine.vpsadminos { inherit name metaConfig; }
|
25
32
|
else
|
26
33
|
null;
|
34
|
+
|
35
|
+
expandCarriers = machineAttrs: flatten (mapAttrsToList (name: m:
|
36
|
+
if m.metaConfig.carrier.enable then
|
37
|
+
[ m ] ++ (expandCarrier machineAttrs m)
|
38
|
+
else
|
39
|
+
m
|
40
|
+
) machineAttrs);
|
41
|
+
|
42
|
+
expandCarrier = machineAttrs: carrierMachine: map (cm:
|
43
|
+
makeMachine {
|
44
|
+
name = "${carrierMachine.name}#${if isNull cm.alias then cm.machine else cm.alias}";
|
45
|
+
alias = cm.alias;
|
46
|
+
clusterName = cm.machine;
|
47
|
+
carrier = carrierMachine.name;
|
48
|
+
extraModules = cm.extraModules;
|
49
|
+
buildAttribute = cm.buildAttribute;
|
50
|
+
metaConfig = coreLib.updateManyAttrsByPath ([
|
51
|
+
{
|
52
|
+
path = [ "labels" ];
|
53
|
+
update = old: old // cm.labels;
|
54
|
+
}
|
55
|
+
{
|
56
|
+
path = [ "tags" ];
|
57
|
+
update = old: old ++ cm.tags;
|
58
|
+
}
|
59
|
+
] ++ (generationUpdates cm)) machineAttrs.${cm.machine}.metaConfig;
|
60
|
+
}
|
61
|
+
) carrierMachine.metaConfig.carrier.machines;
|
62
|
+
|
63
|
+
generationUpdates = cm:
|
64
|
+
flatten (map (generations:
|
65
|
+
map (attr: {
|
66
|
+
path = [ generations attr ];
|
67
|
+
update = old:
|
68
|
+
let v = cm.${generations}.${attr};
|
69
|
+
in if isNull v then old else v;
|
70
|
+
}) [ "min" "max" "maxAge" ]
|
71
|
+
) [ "buildGenerations" "hostGenerations" ]);
|
27
72
|
in rec {
|
28
73
|
inherit corePkgs coreLib;
|
29
74
|
|
@@ -35,20 +80,22 @@ in rec {
|
|
35
80
|
mkNetUdevRule name mac
|
36
81
|
) rs);
|
37
82
|
|
38
|
-
inherit
|
83
|
+
inherit findMetaConfig;
|
39
84
|
|
40
85
|
# Return all configured machines in a list
|
41
86
|
getClusterMachines = cluster:
|
42
|
-
|
43
|
-
|
44
|
-
|
87
|
+
let
|
88
|
+
machineAttrs = mapAttrs (name: metaConfig:
|
89
|
+
makeMachine { inherit name metaConfig; }
|
90
|
+
) cluster;
|
91
|
+
in expandCarriers machineAttrs;
|
45
92
|
|
46
93
|
# Get IP version addresses from all machines in a cluster
|
47
94
|
getAllAddressesOf = cluster: v:
|
48
95
|
let
|
49
96
|
machines = getClusterMachines cluster;
|
50
97
|
addresses = flatten (map (machine:
|
51
|
-
map (addr: machine // addr) machine.
|
98
|
+
map (addr: machine // addr) machine.metaConfig.addresses.${"v${toString v}"}
|
52
99
|
) machines);
|
53
100
|
in addresses;
|
54
101
|
|
data/nix/lib/machine/default.nix
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
{ confDir, corePkgs, coreLib,
|
1
|
+
{ confDir, corePkgs, coreLib, findMetaConfig }:
|
2
2
|
let
|
3
3
|
swpinsFor =
|
4
|
-
{ name,
|
4
|
+
{ name, metaConfig }:
|
5
5
|
import ../swpins/eval.nix {
|
6
6
|
inherit confDir name;
|
7
|
-
channels =
|
7
|
+
channels = metaConfig.swpins.channels;
|
8
8
|
pkgs = corePkgs;
|
9
9
|
lib = coreLib;
|
10
10
|
};
|
11
11
|
|
12
12
|
makeModuleArgs =
|
13
|
-
{
|
13
|
+
{ metaConfig, swpins, spin, name }@args: {
|
14
14
|
swpins = swpins.evaluated;
|
15
15
|
swpinsInfo = swpins.infos;
|
16
|
-
confMachine = import ./info.nix (args // { inherit
|
16
|
+
confMachine = import ./info.nix (args // { inherit findMetaConfig; });
|
17
17
|
};
|
18
18
|
|
19
19
|
makeImports = spin: extraImports: [
|
@@ -34,18 +34,20 @@ let
|
|
34
34
|
lib.mkIf (confMachine.host != null) (lib.mkDefault confMachine.host.fullDomain);
|
35
35
|
})
|
36
36
|
] ++ (import ../../modules/module-list.nix).${spin}
|
37
|
+
++ (import ../../modules/system-list.nix).${spin}
|
37
38
|
++ (import "${toString confDir}/modules/module-list.nix").${spin}
|
38
39
|
++ (import "${toString confDir}/cluster/module-list.nix")
|
39
40
|
++ extraImports;
|
40
41
|
in rec {
|
41
|
-
nixos = { name,
|
42
|
+
nixos = { name, metaConfig }:
|
42
43
|
let
|
43
|
-
swpins = swpinsFor { inherit name
|
44
|
+
swpins = swpinsFor { inherit name metaConfig; };
|
44
45
|
in
|
45
46
|
{ config, pkgs, ... }@args:
|
46
47
|
{
|
47
48
|
_module.args = makeModuleArgs {
|
48
|
-
|
49
|
+
metaConfig = config;
|
50
|
+
inherit swpins;
|
49
51
|
spin = "nixos";
|
50
52
|
inherit name;
|
51
53
|
};
|
@@ -55,14 +57,15 @@ in rec {
|
|
55
57
|
];
|
56
58
|
};
|
57
59
|
|
58
|
-
vpsadminos = { name,
|
60
|
+
vpsadminos = { name, metaConfig }:
|
59
61
|
let
|
60
|
-
swpins = swpinsFor { inherit name
|
62
|
+
swpins = swpinsFor { inherit name metaConfig; };
|
61
63
|
in
|
62
64
|
{ config, pkgs, ... }@args:
|
63
65
|
{
|
64
66
|
_module.args = makeModuleArgs {
|
65
|
-
|
67
|
+
metaConfig = config;
|
68
|
+
inherit swpins;
|
66
69
|
spin = "vpsadminos";
|
67
70
|
inherit name;
|
68
71
|
};
|
data/nix/lib/machine/info.nix
CHANGED