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.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/.git-hooks/pre_commit/nixfmt.rb +13 -0
  3. data/.github/workflows/rspec.yml +64 -0
  4. data/.github/workflows/rubocop.yml +27 -0
  5. data/.github/workflows/tests.yml +139 -0
  6. data/.gitignore +12 -7
  7. data/.overcommit.yml +2 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +8 -1
  10. data/AGENTS.md +42 -0
  11. data/CHANGELOG.md +57 -0
  12. data/Gemfile +3 -2
  13. data/Gemfile.lock +198 -0
  14. data/README.md +166 -58
  15. data/Rakefile +5 -0
  16. data/confctl.gemspec +20 -2
  17. data/docs/carrier.md +3 -3
  18. data/docs/flake-inputs.md +159 -0
  19. data/docs/swpins-to-flakes.md +325 -0
  20. data/example/cluster/module-list.nix +2 -1
  21. data/example/cluster/nixos-machine/config.nix +12 -2
  22. data/example/cluster/nixos-machine/hardware.nix +6 -1
  23. data/example/cluster/vpsadminos-container/config.nix +6 -1
  24. data/example/cluster/vpsadminos-container/module.nix +4 -1
  25. data/example/cluster/vpsadminos-machine/config.nix +6 -1
  26. data/example/cluster/vpsadminos-machine/hardware.nix +6 -1
  27. data/example/cluster/vpsadminos-machine/module.nix +5 -2
  28. data/example/cluster/vpsfreecz-vps/config.nix +6 -1
  29. data/example/cluster/vpsfreecz-vps/module.nix +4 -1
  30. data/example/configs/swpins.nix +8 -3
  31. data/example/environments/base.nix +6 -1
  32. data/example/swpins/core.json +35 -0
  33. data/example-flake/.gitignore +2 -0
  34. data/example-flake/README.md +38 -0
  35. data/example-flake/cluster/cluster.nix +5 -0
  36. data/example-flake/cluster/module-list.nix +4 -0
  37. data/example-flake/cluster/nested/nixos-machine/config.nix +25 -0
  38. data/example-flake/cluster/nested/nixos-machine/hardware.nix +9 -0
  39. data/example-flake/cluster/nested/nixos-machine/module.nix +8 -0
  40. data/example-flake/cluster/nixos-machine/config.nix +25 -0
  41. data/example-flake/cluster/nixos-machine/hardware.nix +9 -0
  42. data/example-flake/cluster/nixos-machine/module.nix +8 -0
  43. data/example-flake/cluster/vpsadminos-container/config.nix +28 -0
  44. data/example-flake/cluster/vpsadminos-container/module.nix +8 -0
  45. data/example-flake/cluster/vpsadminos-machine/config.nix +27 -0
  46. data/example-flake/cluster/vpsadminos-machine/hardware.nix +9 -0
  47. data/example-flake/cluster/vpsadminos-machine/module.nix +8 -0
  48. data/example-flake/cluster/vpsfreecz-vps/config.nix +31 -0
  49. data/example-flake/cluster/vpsfreecz-vps/module.nix +8 -0
  50. data/example-flake/configs/confctl.nix +10 -0
  51. data/example-flake/data/default.nix +5 -0
  52. data/example-flake/data/ssh-keys.nix +7 -0
  53. data/example-flake/environments/base.nix +18 -0
  54. data/example-flake/flake.lock +75 -0
  55. data/example-flake/flake.nix +36 -0
  56. data/example-flake/modules/module-list.nix +13 -0
  57. data/example-flake/shell.nix +11 -0
  58. data/flake.lock +159 -0
  59. data/flake.nix +189 -0
  60. data/gemset.nix +1022 -0
  61. data/lib/confctl/cli/app.rb +145 -0
  62. data/lib/confctl/cli/attr_filters.rb +1 -1
  63. data/lib/confctl/cli/cluster.rb +681 -108
  64. data/lib/confctl/cli/command.rb +24 -2
  65. data/lib/confctl/cli/configuration.rb +171 -106
  66. data/lib/confctl/cli/generation.rb +65 -1
  67. data/lib/confctl/cli/inputs/channels.rb +190 -0
  68. data/lib/confctl/cli/inputs/machines.rb +83 -0
  69. data/lib/confctl/cli/inputs/root.rb +101 -0
  70. data/lib/confctl/cli/inputs.rb +5 -0
  71. data/lib/confctl/cli/log_view.rb +21 -10
  72. data/lib/confctl/cli/migrate/swpins_to_flakes.rb +866 -0
  73. data/lib/confctl/cli/migrate.rb +5 -0
  74. data/lib/confctl/cli/output_formatter.rb +5 -7
  75. data/lib/confctl/cli/swpins/base.rb +9 -0
  76. data/lib/confctl/cli/swpins/channel.rb +2 -5
  77. data/lib/confctl/cli/swpins/cluster.rb +2 -5
  78. data/lib/confctl/cli/swpins/core.rb +2 -5
  79. data/lib/confctl/config_type.rb +7 -0
  80. data/lib/confctl/flake_lock.rb +78 -0
  81. data/lib/confctl/flake_lock_diff.rb +36 -0
  82. data/lib/confctl/generation/build.rb +131 -24
  83. data/lib/confctl/generation/build_list.rb +4 -3
  84. data/lib/confctl/generation/unified.rb +14 -1
  85. data/lib/confctl/git_repo_mirror.rb +2 -2
  86. data/lib/confctl/health_checks/run_command.rb +3 -2
  87. data/lib/confctl/health_checks/systemd/properties.rb +1 -1
  88. data/lib/confctl/health_checks/systemd/property_list.rb +2 -2
  89. data/lib/confctl/inputs/commit_message.rb +125 -0
  90. data/lib/confctl/inputs/git_commit.rb +17 -0
  91. data/lib/confctl/inputs/nix_output_guard.rb +37 -0
  92. data/lib/confctl/inputs/setter.rb +179 -0
  93. data/lib/confctl/inputs/updater.rb +76 -0
  94. data/lib/confctl/inputs.rb +5 -0
  95. data/lib/confctl/inputs_info.rb +50 -0
  96. data/lib/confctl/line_buffer.rb +1 -1
  97. data/lib/confctl/machine.rb +18 -3
  98. data/lib/confctl/machine_control.rb +8 -2
  99. data/lib/confctl/machine_list.rb +2 -2
  100. data/lib/confctl/machine_status.rb +63 -20
  101. data/lib/confctl/nix/args.rb +48 -0
  102. data/lib/confctl/nix.rb +30 -437
  103. data/lib/confctl/nix_build_flake.rb +95 -0
  104. data/lib/confctl/nix_copy.rb +14 -2
  105. data/lib/confctl/nix_flake.rb +449 -0
  106. data/lib/confctl/nix_format.rb +3 -3
  107. data/lib/confctl/nix_legacy.rb +467 -0
  108. data/lib/confctl/swpins/change_set.rb +29 -3
  109. data/lib/confctl/swpins/specs/base.rb +2 -2
  110. data/lib/confctl/ui.rb +19 -0
  111. data/lib/confctl/version.rb +1 -1
  112. data/man/index.html +11 -0
  113. data/man/man8/confctl-options.nix.8.html +113 -0
  114. data/man/man8/confctl.8 +152 -21
  115. data/man/man8/confctl.8.html +355 -0
  116. data/man/man8/confctl.8.md +148 -17
  117. data/man/style.css +301 -0
  118. data/nix/evaluator.nix +94 -69
  119. data/nix/flake/mk-confctl-devshell.nix +85 -0
  120. data/nix/flake/mk-confctl-outputs.nix +522 -0
  121. data/nix/flake/mk-config-devshell.nix +168 -0
  122. data/nix/lib/default.nix +118 -65
  123. data/nix/lib/machine/default.nix +65 -45
  124. data/nix/lib/machine/info.nix +16 -5
  125. data/nix/lib/swpins/eval.nix +42 -29
  126. data/nix/lib/swpins/options.nix +6 -2
  127. data/nix/machines.nix +23 -15
  128. data/nix/modules/cluster/default.nix +104 -41
  129. data/nix/modules/confctl/carrier/base.nix +11 -4
  130. data/nix/modules/confctl/carrier/carrier-env.rb +2 -2
  131. data/nix/modules/confctl/carrier/netboot/build-netboot-server.rb +50 -16
  132. data/nix/modules/confctl/carrier/netboot/nixos.nix +56 -24
  133. data/nix/modules/confctl/configuration-info.nix +17 -0
  134. data/nix/modules/confctl/generations.nix +2 -2
  135. data/nix/modules/confctl/host.nix +13 -0
  136. data/nix/modules/confctl/inputs-info.nix +21 -0
  137. data/nix/modules/confctl/kexec-netboot/default.nix +13 -6
  138. data/nix/modules/confctl/kexec-netboot/kexec-netboot.8.adoc +3 -0
  139. data/nix/modules/confctl/kexec-netboot/kexec-netboot.rb +25 -16
  140. data/nix/modules/confctl/nix.nix +31 -1
  141. data/nix/modules/confctl/swpins.nix +13 -6
  142. data/nix/modules/module-list.nix +4 -2
  143. data/nix/modules/system-list.nix +4 -1
  144. data/nix/package.nix +37 -0
  145. data/shell.nix +39 -8
  146. data/skills/confctl-configuration-update/SKILL.md +228 -0
  147. data/skills/confctl-configuration-update/agents/openai.yaml +4 -0
  148. data/skills/confctl-release/SKILL.md +102 -0
  149. data/skills/confctl-release/agents/openai.yaml +4 -0
  150. data/spec/confctl/cli/cluster_health_check_spec.rb +43 -0
  151. data/spec/confctl/cli/cluster_skip_current_deploy_spec.rb +157 -0
  152. data/spec/confctl/cli/cluster_status_flake_spec.rb +83 -0
  153. data/spec/confctl/cli/inputs_set_output_spec.rb +70 -0
  154. data/spec/confctl/configuration_spec.rb +45 -0
  155. data/spec/confctl/inputs_spec.rb +104 -0
  156. data/spec/confctl/machine_control_spec.rb +112 -0
  157. data/spec/confctl/machine_list_spec.rb +47 -0
  158. data/spec/confctl/nix_flake_spec.rb +41 -0
  159. data/spec/confctl/swpins_spec.rb +106 -0
  160. data/spec/generation/build_modes_spec.rb +132 -0
  161. data/spec/inputs/commit_message_spec.rb +205 -0
  162. data/spec/inputs/nix_cached_fallback_spec.rb +50 -0
  163. data/spec/inputs/nix_output_guard_spec.rb +45 -0
  164. data/spec/spec_helper.rb +12 -0
  165. data/spec/support/cli_helper.rb +57 -0
  166. data/test-runner.sh +7 -0
  167. data/tests/all-tests.nix +30 -0
  168. data/tests/make-test.nix +15 -0
  169. data/tests/runner/extensions/confctl_helpers.rb +238 -0
  170. data/tests/runner/extensions/hostfwd_ports.rb +41 -0
  171. data/tests/suite/auto_rollback.nix +344 -0
  172. data/tests/suite/carrier/deploy.nix +751 -0
  173. data/tests/suite/carrier/netboot.nix +849 -0
  174. data/tests/suite/deploy/base.nix +806 -0
  175. data/tests/suite/deploy/flakes.nix +1 -0
  176. data/tests/suite/deploy/swpins.nix +1 -0
  177. metadata +104 -4
  178. data/nix/modules/confctl/overlays.nix +0 -15
