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
60 # treat the contents of this file as implementation detail60 # treat the contents of this file as implementation detail
61 data = import ./fleet.nix;61 data = import ./fleet.nix;
62 62
63 # globalModules section of fleet config declares modules, which are used for all configured nixos hosts.63 # nixosModules section of fleet config declares modules, which are used for all configured nixos hosts.
64 globalModules = [64 nixosModules = [
65 lanzaboote.nixosModules.lanzaboote65 lanzaboote.nixosModules.lanzaboote
66 ({66 ({
67 config,67 config,
81 # Is I.e wiring up the mesh VPN, or deploying kubernetes, or other things.81 # Is I.e wiring up the mesh VPN, or deploying kubernetes, or other things.
82 #82 #
83 # Modules use the same semantics as standard nixos module system, they are just configuring all the hosts at once.83 # Modules use the same semantics as standard nixos module system, they are just configuring all the hosts at once.
84 modules = [84 fleetModules = [
85 ./wireguard85 ./wireguard
86 # Multi-instancible modules example86 # Multi-instancible modules example
87 (import ./kubernetes {hosts = ["a" "b"];})87 (import ./kubernetes {hosts = ["a" "b"];})
93 # Every host has some system, for which the system configuration needs to be built93 # Every host has some system, for which the system configuration needs to be built
94 system = "x86_64-linux";94 system = "x86_64-linux";
95 # And nixos modules95 # And nixos modules
96 modules = [96 nixosModules = [
97 ./controlplane-1/hardware-configuration.nix97 ./controlplane-1/hardware-configuration.nix
98 ./controlplane-1/configuration.nix98 ./controlplane-1/configuration.nix
99 # Configuration may also be specified inline, as in any nixos config.99 # 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
--- 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;