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/lib/confctl/cli/app.rb
CHANGED
|
@@ -36,6 +36,9 @@ module ConfCtl::Cli
|
|
|
36
36
|
|
|
37
37
|
desc 'Create a new configuration'
|
|
38
38
|
command :init do |c|
|
|
39
|
+
c.desc 'Create legacy swpins-based configuration (non-flake)'
|
|
40
|
+
c.switch %i[swpins legacy], default_value: false
|
|
41
|
+
|
|
39
42
|
c.action(&Command.run(c, Configuration, :init))
|
|
40
43
|
end
|
|
41
44
|
|
|
@@ -145,6 +148,148 @@ module ConfCtl::Cli
|
|
|
145
148
|
end
|
|
146
149
|
end
|
|
147
150
|
|
|
151
|
+
desc 'Manage flake inputs (replacement for swpins in flake configs)'
|
|
152
|
+
command :inputs do |inputs|
|
|
153
|
+
inputs.desc 'List root-level flake inputs and their locked revisions'
|
|
154
|
+
inputs.arg_name '[input-pattern]'
|
|
155
|
+
inputs.command :ls do |c|
|
|
156
|
+
c.action(&Command.run(c, Inputs::Root, :list))
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
inputs.desc 'Update flake inputs in flake.lock'
|
|
160
|
+
inputs.arg_name '[input-name ...]'
|
|
161
|
+
inputs.command :update do |c|
|
|
162
|
+
c.desc 'Commit changes to git'
|
|
163
|
+
c.switch :commit, default_value: false
|
|
164
|
+
|
|
165
|
+
c.desc 'Include git log in the commit message'
|
|
166
|
+
c.switch :changelog, default_value: true
|
|
167
|
+
|
|
168
|
+
c.desc 'Open $EDITOR with commit message'
|
|
169
|
+
c.switch :editor, default_value: true
|
|
170
|
+
|
|
171
|
+
c.desc 'Treat change as downgrade for changelog direction'
|
|
172
|
+
c.switch %i[d downgrade], default_value: false
|
|
173
|
+
|
|
174
|
+
c.desc 'Update all root inputs (dangerous; normally specify names)'
|
|
175
|
+
c.switch :all, default_value: false
|
|
176
|
+
|
|
177
|
+
c.action(&Command.run(c, Inputs::Root, :update))
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
inputs.desc 'Set a flake input to a specific revision'
|
|
181
|
+
inputs.arg_name '<input-name> <rev>'
|
|
182
|
+
inputs.command :set do |c|
|
|
183
|
+
c.desc 'Commit changes to git'
|
|
184
|
+
c.switch :commit, default_value: false
|
|
185
|
+
|
|
186
|
+
c.desc 'Include git log in the commit message'
|
|
187
|
+
c.switch :changelog, default_value: true
|
|
188
|
+
|
|
189
|
+
c.desc 'Open $EDITOR with commit message'
|
|
190
|
+
c.switch :editor, default_value: true
|
|
191
|
+
|
|
192
|
+
c.desc 'Treat change as downgrade for changelog direction'
|
|
193
|
+
c.switch %i[d downgrade], default_value: false
|
|
194
|
+
|
|
195
|
+
c.action(&Command.run(c, Inputs::Root, :set))
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
inputs.desc 'Channel-based input operations'
|
|
199
|
+
inputs.command :channel do |ch|
|
|
200
|
+
ch.desc 'List channels and their role->input mapping (with locked revisions)'
|
|
201
|
+
ch.arg_name '[channel-pattern]'
|
|
202
|
+
ch.command :ls do |c|
|
|
203
|
+
c.action(&Command.run(c, Inputs::Channels, :list))
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
ch.desc 'Update inputs referenced by channels (optionally only a single role)'
|
|
207
|
+
ch.arg_name '<channels> [role]'
|
|
208
|
+
ch.command :update do |c|
|
|
209
|
+
c.switch :commit, default_value: false
|
|
210
|
+
c.switch :changelog, default_value: true
|
|
211
|
+
c.switch :editor, default_value: true
|
|
212
|
+
c.switch %i[d downgrade], default_value: false
|
|
213
|
+
c.action(&Command.run(c, Inputs::Channels, :update))
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
ch.desc 'Set inputs referenced by channels for a role to a specific revision'
|
|
217
|
+
ch.arg_name '<channels> <role> <rev>'
|
|
218
|
+
ch.command :set do |c|
|
|
219
|
+
c.switch :commit, default_value: false
|
|
220
|
+
c.switch :changelog, default_value: true
|
|
221
|
+
c.switch :editor, default_value: true
|
|
222
|
+
c.switch %i[d downgrade], default_value: false
|
|
223
|
+
c.desc 'Allow setting inputs shared with other channels/roles'
|
|
224
|
+
c.switch :allow_shared, default_value: false
|
|
225
|
+
c.action(&Command.run(c, Inputs::Channels, :set))
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
inputs.desc 'Machine-based input operations'
|
|
230
|
+
inputs.command :machine do |m|
|
|
231
|
+
m.desc 'Update the input used by a specific machine for a specific role'
|
|
232
|
+
m.arg_name '<machine> <role>'
|
|
233
|
+
m.command :update do |c|
|
|
234
|
+
c.switch :commit, default_value: false
|
|
235
|
+
c.switch :changelog, default_value: true
|
|
236
|
+
c.switch :editor, default_value: true
|
|
237
|
+
c.switch %i[d downgrade], default_value: false
|
|
238
|
+
c.action(&Command.run(c, Inputs::Machines, :update))
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
m.desc 'Set the input used by a specific machine for a specific role to a revision'
|
|
242
|
+
m.arg_name '<machine> <role> <rev>'
|
|
243
|
+
m.command :set do |c|
|
|
244
|
+
c.switch :commit, default_value: false
|
|
245
|
+
c.switch :changelog, default_value: true
|
|
246
|
+
c.switch :editor, default_value: true
|
|
247
|
+
c.switch %i[d downgrade], default_value: false
|
|
248
|
+
c.action(&Command.run(c, Inputs::Machines, :set))
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
desc 'Migration helpers'
|
|
254
|
+
command :migrate do |m|
|
|
255
|
+
m.desc 'Migrate swpins-based configuration repository to flake-based inputs'
|
|
256
|
+
m.command :'swpins-to-flakes' do |stf|
|
|
257
|
+
stf.desc 'Assume yes for all prompts'
|
|
258
|
+
stf.switch %i[y yes], default_value: false
|
|
259
|
+
|
|
260
|
+
stf.desc 'Do not modify files, only print what would be done'
|
|
261
|
+
stf.switch %i[n dry-run], default_value: false
|
|
262
|
+
|
|
263
|
+
# Default action = run full migration
|
|
264
|
+
stf.action(&Command.run(stf, Migrate::SwpinsToFlakes, :all))
|
|
265
|
+
|
|
266
|
+
stf.desc 'Create flake.nix (+ lock revisions from swpins)'
|
|
267
|
+
stf.command :flake do |c|
|
|
268
|
+
c.action(&Command.run(c, Migrate::SwpinsToFlakes, :flake))
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
stf.desc 'Rewrite cluster/**/module.nix metadata to use inputs.*'
|
|
272
|
+
stf.command :machines do |c|
|
|
273
|
+
c.action(&Command.run(c, Migrate::SwpinsToFlakes, :machines))
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
stf.desc 'Scan for legacy <...> imports and optionally enable legacyNixPath'
|
|
277
|
+
stf.command :imports do |c|
|
|
278
|
+
c.action(&Command.run(c, Migrate::SwpinsToFlakes, :imports))
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
stf.desc 'Remove swpins/ and other legacy files'
|
|
282
|
+
stf.command :clean do |c|
|
|
283
|
+
c.action(&Command.run(c, Migrate::SwpinsToFlakes, :clean))
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
stf.desc 'Run the full migration (same as running without a subcommand)'
|
|
287
|
+
stf.command :all do |c|
|
|
288
|
+
c.action(&Command.run(c, Migrate::SwpinsToFlakes, :all))
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
|
|
148
293
|
desc 'List configured machines'
|
|
149
294
|
arg_name '[machine-pattern]'
|
|
150
295
|
command :ls do |c|
|