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
8 nixpkgs,8 nixpkgs,
9 overlays ? [],9 overlays ? [],
10 hosts,10 hosts,
11 modules,11 fleetModules,
12 globalModules ? [],12 nixosModules ? [],
13 extraFleetLib ? {},13 extraFleetLib ? {},
14 }: let14 }: let
15 hostNames = nixpkgs.lib.attrNames hosts;15 hostNames = nixpkgs.lib.attrNames hosts;
25 ++ [25 ++ [
26 data26 data
27 ({...}: {27 ({...}: {
28 inherit globalModules hosts overlays;28 inherit nixosModules hosts overlays;
29 })29 })
30 ]30 ]
31 ++ modules;31 ++ fleetModules;
32 specialArgs = {32 specialArgs = {
33 inherit nixpkgs fleetLib;33 inherit nixpkgs fleetLib;
34 };34 };
modifiedmodules/fleet/meta.nixdiffbeforeafterboth
--- a/modules/fleet/meta.nix
+++ b/modules/fleet/meta.nix
@@ -12,12 +12,12 @@
       hostName = hostConfig.config._module.args.name;
     in {
       options = {
-        modules = mkOption {
+        nixosModules = mkOption {
           type = listOf (mkOptionType {
             name = "submodule";
             inherit (submodule {}) check;
             merge = lib.options.mergeOneOption;
-            description = "Nixos modules";
+            description = "Nixos module";
           });
           description = "List of nixos modules";
           default = [];
@@ -42,13 +42,14 @@
       };
       config = {
         nixosSystem = hostConfig.config.nixpkgs.lib.nixosSystem {
-          inherit (hostConfig.config) system modules;
+          inherit (hostConfig.config) system;
+          modules = hostConfig.config.nixosModules;
           specialArgs = {
             inherit fleetLib;
             fleet = hostsToAttrs (host: config.hosts.${host}.nixosSystem.config);
           };
         };
-        modules = [
+        nixosModules = [
           ({...}: {
             networking.hostName = mkFleetGeneratorDefault hostName;
           })
@@ -68,7 +69,7 @@
       default = {};
       description = "Configurations of individual hosts";
     };
-    globalModules = mkOption {
+    nixosModules = mkOption {
       type = listOf (mkOptionType {
         name = "submodule";
         inherit (submodule {}) check;
@@ -85,14 +86,14 @@
   };
   config = {
     hosts = hostsToAttrs (host: {
-      modules =
-        config.globalModules
+      nixosModules =
+        config.nixosModules
         ++ [
           ({...}: {
             nixpkgs.overlays = config.overlays;
           })
         ];
     });
-    globalModules = import ../../nixos/modules/module-list.nix;
+    nixosModules = import ../../nixos/modules/module-list.nix;
   };
 }
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;