confctl 2.2.2 → 3.0.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/.git-hooks/pre_commit/nixfmt.rb +13 -0
- data/.github/workflows/rspec.yml +64 -0
- data/.github/workflows/rubocop.yml +27 -0
- data/.github/workflows/tests.yml +139 -0
- data/.gitignore +12 -7
- data/.overcommit.yml +2 -0
- data/.rspec +1 -0
- data/.rubocop.yml +8 -1
- data/AGENTS.md +42 -0
- data/CHANGELOG.md +57 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +198 -0
- data/README.md +166 -58
- data/Rakefile +5 -0
- data/confctl.gemspec +20 -2
- data/docs/carrier.md +3 -3
- data/docs/flake-inputs.md +159 -0
- data/docs/swpins-to-flakes.md +325 -0
- data/example/cluster/module-list.nix +2 -1
- data/example/cluster/nixos-machine/config.nix +12 -2
- data/example/cluster/nixos-machine/hardware.nix +6 -1
- data/example/cluster/vpsadminos-container/config.nix +6 -1
- data/example/cluster/vpsadminos-container/module.nix +4 -1
- data/example/cluster/vpsadminos-machine/config.nix +6 -1
- data/example/cluster/vpsadminos-machine/hardware.nix +6 -1
- data/example/cluster/vpsadminos-machine/module.nix +5 -2
- data/example/cluster/vpsfreecz-vps/config.nix +6 -1
- data/example/cluster/vpsfreecz-vps/module.nix +4 -1
- data/example/configs/swpins.nix +8 -3
- data/example/environments/base.nix +6 -1
- data/example/swpins/core.json +35 -0
- data/example-flake/.gitignore +2 -0
- data/example-flake/README.md +38 -0
- data/example-flake/cluster/cluster.nix +5 -0
- data/example-flake/cluster/module-list.nix +4 -0
- data/example-flake/cluster/nested/nixos-machine/config.nix +25 -0
- data/example-flake/cluster/nested/nixos-machine/hardware.nix +9 -0
- data/example-flake/cluster/nested/nixos-machine/module.nix +8 -0
- data/example-flake/cluster/nixos-machine/config.nix +25 -0
- data/example-flake/cluster/nixos-machine/hardware.nix +9 -0
- data/example-flake/cluster/nixos-machine/module.nix +8 -0
- data/example-flake/cluster/vpsadminos-container/config.nix +28 -0
- data/example-flake/cluster/vpsadminos-container/module.nix +8 -0
- data/example-flake/cluster/vpsadminos-machine/config.nix +27 -0
- data/example-flake/cluster/vpsadminos-machine/hardware.nix +9 -0
- data/example-flake/cluster/vpsadminos-machine/module.nix +8 -0
- data/example-flake/cluster/vpsfreecz-vps/config.nix +31 -0
- data/example-flake/cluster/vpsfreecz-vps/module.nix +8 -0
- data/example-flake/configs/confctl.nix +10 -0
- data/example-flake/data/default.nix +5 -0
- data/example-flake/data/ssh-keys.nix +7 -0
- data/example-flake/environments/base.nix +18 -0
- data/example-flake/flake.lock +75 -0
- data/example-flake/flake.nix +36 -0
- data/example-flake/modules/module-list.nix +13 -0
- data/example-flake/shell.nix +11 -0
- data/flake.lock +159 -0
- data/flake.nix +189 -0
- data/gemset.nix +1022 -0
- data/lib/confctl/cli/app.rb +145 -0
- data/lib/confctl/cli/attr_filters.rb +1 -1
- data/lib/confctl/cli/cluster.rb +681 -108
- data/lib/confctl/cli/command.rb +24 -2
- data/lib/confctl/cli/configuration.rb +171 -106
- data/lib/confctl/cli/generation.rb +65 -1
- data/lib/confctl/cli/inputs/channels.rb +190 -0
- data/lib/confctl/cli/inputs/machines.rb +83 -0
- data/lib/confctl/cli/inputs/root.rb +101 -0
- data/lib/confctl/cli/inputs.rb +5 -0
- data/lib/confctl/cli/log_view.rb +21 -10
- data/lib/confctl/cli/migrate/swpins_to_flakes.rb +866 -0
- data/lib/confctl/cli/migrate.rb +5 -0
- data/lib/confctl/cli/output_formatter.rb +5 -7
- data/lib/confctl/cli/swpins/base.rb +9 -0
- data/lib/confctl/cli/swpins/channel.rb +2 -5
- data/lib/confctl/cli/swpins/cluster.rb +2 -5
- data/lib/confctl/cli/swpins/core.rb +2 -5
- data/lib/confctl/config_type.rb +7 -0
- data/lib/confctl/flake_lock.rb +78 -0
- data/lib/confctl/flake_lock_diff.rb +36 -0
- data/lib/confctl/generation/build.rb +131 -24
- data/lib/confctl/generation/build_list.rb +4 -3
- data/lib/confctl/generation/unified.rb +14 -1
- data/lib/confctl/git_repo_mirror.rb +2 -2
- data/lib/confctl/health_checks/run_command.rb +3 -2
- data/lib/confctl/health_checks/systemd/properties.rb +1 -1
- data/lib/confctl/health_checks/systemd/property_list.rb +2 -2
- data/lib/confctl/inputs/commit_message.rb +125 -0
- data/lib/confctl/inputs/git_commit.rb +17 -0
- data/lib/confctl/inputs/nix_output_guard.rb +37 -0
- data/lib/confctl/inputs/setter.rb +179 -0
- data/lib/confctl/inputs/updater.rb +76 -0
- data/lib/confctl/inputs.rb +5 -0
- data/lib/confctl/inputs_info.rb +50 -0
- data/lib/confctl/line_buffer.rb +1 -1
- data/lib/confctl/machine.rb +18 -3
- data/lib/confctl/machine_control.rb +8 -2
- data/lib/confctl/machine_list.rb +2 -2
- data/lib/confctl/machine_status.rb +63 -20
- data/lib/confctl/nix/args.rb +48 -0
- data/lib/confctl/nix.rb +30 -437
- data/lib/confctl/nix_build_flake.rb +95 -0
- data/lib/confctl/nix_copy.rb +14 -2
- data/lib/confctl/nix_flake.rb +449 -0
- data/lib/confctl/nix_format.rb +3 -3
- data/lib/confctl/nix_legacy.rb +467 -0
- data/lib/confctl/swpins/change_set.rb +29 -3
- data/lib/confctl/swpins/specs/base.rb +2 -2
- data/lib/confctl/ui.rb +19 -0
- data/lib/confctl/version.rb +1 -1
- data/man/index.html +11 -0
- data/man/man8/confctl-options.nix.8.html +113 -0
- data/man/man8/confctl.8 +152 -21
- data/man/man8/confctl.8.html +355 -0
- data/man/man8/confctl.8.md +148 -17
- data/man/style.css +301 -0
- data/nix/evaluator.nix +94 -69
- data/nix/flake/mk-confctl-devshell.nix +85 -0
- data/nix/flake/mk-confctl-outputs.nix +522 -0
- data/nix/flake/mk-config-devshell.nix +168 -0
- data/nix/lib/default.nix +118 -65
- data/nix/lib/machine/default.nix +65 -45
- data/nix/lib/machine/info.nix +16 -5
- data/nix/lib/swpins/eval.nix +42 -29
- data/nix/lib/swpins/options.nix +6 -2
- data/nix/machines.nix +23 -15
- data/nix/modules/cluster/default.nix +104 -41
- data/nix/modules/confctl/carrier/base.nix +11 -4
- data/nix/modules/confctl/carrier/carrier-env.rb +2 -2
- data/nix/modules/confctl/carrier/netboot/build-netboot-server.rb +50 -16
- data/nix/modules/confctl/carrier/netboot/nixos.nix +56 -24
- data/nix/modules/confctl/configuration-info.nix +17 -0
- data/nix/modules/confctl/generations.nix +2 -2
- data/nix/modules/confctl/host.nix +13 -0
- data/nix/modules/confctl/inputs-info.nix +21 -0
- data/nix/modules/confctl/kexec-netboot/default.nix +13 -6
- data/nix/modules/confctl/kexec-netboot/kexec-netboot.8.adoc +3 -0
- data/nix/modules/confctl/kexec-netboot/kexec-netboot.rb +25 -16
- data/nix/modules/confctl/nix.nix +31 -1
- data/nix/modules/confctl/swpins.nix +13 -6
- data/nix/modules/module-list.nix +4 -2
- data/nix/modules/system-list.nix +4 -1
- data/nix/package.nix +37 -0
- data/shell.nix +39 -8
- data/skills/confctl-configuration-update/SKILL.md +228 -0
- data/skills/confctl-configuration-update/agents/openai.yaml +4 -0
- data/skills/confctl-release/SKILL.md +102 -0
- data/skills/confctl-release/agents/openai.yaml +4 -0
- data/spec/confctl/cli/cluster_health_check_spec.rb +43 -0
- data/spec/confctl/cli/cluster_skip_current_deploy_spec.rb +157 -0
- data/spec/confctl/cli/cluster_status_flake_spec.rb +83 -0
- data/spec/confctl/cli/inputs_set_output_spec.rb +70 -0
- data/spec/confctl/configuration_spec.rb +45 -0
- data/spec/confctl/inputs_spec.rb +104 -0
- data/spec/confctl/machine_control_spec.rb +112 -0
- data/spec/confctl/machine_list_spec.rb +47 -0
- data/spec/confctl/nix_flake_spec.rb +41 -0
- data/spec/confctl/swpins_spec.rb +106 -0
- data/spec/generation/build_modes_spec.rb +132 -0
- data/spec/inputs/commit_message_spec.rb +205 -0
- data/spec/inputs/nix_cached_fallback_spec.rb +50 -0
- data/spec/inputs/nix_output_guard_spec.rb +45 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/support/cli_helper.rb +57 -0
- data/test-runner.sh +7 -0
- data/tests/all-tests.nix +30 -0
- data/tests/make-test.nix +15 -0
- data/tests/runner/extensions/confctl_helpers.rb +238 -0
- data/tests/runner/extensions/hostfwd_ports.rb +41 -0
- data/tests/suite/auto_rollback.nix +344 -0
- data/tests/suite/carrier/deploy.nix +751 -0
- data/tests/suite/carrier/netboot.nix +849 -0
- data/tests/suite/deploy/base.nix +806 -0
- data/tests/suite/deploy/flakes.nix +1 -0
- data/tests/suite/deploy/swpins.nix +1 -0
- metadata +104 -4
- data/nix/modules/confctl/overlays.nix +0 -15
data/nix/lib/default.nix
CHANGED
|
@@ -1,23 +1,50 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
confDir,
|
|
3
|
+
coreLib,
|
|
4
|
+
corePkgs,
|
|
5
|
+
}:
|
|
2
6
|
with coreLib;
|
|
3
7
|
let
|
|
4
|
-
machine = import ./machine {
|
|
8
|
+
machine = import ./machine {
|
|
9
|
+
inherit
|
|
10
|
+
confDir
|
|
11
|
+
corePkgs
|
|
12
|
+
coreLib
|
|
13
|
+
findMetaConfig
|
|
14
|
+
;
|
|
15
|
+
};
|
|
5
16
|
|
|
6
|
-
findMetaConfig =
|
|
7
|
-
{ cluster, name }:
|
|
8
|
-
cluster.${name};
|
|
17
|
+
findMetaConfig = { cluster, name }: cluster.${name};
|
|
9
18
|
|
|
10
19
|
makeMachine =
|
|
11
|
-
{
|
|
20
|
+
{
|
|
21
|
+
name,
|
|
22
|
+
metaConfig,
|
|
23
|
+
carrier ? null,
|
|
24
|
+
alias ? null,
|
|
25
|
+
clusterName ? null,
|
|
26
|
+
extraModules ? [ ],
|
|
27
|
+
buildAttribute ? null,
|
|
28
|
+
}:
|
|
12
29
|
let
|
|
13
30
|
ensuredClusterName = if isNull clusterName then name else clusterName;
|
|
14
|
-
in
|
|
15
|
-
|
|
31
|
+
in
|
|
32
|
+
{
|
|
33
|
+
inherit
|
|
34
|
+
name
|
|
35
|
+
alias
|
|
36
|
+
metaConfig
|
|
37
|
+
carrier
|
|
38
|
+
extraModules
|
|
39
|
+
;
|
|
16
40
|
clusterName = ensuredClusterName;
|
|
17
41
|
|
|
18
42
|
build = {
|
|
19
43
|
attribute = if isNull buildAttribute then metaConfig.buildAttribute else buildAttribute;
|
|
20
|
-
toplevel = buildConfig {
|
|
44
|
+
toplevel = buildConfig {
|
|
45
|
+
name = ensuredClusterName;
|
|
46
|
+
inherit metaConfig;
|
|
47
|
+
};
|
|
21
48
|
};
|
|
22
49
|
};
|
|
23
50
|
|
|
@@ -32,75 +59,105 @@ let
|
|
|
32
59
|
else
|
|
33
60
|
null;
|
|
34
61
|
|
|
35
|
-
expandCarriers =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
62
|
+
expandCarriers =
|
|
63
|
+
machineAttrs:
|
|
64
|
+
flatten (
|
|
65
|
+
mapAttrsToList (
|
|
66
|
+
name: m: if m.metaConfig.carrier.enable then [ m ] ++ (expandCarrier machineAttrs m) else m
|
|
67
|
+
) machineAttrs
|
|
68
|
+
);
|
|
41
69
|
|
|
42
|
-
expandCarrier =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
expandCarrier =
|
|
71
|
+
machineAttrs: carrierMachine:
|
|
72
|
+
map (
|
|
73
|
+
cm:
|
|
74
|
+
makeMachine {
|
|
75
|
+
name = "${carrierMachine.name}#${if isNull cm.alias then cm.machine else cm.alias}";
|
|
76
|
+
alias = cm.alias;
|
|
77
|
+
clusterName = cm.machine;
|
|
78
|
+
carrier = carrierMachine.name;
|
|
79
|
+
extraModules = cm.extraModules;
|
|
80
|
+
buildAttribute = cm.buildAttribute;
|
|
81
|
+
metaConfig = coreLib.updateManyAttrsByPath (
|
|
82
|
+
[
|
|
83
|
+
{
|
|
84
|
+
path = [ "labels" ];
|
|
85
|
+
update = old: old // cm.labels;
|
|
86
|
+
}
|
|
87
|
+
{
|
|
88
|
+
path = [ "tags" ];
|
|
89
|
+
update = old: old ++ cm.tags;
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
++ (generationUpdates cm)
|
|
93
|
+
) machineAttrs.${cm.machine}.metaConfig;
|
|
94
|
+
}
|
|
95
|
+
) carrierMachine.metaConfig.carrier.machines;
|
|
62
96
|
|
|
63
|
-
generationUpdates =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
97
|
+
generationUpdates =
|
|
98
|
+
cm:
|
|
99
|
+
flatten (
|
|
100
|
+
map
|
|
101
|
+
(
|
|
102
|
+
generations:
|
|
103
|
+
map
|
|
104
|
+
(attr: {
|
|
105
|
+
path = [
|
|
106
|
+
generations
|
|
107
|
+
attr
|
|
108
|
+
];
|
|
109
|
+
update =
|
|
110
|
+
old:
|
|
111
|
+
let
|
|
112
|
+
v = cm.${generations}.${attr};
|
|
113
|
+
in
|
|
114
|
+
if isNull v then old else v;
|
|
115
|
+
})
|
|
116
|
+
[
|
|
117
|
+
"min"
|
|
118
|
+
"max"
|
|
119
|
+
"maxAge"
|
|
120
|
+
]
|
|
121
|
+
)
|
|
122
|
+
[
|
|
123
|
+
"buildGenerations"
|
|
124
|
+
"hostGenerations"
|
|
125
|
+
]
|
|
126
|
+
);
|
|
127
|
+
in
|
|
128
|
+
rec {
|
|
73
129
|
inherit corePkgs coreLib;
|
|
74
130
|
|
|
75
131
|
mkNetUdevRule = name: mac: ''
|
|
76
|
-
|
|
132
|
+
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", KERNEL=="eth*", ATTR{address}=="${mac}", NAME="${name}"
|
|
77
133
|
'';
|
|
78
134
|
|
|
79
|
-
mkNetUdevRules = rs: concatStringsSep "\n" (mapAttrsToList (name: mac:
|
|
80
|
-
mkNetUdevRule name mac
|
|
81
|
-
) rs);
|
|
135
|
+
mkNetUdevRules = rs: concatStringsSep "\n" (mapAttrsToList (name: mac: mkNetUdevRule name mac) rs);
|
|
82
136
|
|
|
83
137
|
inherit findMetaConfig;
|
|
84
138
|
|
|
85
139
|
# Return all configured machines in a list
|
|
86
|
-
getClusterMachines =
|
|
140
|
+
getClusterMachines =
|
|
141
|
+
cluster:
|
|
87
142
|
let
|
|
88
|
-
machineAttrs = mapAttrs (name: metaConfig:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
in expandCarriers machineAttrs;
|
|
143
|
+
machineAttrs = mapAttrs (name: metaConfig: makeMachine { inherit name metaConfig; }) cluster;
|
|
144
|
+
in
|
|
145
|
+
expandCarriers machineAttrs;
|
|
92
146
|
|
|
93
147
|
# Get IP version addresses from all machines in a cluster
|
|
94
|
-
getAllAddressesOf =
|
|
148
|
+
getAllAddressesOf =
|
|
149
|
+
cluster: v:
|
|
95
150
|
let
|
|
96
151
|
machines = getClusterMachines cluster;
|
|
97
|
-
addresses = flatten (
|
|
98
|
-
map (addr: machine // addr) machine.metaConfig.addresses.${"v${toString v}"}
|
|
99
|
-
)
|
|
100
|
-
in
|
|
152
|
+
addresses = flatten (
|
|
153
|
+
map (machine: map (addr: machine // addr) machine.metaConfig.addresses.${"v${toString v}"}) machines
|
|
154
|
+
);
|
|
155
|
+
in
|
|
156
|
+
addresses;
|
|
101
157
|
|
|
102
158
|
mkOptions = {
|
|
103
|
-
addresses =
|
|
159
|
+
addresses =
|
|
160
|
+
v:
|
|
104
161
|
{ config, ... }:
|
|
105
162
|
{
|
|
106
163
|
options = {
|
|
@@ -117,11 +174,7 @@ in rec {
|
|
|
117
174
|
string = mkOption {
|
|
118
175
|
type = types.nullOr types.str;
|
|
119
176
|
default = null;
|
|
120
|
-
apply = v:
|
|
121
|
-
if isNull v then
|
|
122
|
-
"${config.address}/${toString config.prefix}"
|
|
123
|
-
else
|
|
124
|
-
v;
|
|
177
|
+
apply = v: if isNull v then "${config.address}/${toString config.prefix}" else v;
|
|
125
178
|
description = "Address with prefix as string";
|
|
126
179
|
};
|
|
127
180
|
};
|
data/nix/lib/machine/default.nix
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
confDir,
|
|
3
|
+
corePkgs,
|
|
4
|
+
coreLib,
|
|
5
|
+
findMetaConfig,
|
|
6
|
+
}:
|
|
2
7
|
let
|
|
3
8
|
swpinsFor =
|
|
4
9
|
{ name, metaConfig }:
|
|
@@ -10,68 +15,83 @@ let
|
|
|
10
15
|
};
|
|
11
16
|
|
|
12
17
|
makeModuleArgs =
|
|
13
|
-
{
|
|
18
|
+
{
|
|
19
|
+
metaConfig,
|
|
20
|
+
swpins,
|
|
21
|
+
spin,
|
|
22
|
+
name,
|
|
23
|
+
}@args:
|
|
24
|
+
{
|
|
14
25
|
swpins = swpins.evaluated;
|
|
15
26
|
swpinsInfo = swpins.infos;
|
|
16
27
|
confMachine = import ./info.nix (args // { inherit findMetaConfig; });
|
|
17
28
|
};
|
|
18
29
|
|
|
19
|
-
makeImports =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
makeImports =
|
|
31
|
+
spin: extraImports:
|
|
32
|
+
[
|
|
33
|
+
(
|
|
34
|
+
{
|
|
35
|
+
config,
|
|
36
|
+
pkgs,
|
|
37
|
+
lib,
|
|
38
|
+
confMachine,
|
|
39
|
+
...
|
|
40
|
+
}:
|
|
41
|
+
{
|
|
42
|
+
_file = "confctl/nix/lib/machine/default.nix";
|
|
29
43
|
|
|
30
|
-
|
|
31
|
-
|
|
44
|
+
_module.args = {
|
|
45
|
+
inherit confDir;
|
|
46
|
+
confLib = import ../../lib { inherit confDir coreLib corePkgs; };
|
|
47
|
+
confData = import "${toString confDir}/data/default.nix" { inherit lib; };
|
|
48
|
+
};
|
|
32
49
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
]
|
|
53
|
+
++ (import ../../modules/module-list.nix).${spin}
|
|
37
54
|
++ (import ../../modules/system-list.nix).${spin}
|
|
38
55
|
++ (import "${toString confDir}/modules/module-list.nix").${spin}
|
|
39
56
|
++ (import "${toString confDir}/cluster/module-list.nix")
|
|
40
57
|
++ extraImports;
|
|
41
|
-
in
|
|
42
|
-
|
|
58
|
+
in
|
|
59
|
+
rec {
|
|
60
|
+
nixos =
|
|
61
|
+
{ name, metaConfig }:
|
|
43
62
|
let
|
|
44
63
|
swpins = swpinsFor { inherit name metaConfig; };
|
|
45
64
|
in
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
imports = makeImports "nixos" [
|
|
56
|
-
"${toString confDir}/cluster/${name}/config.nix"
|
|
57
|
-
];
|
|
65
|
+
{ config, pkgs, ... }@args:
|
|
66
|
+
{
|
|
67
|
+
_module.args = makeModuleArgs {
|
|
68
|
+
metaConfig = config;
|
|
69
|
+
inherit swpins;
|
|
70
|
+
spin = "nixos";
|
|
71
|
+
inherit name;
|
|
58
72
|
};
|
|
59
73
|
|
|
60
|
-
|
|
74
|
+
imports = makeImports "nixos" [
|
|
75
|
+
"${toString confDir}/cluster/${name}/config.nix"
|
|
76
|
+
];
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
vpsadminos =
|
|
80
|
+
{ name, metaConfig }:
|
|
61
81
|
let
|
|
62
82
|
swpins = swpinsFor { inherit name metaConfig; };
|
|
63
83
|
in
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
imports = makeImports "vpsadminos" [
|
|
74
|
-
"${toString confDir}/cluster/${name}/config.nix"
|
|
75
|
-
];
|
|
84
|
+
{ config, pkgs, ... }@args:
|
|
85
|
+
{
|
|
86
|
+
_module.args = makeModuleArgs {
|
|
87
|
+
metaConfig = config;
|
|
88
|
+
inherit swpins;
|
|
89
|
+
spin = "vpsadminos";
|
|
90
|
+
inherit name;
|
|
76
91
|
};
|
|
92
|
+
|
|
93
|
+
imports = makeImports "vpsadminos" [
|
|
94
|
+
"${toString confDir}/cluster/${name}/config.nix"
|
|
95
|
+
];
|
|
96
|
+
};
|
|
77
97
|
}
|
data/nix/lib/machine/info.nix
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
{
|
|
2
|
+
metaConfig,
|
|
3
|
+
spin,
|
|
4
|
+
name,
|
|
5
|
+
findMetaConfig,
|
|
6
|
+
...
|
|
7
|
+
}:
|
|
8
|
+
(
|
|
9
|
+
{
|
|
10
|
+
inherit name;
|
|
11
|
+
}
|
|
12
|
+
// findMetaConfig {
|
|
13
|
+
inherit (metaConfig) cluster;
|
|
14
|
+
inherit name;
|
|
15
|
+
}
|
|
16
|
+
)
|
data/nix/lib/swpins/eval.nix
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
confDir,
|
|
3
|
+
name,
|
|
4
|
+
dir ? "cluster",
|
|
5
|
+
channels,
|
|
6
|
+
pkgs,
|
|
7
|
+
lib,
|
|
8
|
+
}:
|
|
2
9
|
let
|
|
3
10
|
pinFileName = builtins.replaceStrings [ "/" ] [ ":" ] name;
|
|
4
11
|
|
|
@@ -6,11 +13,7 @@ let
|
|
|
6
13
|
|
|
7
14
|
pinFileJson = builtins.readFile pinFilePath;
|
|
8
15
|
|
|
9
|
-
pinFileSpecs =
|
|
10
|
-
if builtins.pathExists pinFilePath then
|
|
11
|
-
builtins.fromJSON pinFileJson
|
|
12
|
-
else
|
|
13
|
-
{};
|
|
16
|
+
pinFileSpecs = if builtins.pathExists pinFilePath then builtins.fromJSON pinFileJson else { };
|
|
14
17
|
|
|
15
18
|
pinFileSwpins = lib.mapAttrs (k: v: swpin v) pinFileSpecs;
|
|
16
19
|
|
|
@@ -24,47 +27,57 @@ let
|
|
|
24
27
|
|
|
25
28
|
allChannelSwpins = map channelSwpins channels;
|
|
26
29
|
|
|
27
|
-
allSwpins = (lib.foldl (a: b: a // b) {} allChannelSwpins) // pinFileSwpins;
|
|
30
|
+
allSwpins = (lib.foldl (a: b: a // b) { } allChannelSwpins) // pinFileSwpins;
|
|
28
31
|
|
|
29
|
-
swpin = { fetcher, ... }:
|
|
30
|
-
fetchers.${fetcher.type} fetcher.options;
|
|
32
|
+
swpin = { fetcher, ... }: fetchers.${fetcher.type} fetcher.options;
|
|
31
33
|
|
|
32
34
|
fetchers = rec {
|
|
33
|
-
directory = opts:
|
|
34
|
-
opts.path;
|
|
35
|
+
directory = opts: opts.path;
|
|
35
36
|
|
|
36
|
-
git =
|
|
37
|
+
git =
|
|
38
|
+
opts:
|
|
37
39
|
let
|
|
38
|
-
filter = lib.filterAttrs (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
filter = lib.filterAttrs (
|
|
41
|
+
k: v:
|
|
42
|
+
builtins.elem k [
|
|
43
|
+
"url"
|
|
44
|
+
"rev"
|
|
45
|
+
"sha256"
|
|
46
|
+
"fetchSubmodules"
|
|
47
|
+
]
|
|
48
|
+
);
|
|
49
|
+
in
|
|
50
|
+
if opts ? path && builtins.pathExists opts.path then
|
|
51
|
+
builtins.storePath opts.path
|
|
52
|
+
else
|
|
53
|
+
pkgs.fetchgit (filter opts);
|
|
42
54
|
|
|
43
|
-
zip = opts:
|
|
44
|
-
pkgs.fetchzip opts;
|
|
55
|
+
zip = opts: pkgs.fetchzip opts;
|
|
45
56
|
|
|
46
|
-
git-rev =
|
|
57
|
+
git-rev =
|
|
58
|
+
opts:
|
|
47
59
|
let
|
|
48
60
|
repo = fetchers.${opts.wrapped_fetcher.type} opts.wrapped_fetcher.options;
|
|
49
61
|
shortRev = lib.substring 0 9 (opts.rev);
|
|
50
62
|
in
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
pkgs.runCommand "git-${shortRev}" { } ''
|
|
64
|
+
cp -a ${repo} $out
|
|
65
|
+
chmod 700 $out
|
|
66
|
+
echo "${opts.rev}" > $out/.git-revision
|
|
67
|
+
echo ".git.${shortRev}" > $out/.version-suffix
|
|
68
|
+
'';
|
|
57
69
|
};
|
|
58
70
|
|
|
59
|
-
pinFileInfos = lib.mapAttrs (k: v: v.info or {}) pinFileSpecs;
|
|
71
|
+
pinFileInfos = lib.mapAttrs (k: v: v.info or { }) pinFileSpecs;
|
|
60
72
|
|
|
61
|
-
channelInfos = chan: lib.mapAttrs (k: v: v.info or {}) (channelSpecs chan);
|
|
73
|
+
channelInfos = chan: lib.mapAttrs (k: v: v.info or { }) (channelSpecs chan);
|
|
62
74
|
|
|
63
75
|
allChannelInfos = map channelInfos channels;
|
|
64
76
|
|
|
65
|
-
allInfos = (lib.foldl (a: b: a // b) {} allChannelInfos) // pinFileInfos;
|
|
77
|
+
allInfos = (lib.foldl (a: b: a // b) { } allChannelInfos) // pinFileInfos;
|
|
66
78
|
|
|
67
|
-
in
|
|
79
|
+
in
|
|
80
|
+
{
|
|
68
81
|
evaluated = allSwpins;
|
|
69
82
|
|
|
70
83
|
infos = allInfos;
|
data/nix/lib/swpins/options.nix
CHANGED
|
@@ -6,7 +6,11 @@ rec {
|
|
|
6
6
|
{
|
|
7
7
|
options = {
|
|
8
8
|
type = mkOption {
|
|
9
|
-
type = types.enum [
|
|
9
|
+
type = types.enum [
|
|
10
|
+
"directory"
|
|
11
|
+
"git"
|
|
12
|
+
"git-rev"
|
|
13
|
+
];
|
|
10
14
|
default = "git";
|
|
11
15
|
};
|
|
12
16
|
|
|
@@ -82,7 +86,7 @@ rec {
|
|
|
82
86
|
|
|
83
87
|
interval = mkOption {
|
|
84
88
|
type = types.int;
|
|
85
|
-
default = 60*60;
|
|
89
|
+
default = 60 * 60;
|
|
86
90
|
description = ''
|
|
87
91
|
Number of seconds from the last update to trigger the next
|
|
88
92
|
auto-update, if auto-update is enabled.
|
data/nix/machines.nix
CHANGED
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
confDir,
|
|
3
|
+
corePkgs,
|
|
4
|
+
coreLib,
|
|
5
|
+
}:
|
|
2
6
|
let
|
|
3
7
|
confLib = import ./lib { inherit confDir coreLib corePkgs; };
|
|
4
8
|
|
|
5
9
|
userModules = "${toString confDir}/modules/cluster/default.nix";
|
|
6
10
|
|
|
7
11
|
baseModules = [
|
|
8
|
-
(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
(
|
|
13
|
+
{ ... }:
|
|
14
|
+
{
|
|
15
|
+
_module.args = {
|
|
16
|
+
pkgs = corePkgs;
|
|
17
|
+
inherit confLib;
|
|
18
|
+
swpins = { };
|
|
19
|
+
swpinsInfo = { };
|
|
20
|
+
confMachine = null;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
)
|
|
18
24
|
|
|
19
25
|
./modules/cluster
|
|
20
|
-
]
|
|
21
|
-
|
|
26
|
+
]
|
|
27
|
+
++ (import "${toString confDir}/cluster/module-list.nix")
|
|
28
|
+
++ (coreLib.optional (builtins.pathExists userModules) userModules);
|
|
22
29
|
|
|
23
30
|
evalConfig = corePkgs.lib.evalModules {
|
|
24
|
-
prefix = [];
|
|
31
|
+
prefix = [ ];
|
|
25
32
|
modules = baseModules;
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
cluster = evalConfig.config.cluster;
|
|
29
36
|
|
|
30
37
|
allMachines = confLib.getClusterMachines cluster;
|
|
31
|
-
in
|
|
38
|
+
in
|
|
39
|
+
allMachines
|