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,28 @@
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ inputs,
6
+ ...
7
+ }:
8
+ {
9
+ imports = [
10
+ ../../environments/base.nix
11
+ (inputs.vpsadminos + "/os/lib/nixos-container/vpsadminos.nix")
12
+ ];
13
+
14
+ networking.hostName = "vpsadminos-container";
15
+
16
+ environment.systemPackages = with pkgs; [
17
+ vim
18
+ ];
19
+
20
+ networking.useDHCP = false;
21
+ services.resolved.enable = false;
22
+ systemd.services.systemd-udev-trigger.enable = false;
23
+
24
+ documentation.enable = true;
25
+ documentation.nixos.enable = true;
26
+
27
+ system.stateVersion = "20.09";
28
+ }
@@ -0,0 +1,8 @@
1
+ { config, ... }:
2
+ {
3
+ cluster."vpsadminos-container" = {
4
+ spin = "nixos";
5
+ inputs.channels = [ "vpsadminos" ];
6
+ host.target = "<ip address>";
7
+ };
8
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ ...
6
+ }:
7
+ {
8
+ imports = [
9
+ ../../environments/base.nix
10
+ ./hardware.nix
11
+ ];
12
+
13
+ networking.hostName = "vpsadminos-machine";
14
+
15
+ boot.loader.grub.enable = true;
16
+ boot.loader.grub.version = 2;
17
+ # boot.loader.grub.device = "";
18
+
19
+ boot.supportedFilesystems = [ "zfs" ];
20
+ boot.kernelParams = [ "nolive" ];
21
+
22
+ boot.zfs.pools = {
23
+ # ZFS pool configuration
24
+ };
25
+
26
+ system.stateVersion = "20.09";
27
+ }
@@ -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."vpsadminos-machine" = {
4
+ spin = "vpsadminos";
5
+ inputs.channels = [ "vpsadminos" ];
6
+ host.target = "<ip address>";
7
+ };
8
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ config,
3
+ pkgs,
4
+ lib,
5
+ inputs,
6
+ ...
7
+ }:
8
+ {
9
+ imports = [
10
+ ../../environments/base.nix
11
+ (inputs.vpsadminos + "/os/lib/nixos-container/vpsadminos.nix")
12
+ ];
13
+
14
+ networking.hostName = "vpsfreecz-vps";
15
+
16
+ environment.systemPackages = with pkgs; [
17
+ vim
18
+ ];
19
+
20
+ networking.useDHCP = false;
21
+ services.resolved.enable = false;
22
+ systemd.extraConfig = ''
23
+ DefaultTimeoutStartSec=900s
24
+ '';
25
+ systemd.services.systemd-udev-trigger.enable = false;
26
+
27
+ documentation.enable = true;
28
+ documentation.nixos.enable = true;
29
+
30
+ system.stateVersion = "20.09";
31
+ }
@@ -0,0 +1,8 @@
1
+ { config, ... }:
2
+ {
3
+ cluster."vpsfreecz-vps" = {
4
+ spin = "nixos";
5
+ inputs.channels = [ "vpsadminos" ];
6
+ host.target = "<ip address>";
7
+ };
8
+ }
@@ -0,0 +1,10 @@
1
+ { config, ... }:
2
+ {
3
+ confctl = {
4
+ # listColumns = {
5
+ # "name"
6
+ # "spin"
7
+ # "host.fqdn"
8
+ # };
9
+ };
10
+ }
@@ -0,0 +1,5 @@
1
+ { lib }:
2
+ {
3
+ # Place to load custom data sets
4
+ sshKeys = import ./ssh-keys.nix;
5
+ }
@@ -0,0 +1,7 @@
1
+ rec {
2
+ admins = [
3
+ # someone
4
+ ];
5
+
6
+ someone = "...ssh public key...";
7
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ config,
3
+ pkgs,
4
+ confData,
5
+ ...
6
+ }:
7
+ {
8
+ time.timeZone = "Europe/Amsterdam";
9
+
10
+ services.openssh.enable = true;
11
+
12
+ environment.systemPackages = with pkgs; [
13
+ vim
14
+ screen
15
+ ];
16
+
17
+ users.users.root.openssh.authorizedKeys.keys = with confData.sshKeys; admins;
18
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "nodes": {
3
+ "confctl": {
4
+ "inputs": {
5
+ "nixpkgs": "nixpkgs"
6
+ },
7
+ "locked": {
8
+ "path": "..",
9
+ "type": "path"
10
+ },
11
+ "original": {
12
+ "path": "..",
13
+ "type": "path"
14
+ },
15
+ "parent": []
16
+ },
17
+ "nixpkgs": {
18
+ "locked": {
19
+ "lastModified": 1771008912,
20
+ "narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=",
21
+ "owner": "NixOS",
22
+ "repo": "nixpkgs",
23
+ "rev": "a82ccc39b39b621151d6732718e3e250109076fa",
24
+ "type": "github"
25
+ },
26
+ "original": {
27
+ "owner": "NixOS",
28
+ "ref": "nixos-unstable",
29
+ "repo": "nixpkgs",
30
+ "type": "github"
31
+ }
32
+ },
33
+ "nixpkgs_2": {
34
+ "locked": {
35
+ "lastModified": 1771008912,
36
+ "narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=",
37
+ "owner": "NixOS",
38
+ "repo": "nixpkgs",
39
+ "rev": "a82ccc39b39b621151d6732718e3e250109076fa",
40
+ "type": "github"
41
+ },
42
+ "original": {
43
+ "owner": "NixOS",
44
+ "ref": "nixos-unstable",
45
+ "repo": "nixpkgs",
46
+ "type": "github"
47
+ }
48
+ },
49
+ "root": {
50
+ "inputs": {
51
+ "confctl": "confctl",
52
+ "nixpkgs": "nixpkgs_2",
53
+ "vpsadminos": "vpsadminos"
54
+ }
55
+ },
56
+ "vpsadminos": {
57
+ "locked": {
58
+ "lastModified": 1771582184,
59
+ "narHash": "sha256-gWttuL99qq18bQkLIM0TJiNnERvbyiosZvlb8hmslIo=",
60
+ "owner": "vpsfreecz",
61
+ "repo": "vpsadminos",
62
+ "rev": "b48e737b40d58d9cdd2f1fef4491b83e463ce554",
63
+ "type": "github"
64
+ },
65
+ "original": {
66
+ "owner": "vpsfreecz",
67
+ "ref": "staging",
68
+ "repo": "vpsadminos",
69
+ "type": "github"
70
+ }
71
+ }
72
+ },
73
+ "root": "root",
74
+ "version": 7
75
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ description = "confctl example (flake)";
3
+
4
+ inputs = {
5
+ confctl.url = "path:..";
6
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
7
+ vpsadminos.url = "github:vpsfreecz/vpsadminos/staging";
8
+ };
9
+
10
+ outputs =
11
+ inputs@{ self, confctl, ... }:
12
+ let
13
+ channels = {
14
+ nixos = {
15
+ nixpkgs = "nixpkgs";
16
+ };
17
+ vpsadminos = {
18
+ nixpkgs = "nixpkgs";
19
+ vpsadminos = "vpsadminos";
20
+ };
21
+ };
22
+
23
+ confctlOutputs = confctl.lib.mkConfctlOutputs {
24
+ confDir = ./.;
25
+ inherit inputs channels;
26
+ };
27
+ in
28
+ {
29
+ confctl = confctlOutputs;
30
+
31
+ devShells.x86_64-linux.default = confctl.lib.mkConfigDevShell {
32
+ system = "x86_64-linux";
33
+ mode = "minimal";
34
+ };
35
+ };
36
+ }
@@ -0,0 +1,13 @@
1
+ rec {
2
+ shared = [
3
+ # Modules not dependent on spin
4
+ ];
5
+
6
+ nixos = shared ++ [
7
+ # Modules only for NixOS
8
+ ];
9
+
10
+ vpsadminos = shared ++ [
11
+ # Modules only for vpsAdminOS
12
+ ];
13
+ }
@@ -0,0 +1,11 @@
1
+ # When a part of confctl repository
2
+ import ../shell.nix
3
+
4
+ # When copied elsewhere
5
+ # if builtins.pathExists ../confctl/shell.nix then
6
+ # import ../confctl/shell.nix
7
+ # else if builtins.pathExists ../../confctl/shell.nix then
8
+ # import ../../confctl/shell.nix
9
+ # else if builtins.pathExists /where-is-your-confctl/shell.nix then
10
+ # import /where-is-your-confctl/shell.nix
11
+ # else builtins.abort "Unable to find confctl shell"
data/flake.lock ADDED
@@ -0,0 +1,159 @@
1
+ {
2
+ "nodes": {
3
+ "home-manager": {
4
+ "inputs": {
5
+ "nixpkgs": [
6
+ "vpsadminos",
7
+ "impermanence",
8
+ "nixpkgs"
9
+ ]
10
+ },
11
+ "locked": {
12
+ "lastModified": 1768598210,
13
+ "narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=",
14
+ "owner": "nix-community",
15
+ "repo": "home-manager",
16
+ "rev": "c47b2cc64a629f8e075de52e4742de688f930dc6",
17
+ "type": "github"
18
+ },
19
+ "original": {
20
+ "owner": "nix-community",
21
+ "repo": "home-manager",
22
+ "type": "github"
23
+ }
24
+ },
25
+ "impermanence": {
26
+ "inputs": {
27
+ "home-manager": "home-manager",
28
+ "nixpkgs": "nixpkgs"
29
+ },
30
+ "locked": {
31
+ "lastModified": 1769548169,
32
+ "narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=",
33
+ "owner": "nix-community",
34
+ "repo": "impermanence",
35
+ "rev": "7b1d382faf603b6d264f58627330f9faa5cba149",
36
+ "type": "github"
37
+ },
38
+ "original": {
39
+ "owner": "nix-community",
40
+ "repo": "impermanence",
41
+ "type": "github"
42
+ }
43
+ },
44
+ "netlinkrb": {
45
+ "flake": false,
46
+ "locked": {
47
+ "lastModified": 1562850306,
48
+ "narHash": "sha256-0bXTWUdUDr2XP+bEIfIbxXap8Niva/IoPXTxFeXXImg=",
49
+ "owner": "vpsfreecz",
50
+ "repo": "netlinkrb",
51
+ "rev": "d9de53d843d2586ffa5b7b404887fa801c697ddf",
52
+ "type": "github"
53
+ },
54
+ "original": {
55
+ "owner": "vpsfreecz",
56
+ "repo": "netlinkrb",
57
+ "type": "github"
58
+ }
59
+ },
60
+ "nixpkgs": {
61
+ "locked": {
62
+ "lastModified": 1768564909,
63
+ "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
64
+ "owner": "nixos",
65
+ "repo": "nixpkgs",
66
+ "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
67
+ "type": "github"
68
+ },
69
+ "original": {
70
+ "owner": "nixos",
71
+ "ref": "nixos-unstable",
72
+ "repo": "nixpkgs",
73
+ "type": "github"
74
+ }
75
+ },
76
+ "nixpkgsUnstable": {
77
+ "locked": {
78
+ "lastModified": 1786106723,
79
+ "narHash": "sha256-zDSUbpoeo/9ZmD2+wXnzxoo1+uhL8vxc0b8yuYMKYq0=",
80
+ "owner": "NixOS",
81
+ "repo": "nixpkgs",
82
+ "rev": "f13ff45afd1bb73e640eaa08a7066dbed07e3238",
83
+ "type": "github"
84
+ },
85
+ "original": {
86
+ "owner": "NixOS",
87
+ "ref": "nixos-unstable",
88
+ "repo": "nixpkgs",
89
+ "type": "github"
90
+ }
91
+ },
92
+ "nixpkgs_2": {
93
+ "locked": {
94
+ "lastModified": 1786201459,
95
+ "narHash": "sha256-CiOTEjmwAmG2AWnaIno9YaCJJmpca2FXPhMAsnrolCg=",
96
+ "owner": "NixOS",
97
+ "repo": "nixpkgs",
98
+ "rev": "8b8c811c7c2541c30382c5de7ed26be055569c60",
99
+ "type": "github"
100
+ },
101
+ "original": {
102
+ "owner": "NixOS",
103
+ "ref": "nixos-26.05",
104
+ "repo": "nixpkgs",
105
+ "type": "github"
106
+ }
107
+ },
108
+ "root": {
109
+ "inputs": {
110
+ "nixpkgs": [
111
+ "vpsadminos",
112
+ "nixpkgs"
113
+ ],
114
+ "vpsadminos": "vpsadminos"
115
+ }
116
+ },
117
+ "ruby-lxc": {
118
+ "flake": false,
119
+ "locked": {
120
+ "lastModified": 1780499941,
121
+ "narHash": "sha256-guAdOSP9MyCL3BQ1LGXAhcCoXgEU1fUE69d2ATMqUGE=",
122
+ "owner": "vpsfreecz",
123
+ "repo": "ruby-lxc",
124
+ "rev": "004bf35eb90d41ba60b347b5b1e73d868a4f95d9",
125
+ "type": "github"
126
+ },
127
+ "original": {
128
+ "owner": "vpsfreecz",
129
+ "ref": "2026-06-03-nixos-26-05-port",
130
+ "repo": "ruby-lxc",
131
+ "type": "github"
132
+ }
133
+ },
134
+ "vpsadminos": {
135
+ "inputs": {
136
+ "impermanence": "impermanence",
137
+ "netlinkrb": "netlinkrb",
138
+ "nixpkgs": "nixpkgs_2",
139
+ "nixpkgsUnstable": "nixpkgsUnstable",
140
+ "ruby-lxc": "ruby-lxc"
141
+ },
142
+ "locked": {
143
+ "lastModified": 1786367885,
144
+ "narHash": "sha256-HOL3ACMUyRFhA4Cd2zk5qhnUf0zaEifHsQv86hwHgSc=",
145
+ "owner": "vpsfreecz",
146
+ "repo": "vpsadminos",
147
+ "rev": "67fcc17372d175b036706a1459a8b471bfc225e0",
148
+ "type": "github"
149
+ },
150
+ "original": {
151
+ "owner": "vpsfreecz",
152
+ "repo": "vpsadminos",
153
+ "type": "github"
154
+ }
155
+ }
156
+ },
157
+ "root": "root",
158
+ "version": 7
159
+ }
data/flake.nix ADDED
@@ -0,0 +1,189 @@
1
+ {
2
+ description = "confctl";
3
+
4
+ inputs = {
5
+ vpsadminos.url = "github:vpsfreecz/vpsadminos";
6
+ nixpkgs.follows = "vpsadminos/nixpkgs";
7
+ };
8
+
9
+ outputs =
10
+ {
11
+ self,
12
+ nixpkgs,
13
+ vpsadminos,
14
+ }:
15
+ let
16
+ systems = [
17
+ "x86_64-linux"
18
+ "aarch64-linux"
19
+ ];
20
+ testSystems = [ "x86_64-linux" ];
21
+ forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
22
+ forTestSystems = f: nixpkgs.lib.genAttrs testSystems (system: f system);
23
+ hasTestRunner = system: builtins.elem system testSystems;
24
+
25
+ mkConfigDevShell = import ./nix/flake/mk-config-devshell.nix { inherit self nixpkgs; };
26
+ mkConfctlDevShell = import ./nix/flake/mk-confctl-devshell.nix { inherit nixpkgs; };
27
+ mkConfctlPackage = import ./nix/package.nix;
28
+
29
+ mkRspecCheck =
30
+ system:
31
+ let
32
+ pkgs = import nixpkgs { inherit system; };
33
+ ruby = if pkgs ? ruby_3_4 then pkgs.ruby_3_4 else pkgs.ruby;
34
+ deps = pkgs.bundlerEnv {
35
+ name = "confctl-rspec-deps";
36
+ inherit ruby;
37
+ gemdir = self.outPath;
38
+ lockfile = "${self.outPath}/Gemfile.lock";
39
+ groups = [
40
+ "default"
41
+ "development"
42
+ "test"
43
+ ];
44
+ };
45
+ runtimePath = pkgs.lib.makeBinPath [
46
+ pkgs.git
47
+ pkgs.openssh
48
+ pkgs.nix
49
+ pkgs.nix-prefetch-git
50
+ ];
51
+ gemBin = "${deps}/${ruby.gemPath}/bin";
52
+ in
53
+ pkgs.stdenv.mkDerivation {
54
+ pname = "confctl-rspec";
55
+ version = self.shortRev or (self.dirtyShortRev or "dev");
56
+ src = self;
57
+ dontUnpack = true;
58
+ dontBuild = true;
59
+ nativeBuildInputs = [
60
+ pkgs.git
61
+ pkgs.nix
62
+ pkgs.openssh
63
+ pkgs.nix-prefetch-git
64
+ ];
65
+ installPhase = ''
66
+ export HOME="$TMPDIR/home"
67
+ mkdir -p "$HOME"
68
+ export GEM_HOME="${deps}/${ruby.gemPath}"
69
+ export GEM_PATH="${deps}/${ruby.gemPath}"
70
+ export RUBYLIB="$src/lib"
71
+ export PATH="${gemBin}:${runtimePath}:$PATH"
72
+ export CONFCTL_TTY=0
73
+ export NO_COLOR=1
74
+ export PAGER=
75
+ export CONFCTL_BIN="${self.packages.${system}.confctl}/bin/confctl"
76
+ export NIX_PATH="nixpkgs=${nixpkgs.outPath}"
77
+ export CONFCTL_TEST_NIXPKGS="${nixpkgs.outPath}"
78
+ export CONFCTL_RSPEC_SANDBOX=1
79
+ export CONFCTL_MAX_JOBS=auto
80
+
81
+ cd "$src"
82
+ ${ruby}/bin/ruby -S rspec
83
+
84
+ mkdir -p "$out"
85
+ echo ok > "$out/result"
86
+ '';
87
+ };
88
+
89
+ mkTests =
90
+ system:
91
+ vpsadminos.lib.testFramework.mkTests {
92
+ inherit system;
93
+ pkgsPath = nixpkgs.outPath;
94
+ testsRoot = ./tests;
95
+ suiteArgs = {
96
+ confctlSrc = self.outPath;
97
+ confctlPackage = self.packages.${system}.confctl;
98
+ };
99
+ };
100
+
101
+ mkTestsMeta =
102
+ system:
103
+ vpsadminos.lib.testFramework.mkTestsMeta {
104
+ inherit system;
105
+ pkgsPath = nixpkgs.outPath;
106
+ testsRoot = ./tests;
107
+ suiteArgs = {
108
+ confctlSrc = self.outPath;
109
+ confctlPackage = self.packages.${system}.confctl;
110
+ };
111
+ };
112
+ in
113
+ {
114
+ lib.mkConfctlOutputs = import ./nix/flake/mk-confctl-outputs.nix;
115
+
116
+ # Dev shells for cluster configuration repos.
117
+ lib.mkConfigDevShell = mkConfigDevShell;
118
+
119
+ # Dev shell for working on confctl itself.
120
+ lib.mkConfctlDevShell = mkConfctlDevShell;
121
+
122
+ devShells = forAllSystems (system: {
123
+ default = mkConfctlDevShell { inherit system; };
124
+ });
125
+
126
+ packages = forAllSystems (
127
+ system:
128
+ let
129
+ pkgs = import nixpkgs { inherit system; };
130
+ in
131
+ {
132
+ confctl = mkConfctlPackage {
133
+ inherit pkgs;
134
+ src = self.outPath;
135
+ };
136
+ }
137
+ // nixpkgs.lib.optionalAttrs (hasTestRunner system) {
138
+ test-runner = vpsadminos.packages.${system}.test-runner;
139
+ }
140
+ );
141
+
142
+ apps = forAllSystems (
143
+ system:
144
+ nixpkgs.lib.optionalAttrs (hasTestRunner system) {
145
+ test-runner = {
146
+ type = "app";
147
+ program = "${vpsadminos.packages.${system}.test-runner}/bin/test-runner";
148
+ };
149
+ }
150
+ );
151
+
152
+ tests = forTestSystems (system: mkTests system);
153
+
154
+ testsMeta = forTestSystems (system: mkTestsMeta system);
155
+
156
+ checks = forAllSystems (
157
+ system:
158
+ {
159
+ rspec = mkRspecCheck system;
160
+ }
161
+ // nixpkgs.lib.optionalAttrs (hasTestRunner system) (mkTests system)
162
+ );
163
+
164
+ checksMeta = forAllSystems (
165
+ system:
166
+ nixpkgs.lib.optionalAttrs (hasTestRunner system) {
167
+ tests = mkTestsMeta system;
168
+ }
169
+ );
170
+
171
+ nixosModules = {
172
+ generations = import ./nix/modules/confctl/generations.nix;
173
+ cli = import ./nix/modules/confctl/cli.nix;
174
+ nix = import ./nix/modules/confctl/nix.nix;
175
+ swpins = import ./nix/modules/confctl/swpins.nix;
176
+ inputs-info = import ./nix/modules/confctl/inputs-info.nix;
177
+ configuration-info = import ./nix/modules/confctl/configuration-info.nix;
178
+ default = {
179
+ imports = [
180
+ (import ./nix/modules/confctl/generations.nix)
181
+ (import ./nix/modules/confctl/cli.nix)
182
+ (import ./nix/modules/confctl/nix.nix)
183
+ (import ./nix/modules/confctl/inputs-info.nix)
184
+ (import ./nix/modules/confctl/configuration-info.nix)
185
+ ];
186
+ };
187
+ };
188
+ };
189
+ }