@@ -0,0 +1,325 @@
1
+ # Migrating from swpins to flakes
2
+
3
+ This guide explains how to convert an existing **confctl configuration repository** from the legacy *swpins* workflow (pins and channels defined in `configs/swpins.nix`, state in `swpins/*.json`, updates via `confctl swpins ...`) to a **flake-based** workflow (pins are normal flake inputs locked in `flake.lock`, updates via `confctl inputs ...`).
4
+
5
+ After the migration:
6
+
7
+ - your repository has `flake.nix` and `flake.lock`
8
+ - flake inputs replace swpins definitions
9
+ - machine metadata selects channels via `cluster.<name>.inputs.channels`
10
+ - per-machine pin differences are expressed via `cluster.<name>.inputs.overrides`
11
+ - you no longer need `configs/swpins.nix` or the generated `swpins/` directory
12
+
13
+ If you are new to the flake model in confctl, read `docs/flake-inputs.md` after this guide.
14
+
15
+ ---
16
+
17
+ ## Before you start
18
+
19
+ - Do the migration on a branch.
20
+ - Make sure your Nix has flakes enabled (`nix-command` + `flakes`).
21
+ - Your configuration repo layout is assumed to be the usual confctl layout with `cluster/`, `configs/`, etc.
22
+
23
+ ---
24
+
25
+ ## Automated migration (recommended)
26
+
27
+ confctl includes an interactive migration helper that performs the steps in this guide:
28
+
29
+ ```bash
30
+ confctl migrate swpins-to-flakes --dry-run
31
+ confctl migrate swpins-to-flakes --yes
32
+ ```
33
+
34
+ You can also run individual steps (`flake`, `machines`, `imports`, `clean`); see `confctl migrate swpins-to-flakes --help`.
35
+
36
+ ## Step 1: Add `flake.nix`
37
+
38
+ Create `flake.nix` in the root of your configuration repository.
39
+
40
+ A minimal, practical skeleton looks like this:
41
+
42
+ ```nix
43
+ {
44
+ description = "my cluster config (confctl flake)";
45
+
46
+ inputs = {
47
+ # confctl itself
48
+ confctl.url = "github:vpsfreecz/confctl";
49
+
50
+ # mkConfctlOutputs needs an input named `nixpkgs` for evaluation.
51
+ # If you want a specific nixpkgs for that purpose, pin it here.
52
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
53
+
54
+ # Add your real pinned inputs here (examples):
55
+ # nixpkgsStable.url = "github:NixOS/nixpkgs/nixos-25.11";
56
+ # vpsadminosStaging.url = "github:vpsfreecz/vpsadminos/staging";
57
+ };
58
+
59
+ outputs = inputs@{ self, confctl, ... }:
60
+ let
61
+ channels = {
62
+ # Filled in Step 2
63
+ };
64
+ in
65
+ {
66
+ confctl = confctl.lib.mkConfctlOutputs {
67
+ confDir = ./.;
68
+ inherit inputs channels;
69
+ };
70
+
71
+ # Recommended: configuration-repo dev shell
72
+ devShells.x86_64-linux.default = confctl.lib.mkConfigDevShell {
73
+ system = "x86_64-linux";
74
+ mode = "minimal";
75
+ };
76
+ };
77
+ }
78
+ ```
79
+
80
+ Then generate the lock file:
81
+
82
+ ```bash
83
+ nix flake lock
84
+ ```
85
+
86
+ Commit both `flake.nix` and `flake.lock`.
87
+
88
+ ---
89
+
90
+ ## Step 2: Convert `configs/swpins.nix` into flake inputs + `channels` mapping
91
+
92
+ Open your existing `configs/swpins.nix`. In swpins, you usually have a structure like:
93
+
94
+ - channels (e.g. `nixos-unstable`, `vpsadminos-staging`)
95
+ - roles inside channels (e.g. `nixpkgs`, `vpsadminos`, `vpsadmin`)
96
+ - for each role a pin spec (`type = "git-rev"; git-rev.url = ...; git-rev.update.ref = ...`)
97
+
98
+ In flakes, you split this into:
99
+
100
+ 1) **flake inputs** (named however you like)
101
+ 2) **channels mapping** from role → input name
102
+
103
+ ### 2.1 Define flake inputs
104
+
105
+ For a typical swpins `git-rev` pin:
106
+
107
+ ```nix
108
+ # swpins
109
+ # url = https://github.com/NixOS/nixpkgs
110
+ # update.ref = refs/heads/nixos-unstable
111
+ ```
112
+
113
+ Use a flake URL:
114
+
115
+ ```nix
116
+ inputs.nixpkgsUnstable.url = "github:NixOS/nixpkgs/nixos-unstable";
117
+ ```
118
+
119
+ If you need an input for a specific branch/tag that doesn’t have a shorthand, you can use:
120
+
121
+ ```nix
122
+ inputs.someRepo.url = "git+https://example.com/repo?ref=my-branch";
123
+ ```
124
+
125
+ If the repository does **not** provide `flake.nix`, mark it as non-flake:
126
+
127
+ ```nix
128
+ inputs.someRepo = {
129
+ url = "github:example/someRepo/main";
130
+ flake = false;
131
+ };
132
+ ```
133
+
134
+ ### 2.2 Create `channels` mapping
135
+
136
+ For every swpins channel, create a flake channel mapping of role → input name.
137
+
138
+ Example:
139
+
140
+ ```nix
141
+ channels = {
142
+ nixos-unstable = {
143
+ nixpkgs = "nixpkgsUnstable";
144
+ };
145
+
146
+ os-staging = {
147
+ nixpkgs = "nixpkgsUnstable";
148
+ vpsadminos = "vpsadminosStaging";
149
+ };
150
+ };
151
+ ```
152
+
153
+ Notes:
154
+
155
+ - A **role** is what your machine configurations refer to (`inputs.nixpkgs`, `inputs.vpsadminos`, ...).
156
+ - An **input name** is a flake input key under `inputs = { ... }`.
157
+ - Machines can select multiple channels; later channels override roles from earlier ones.
158
+
159
+ ---
160
+
161
+ ## Step 3: Switch machine metadata from `swpins.channels` to `inputs.channels`
162
+
163
+ For every machine `cluster/**/module.nix`:
164
+
165
+ - replace `swpins.channels = [ ... ];` with `inputs.channels = [ ... ];`
166
+
167
+ Example:
168
+
169
+ ```nix
170
+ { config, ... }:
171
+ {
172
+ cluster."my-machine" = {
173
+ spin = "nixos";
174
+
175
+ # Flake config: select channels from flake.nix
176
+ inputs.channels = [ "nixos-unstable" "os-staging" ];
177
+
178
+ host.target = "203.0.113.10";
179
+ };
180
+ }
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Step 4: Convert per-machine `swpins.pins` to `inputs.overrides`
186
+
187
+ Legacy swpins allowed defining full pin specs per machine:
188
+
189
+ ```nix
190
+ swpins.pins.nixpkgs = {
191
+ type = "git-rev";
192
+ git-rev = {
193
+ url = "https://github.com/NixOS/nixpkgs";
194
+ update.ref = "refs/heads/some-branch";
195
+ };
196
+ };
197
+ ```
198
+
199
+ In flakes you **do not** write fetch specs in machine metadata. Instead:
200
+
201
+ 1) add a dedicated flake input in `flake.nix`
202
+ 2) override the role → input mapping on the machine
203
+
204
+ Example `flake.nix`:
205
+
206
+ ```nix
207
+ inputs.nixpkgsSomeBranch.url = "github:NixOS/nixpkgs/some-branch";
208
+ ```
209
+
210
+ Example `cluster/<path>/module.nix`:
211
+
212
+ ```nix
213
+ cluster."my-machine".inputs.overrides.nixpkgs = "nixpkgsSomeBranch";
214
+ ```
215
+
216
+ `inputs.overrides` can also add machine-only roles:
217
+
218
+ ```nix
219
+ cluster."my-machine".inputs.overrides.myTool = "myToolInput";
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Step 5: Fix Nix code that relied on `<...>` imports
225
+
226
+ If your configuration imports modules via NIX_PATH, for example:
227
+
228
+ ```nix
229
+ imports = [ <vpsadminos/os/lib/nixos-container/vpsadminos.nix> ];
230
+ ```
231
+
232
+ flake evaluation is typically pure and `<...>` may stop working. Prefer explicit imports using the confctl-provided `inputs` module argument:
233
+
234
+ ```nix
235
+ { inputs, ... }:
236
+ {
237
+ imports = [
238
+ (inputs.vpsadminos + "/os/lib/nixos-container/vpsadminos.nix")
239
+ ];
240
+ }
241
+ ```
242
+
243
+ Similarly:
244
+
245
+ - `<nixpkgs/...>` → `(inputs.nixpkgs + "/...")`
246
+ - `<vpsadmin/...>` → `(inputs.vpsadmin + "/...")`
247
+
248
+ ### Accessing flake-exported modules (`nixosModules`)
249
+
250
+ If you need to import modules exported from a flake input (e.g. `nixosModules`), use `flakeInputs` and `inputsInfo` so the import follows the selected channel/override:
251
+
252
+ ```nix
253
+ { flakeInputs, inputsInfo, ... }:
254
+ let
255
+ vpsadminInput = inputsInfo.vpsadmin.input;
256
+ in
257
+ {
258
+ imports = [
259
+ flakeInputs.${vpsadminInput}.nixosModules.someModule
260
+ ];
261
+ }
262
+ ```
263
+
264
+ ---
265
+
266
+ ## Step 6: Temporary compatibility mode (optional)
267
+
268
+ If you want to migrate in smaller steps, you can temporarily keep legacy `<...>` imports working during flake builds.
269
+
270
+ In `configs/confctl.nix`:
271
+
272
+ ```nix
273
+ { config, ... }:
274
+ {
275
+ confctl.nix.impureEval = true;
276
+ confctl.nix.legacyNixPath = true;
277
+
278
+ # Optional: which roles should be exposed as <name> in NIX_PATH
279
+ # confctl.nix.legacyNixPathMap = [ "nixpkgs" "vpsadminos" "vpsadmin" ];
280
+ }
281
+ ```
282
+
283
+ Notes:
284
+
285
+ - `legacyNixPath` requires `impureEval = true`.
286
+ - If you build multiple machines that use different pinned inputs for the same role,
287
+ `<nixpkgs>`-style imports can become ambiguous. Prefer migrating imports fully.
288
+
289
+ ---
290
+
291
+ ## Step 7: Verify builds
292
+
293
+ Enter the development shell and verify you can evaluate/build at least one machine:
294
+
295
+ ```bash
296
+ nix develop
297
+ confctl ls
298
+ confctl build my-machine
299
+ ```
300
+
301
+ ---
302
+
303
+ ## Step 8: Remove swpins files and switch update workflow
304
+
305
+ Once you have verified that flake-based builds work:
306
+
307
+ 1) Remove legacy pin configuration/state from the repo:
308
+
309
+ - delete `configs/swpins.nix`
310
+ - delete the generated `swpins/` directory
311
+
312
+ 2) Update your workflow/CI scripts:
313
+
314
+ - replace `confctl swpins update` / `confctl swpins channel update` with flake input updates
315
+
316
+ Common update commands:
317
+
318
+ ```bash
319
+ confctl inputs ls
320
+ confctl inputs update --commit --all
321
+ confctl inputs channel update --commit production
322
+ confctl inputs machine update --commit my-machine nixpkgs
323
+ ```
324
+
325
+ `flake.lock` is now the source of truth for pinned revisions.
@@ -1,3 +1,4 @@
1
- (import ./cluster.nix) ++ [
1
+ (import ./cluster.nix)
2
+ ++ [
2
3
  # Place for custom modules
3
4
  ]
@@ -1,4 +1,9 @@
1
- { config, pkgs, lib, ... }:
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
2
7
  {
3
8
  imports = [
4
9
  ../../environments/base.nix
@@ -9,7 +14,12 @@
9
14
 
10
15
  boot.loader.grub.enable = true;
11
16
  boot.loader.grub.version = 2;
12
- # boot.loader.grub.device = "";
17
+ boot.loader.grub.device = "/dev/sda";
18
+
19
+ fileSystems."/" = {
20
+ device = "/dev/sda1";
21
+ fsType = "ext4";
22
+ };
13
23
 
14
24
  system.stateVersion = "20.09";
15
25
  }
@@ -1,4 +1,9 @@
1
- { config, pkgs, lib, ... }:
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
2
7
  {
3
8
  # Your hardware-configuration.nix
4
9
  }
@@ -1,4 +1,9 @@
1
- { config, pkgs, lib, ... }:
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
2
7
  {
3
8
  imports = [
4
9
  ../../environments/base.nix
@@ -2,7 +2,10 @@
2
2
  {
3
3
  cluster."vpsadminos-container" = {
4
4
  spin = "nixos";
5
- swpins.channels = [ "nixos-unstable" "vpsadminos-staging" ];
5
+ swpins.channels = [
6
+ "nixos-unstable"
7
+ "vpsadminos-staging"
8
+ ];
6
9
  host.target = "<ip address>";
7
10
  };
8
11
  }
@@ -1,4 +1,9 @@
1
- { config, pkgs, lib, ... }:
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
2
7
  {
3
8
  imports = [
4
9
  ../../environments/base.nix
@@ -1,4 +1,9 @@
1
- { config, pkgs, lib, ... }:
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
2
7
  {
3
8
  # Your hardware-configuration.nix
4
9
  }
@@ -1,8 +1,11 @@
1
1
  { config, ... }:
2
2
  {
3
3
  cluster."vpsadminos-machine" = {
4
- spin = "nixos";
5
- swpins.channels = [ "vpsadminos-staging" "nixos-unstable" ];
4
+ spin = "vpsadminos";
5
+ swpins.channels = [
6
+ "vpsadminos-staging"
7
+ "nixos-unstable"
8
+ ];
6
9
  host.target = "<ip address>";
7
10
  };
8
11
  }
@@ -1,4 +1,9 @@
1
- { config, pkgs, lib, ... }:
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
2
7
  {
3
8
  imports = [
4
9
  ../../environments/base.nix
@@ -2,7 +2,10 @@
2
2
  {
3
3
  cluster."vpsfreecz-vps" = {
4
4
  spin = "nixos";
5
- swpins.channels = [ "nixos-unstable" "vpsadminos-staging" ];
5
+ swpins.channels = [
6
+ "nixos-unstable"
7
+ "vpsadminos-staging"
8
+ ];
6
9
  host.target = "<ip address>";
7
10
  };
8
11
  }
@@ -17,12 +17,17 @@ let
17
17
  update.ref = "refs/heads/${branch}";
18
18
  };
19
19
  };
20
- in {
20
+ in
21
+ {
21
22
  confctl.swpins.channels = {
22
- nixos-unstable = { nixpkgs = nixpkgsBranch "nixos-unstable"; };
23
+ nixos-unstable = {
24
+ nixpkgs = nixpkgsBranch "nixos-unstable";
25
+ };
23
26
 
24
27
  # nixos-stable = { nixpkgs = nixpkgsBranch "nixos-20.09"; };
25
28
 
26
- vpsadminos-staging = { vpsadminos = vpsadminosBranch "staging"; };
29
+ vpsadminos-staging = {
30
+ vpsadminos = vpsadminosBranch "staging";
31
+ };
27
32
  };
28
33
  }
@@ -1,4 +1,9 @@
1
- { config, pkgs, confData, ... }:
1
+ {
2
+ config,
3
+ pkgs,
4
+ confData,
5
+ ...
6
+ }:
2
7
  {
3
8
  time.timeZone = "Europe/Amsterdam";
4
9
 
@@ -0,0 +1,35 @@
1
+ {
2
+ "nixpkgs": {
3
+ "type": "git-rev",
4
+ "nix_options": {
5
+ "fetchSubmodules": false,
6
+ "update": {
7
+ "auto": true,
8
+ "interval": 2592000,
9
+ "ref": "refs/heads/nixos-unstable"
10
+ },
11
+ "url": "https://github.com/NixOS/nixpkgs"
12
+ },
13
+ "state": {
14
+ "rev": "a82ccc39b39b621151d6732718e3e250109076fa",
15
+ "date": "2026-02-15T18:21:02+01:00"
16
+ },
17
+ "info": {
18
+ "rev": "a82ccc39b39b621151d6732718e3e250109076fa",
19
+ "sha256": "1664s8ffaa3hcvz4d4hwca2l6xl25j8dvzxwmd2ckcskcncq1zc1"
20
+ },
21
+ "fetcher": {
22
+ "type": "git-rev",
23
+ "options": {
24
+ "rev": "a82ccc39b39b621151d6732718e3e250109076fa",
25
+ "wrapped_fetcher": {
26
+ "type": "zip",
27
+ "options": {
28
+ "url": "https://github.com/NixOS/nixpkgs/archive/a82ccc39b39b621151d6732718e3e250109076fa.tar.gz",
29
+ "sha256": "1664s8ffaa3hcvz4d4hwca2l6xl25j8dvzxwmd2ckcskcncq1zc1"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,2 @@
1
+ .confctl
2
+ .gems
@@ -0,0 +1,38 @@
1
+ # confctl example configuration
2
+ There are four skeleton deployments:
3
+
4
+ * `nixos-machine` to deploy a standard NixOS machine
5
+ * `vpsadminos-machine` to deploy vpsAdminOS machine
6
+ * `vpsadminos-container` to deploy to a container running on vpsAdminOS
7
+ * `vpsfreecz-container` to deploy to a VPS at [vpsFree.cz](https://vpsfree.org),
8
+ which is the same as `vpsadminos-container`
9
+
10
+ ## Usage
11
+ 1. Enter `nix develop`:
12
+ ```
13
+ nix develop
14
+ ```
15
+
16
+ 2. Update flake inputs:
17
+ ```
18
+ confctl inputs update
19
+ ```
20
+
21
+ 3. Edit configurations in `cluster/` to your liking.
22
+
23
+ Note that to deploy physical machines, you have to supply `hardware.nix` file,
24
+ which is generated by `nixos-generate-config` when installing NixOS, you'll find
25
+ it at `/etc/nixos/hardware-configuration.nix`. confctl cannot actually install
26
+ or provision a machine, it has to already be installed and running. confctl will
27
+ deploy the new system over SSH and activate it.
28
+
29
+ Target IP addresses to which the systems will be deployed to can be set
30
+ in `cluster/*/module.nix`, option `target.host`.
31
+
32
+ Configure SSH keys in `data/ssh-keys.nix`.
33
+
34
+ 4. Build and deploy
35
+ ```
36
+ confctl build vpsfreecz-vps
37
+ confctl deploy vpsfreecz-vps
38
+ ```
@@ -0,0 +1,5 @@
1
+ # This file is generated by confctl, changes will be lost
2
+ [
3
+ ./nixos-machine/module.nix
4
+ ./nested/nixos-machine/module.nix
5
+ ]
@@ -0,0 +1,4 @@
1
+ (import ./cluster.nix)
2
+ ++ [
3
+ # Place for custom modules
4
+ ]
@@ -0,0 +1,25 @@
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
7
+ {
8
+ imports = [
9
+ ../../../environments/base.nix
10
+ ./hardware.nix
11
+ ];
12
+
13
+ networking.hostName = "nested-nixos-machine";
14
+
15
+ boot.loader.grub.enable = true;
16
+ boot.loader.grub.version = 2;
17
+ boot.loader.grub.device = "/dev/sda";
18
+
19
+ fileSystems."/" = {
20
+ device = "/dev/sda1";
21
+ fsType = "ext4";
22
+ };
23
+
24
+ system.stateVersion = "20.09";
25
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
7
+ {
8
+ # Your hardware-configuration.nix
9
+ }
@@ -0,0 +1,8 @@
1
+ { config, ... }:
2
+ {
3
+ cluster."nested/nixos-machine" = {
4
+ spin = "nixos";
5
+ inputs.channels = [ "nixos" ];
6
+ host.target = "localhost";
7
+ };
8
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
7
+ {
8
+ imports = [
9
+ ../../environments/base.nix
10
+ ./hardware.nix
11
+ ];
12
+
13
+ networking.hostName = "nixos-machine";
14
+
15
+ boot.loader.grub.enable = true;
16
+ boot.loader.grub.version = 2;
17
+ boot.loader.grub.device = "/dev/sda";
18
+
19
+ fileSystems."/" = {
20
+ device = "/dev/sda1";
21
+ fsType = "ext4";
22
+ };
23
+
24
+ system.stateVersion = "20.09";
25
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
7
+ {
8
+ # Your hardware-configuration.nix
9
+ }
@@ -0,0 +1,8 @@
1
+ { config, ... }:
2
+ {
3
+ cluster."nixos-machine" = {
4
+ spin = "nixos";
5
+ inputs.channels = [ "nixos" ];
6
+ host.target = "localhost";
7
+ };
8
+ }