git.delta.rocks / jrsonnet / refs/commits / 05b4cf076c7f

difftreelog

refactor consistent module naming

Yaroslav Bolyukin2024-05-03parent: #47baace.patch.diff
in: trunk

4 files changed

modifiedREADME.adocdiffbeforeafterboth
--- a/README.adoc
+++ b/README.adoc
@@ -60,8 +60,8 @@
       # treat the contents of this file as implementation detail
       data = import ./fleet.nix;
       
-      # globalModules section of fleet config declares modules, which are used for all configured nixos hosts.
-      globalModules = [
+      # nixosModules section of fleet config declares modules, which are used for all configured nixos hosts.
+      nixosModules = [
         lanzaboote.nixosModules.lanzaboote
         ({
           config,
@@ -81,7 +81,7 @@
       # Is I.e wiring up the mesh VPN, or deploying kubernetes, or other things.
       #
       # Modules use the same semantics as standard nixos module system, they are just configuring all the hosts at once.
-      modules = [
+      fleetModules = [
         ./wireguard
         # Multi-instancible modules example
         (import ./kubernetes {hosts = ["a" "b"];})
@@ -93,7 +93,7 @@
         # Every host has some system, for which the system configuration needs to be built
         system = "x86_64-linux";
         # And nixos modules
-        modules = [
+        nixosModules = [
           ./controlplane-1/hardware-configuration.nix
           ./controlplane-1/configuration.nix
           # Configuration may also be specified inline, as in any nixos config.
modifiedlib/default.nixdiffbeforeafterboth
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -8,8 +8,8 @@
     nixpkgs,
     overlays ? [],
     hosts,
-    modules,
-    globalModules ? [],
+    fleetModules,
+    nixosModules ? [],
     extraFleetLib ? {},
   }: let
     hostNames = nixpkgs.lib.attrNames hosts;
@@ -25,10 +25,10 @@
         ++ [
           data
           ({...}: {
-            inherit globalModules hosts overlays;
+            inherit nixosModules hosts overlays;
           })
         ]
-        ++ modules;
+        ++ fleetModules;
       specialArgs = {
         inherit nixpkgs fleetLib;
       };
modifiedmodules/fleet/meta.nixdiffbeforeafterboth
12 hostName = hostConfig.config._module.args.name;12 hostName = hostConfig.config._module.args.name;
13 in {13 in {
14 options = {14 options = {
15 modules = mkOption {15 nixosModules = mkOption {
16 type = listOf (mkOptionType {16 type = listOf (mkOptionType {
17 name = "submodule";17 name = "submodule";
18 inherit (submodule {}) check;18 inherit (submodule {}) check;
19 merge = lib.options.mergeOneOption;19 merge = lib.options.mergeOneOption;
20 description = "Nixos modules";20 description = "Nixos module";
21 });21 });
22 description = "List of nixos modules";22 description = "List of nixos modules";
23 default = [];23 default = [];
42 };42 };
43 config = {43 config = {
44 nixosSystem = hostConfig.config.nixpkgs.lib.nixosSystem {44 nixosSystem = hostConfig.config.nixpkgs.lib.nixosSystem {
45 inherit (hostConfig.config) system modules;45 inherit (hostConfig.config) system;
46 modules = hostConfig.config.nixosModules;
46 specialArgs = {47 specialArgs = {
47 inherit fleetLib;48 inherit fleetLib;
48 fleet = hostsToAttrs (host: config.hosts.${host}.nixosSystem.config);49 fleet = hostsToAttrs (host: config.hosts.${host}.nixosSystem.config);
49 };50 };
50 };51 };
51 modules = [52 nixosModules = [
52 ({...}: {53 ({...}: {
53 networking.hostName = mkFleetGeneratorDefault hostName;54 networking.hostName = mkFleetGeneratorDefault hostName;
54 })55 })
68 default = {};69 default = {};
69 description = "Configurations of individual hosts";70 description = "Configurations of individual hosts";
70 };71 };
71 globalModules = mkOption {72 nixosModules = mkOption {
72 type = listOf (mkOptionType {73 type = listOf (mkOptionType {
73 name = "submodule";74 name = "submodule";
74 inherit (submodule {}) check;75 inherit (submodule {}) check;
85 };86 };
86 config = {87 config = {
87 hosts = hostsToAttrs (host: {88 hosts = hostsToAttrs (host: {
88 modules =89 nixosModules =
89 config.globalModules90 config.nixosModules
90 ++ [91 ++ [
91 ({...}: {92 ({...}: {
92 nixpkgs.overlays = config.overlays;93 nixpkgs.overlays = config.overlays;
93 })94 })
94 ];95 ];
95 });96 });
96 globalModules = import ../../nixos/modules/module-list.nix;97 nixosModules = import ../../nixos/modules/module-list.nix;
97 };98 };
98}99}
99100
modifiedmodules/fleet/secrets.nixdiffbeforeafterboth
--- a/modules/fleet/secrets.nix
+++ b/modules/fleet/secrets.nix
@@ -133,7 +133,7 @@
       })
       config.sharedSecrets;
     hosts = hostsToAttrs (host: {
-      modules = let
+      nixosModules = let
         cleanupSecret = secretName: v: {
           inherit (v) public secret;
           shared = true;