difftreelog
refactor consistent module naming
in: trunk
4 files changed
README.adocdiffbeforeafterboth60 # treat the contents of this file as implementation detail60 # treat the contents of this file as implementation detail61 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.lanzaboote66 ({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 ./wireguard86 # Multi-instancible modules example86 # Multi-instancible modules example87 (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 built94 system = "x86_64-linux";94 system = "x86_64-linux";95 # And nixos modules95 # And nixos modules96 modules = [96 nixosModules = [97 ./controlplane-1/hardware-configuration.nix97 ./controlplane-1/hardware-configuration.nix98 ./controlplane-1/configuration.nix98 ./controlplane-1/configuration.nix99 # Configuration may also be specified inline, as in any nixos config.99 # Configuration may also be specified inline, as in any nixos config.lib/default.nixdiffbeforeafterboth8 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 }: let15 hostNames = nixpkgs.lib.attrNames hosts;15 hostNames = nixpkgs.lib.attrNames hosts;25 ++ [25 ++ [26 data26 data27 ({...}: {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 };modules/fleet/meta.nixdiffbeforeafterboth12 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.nixosModules90 ++ [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}99100modules/fleet/secrets.nixdiffbeforeafterboth133 })133 })134 config.sharedSecrets;134 config.sharedSecrets;135 hosts = hostsToAttrs (host: {135 hosts = hostsToAttrs (host: {136 modules = let136 nixosModules = let137 cleanupSecret = secretName: v: {137 cleanupSecret = secretName: v: {138 inherit (v) public secret;138 inherit (v) public secret;139 shared = true;139 shared = true;