difftreelog
feat apply networking.hostName from fleet attr name
in: trunk
2 files changed
lib/fleetLib.nixdiffbeforeafterboth1# Shared functions for fleet configuration, available as `fleet` module argument1# Shared functions for fleet configuration, available as `fleet` module argument2{ nixpkgs, hostNames }: with nixpkgs.lib; rec {2{3 nixpkgs,4 hostNames,5}:6with nixpkgs.lib; rec {3 hostsToAttrs = f: listToAttrs (7 hostsToAttrs = f:34 then "${this}-${other}"28 else "${other}-${this}";35 else "${other}-${this}";3637 # For places, where fleet knows better than nixpkgs defaults38 mkFleetDefault = mkOverride 999;29}39}3040modules/fleet/meta.nixdiffbeforeafterboth6 ...6 ...7}:7}:8with lib; let8with lib;9with fleetLib; let9 hostModule = with types;10 hostModule = with types;10 {...} @ hostConfig: {11 {...} @ hostConfig: let12 hostName = hostConfig.config._module.args.name;13 in {11 options = {14 options = {12 modules = mkOption {15 modules = mkOption {13 type = listOf (mkOptionType {16 type = listOf (mkOptionType {32 description = "Nixos configuration";35 description = "Nixos configuration";33 };36 };34 };37 };35 config.nixosSystem = nixpkgs.lib.nixosSystem {38 config = {39 nixosSystem = nixpkgs.lib.nixosSystem {36 inherit (hostConfig.config) system modules;40 inherit (hostConfig.config) system modules;37 specialArgs = {41 specialArgs = {38 inherit fleetLib;42 inherit fleetLib;39 fleet = fleetLib.hostsToAttrs (host: config.hosts.${host}.nixosSystem.config);43 fleet = hostsToAttrs (host: config.hosts.${host}.nixosSystem.config);40 };44 };41 };45 };46 modules = [47 ({...}: {48 networking.hostName = mkFleetDefault hostName;49 })50 ];51 };42 };52 };43 overlayType = mkOptionType {53 overlayType = mkOptionType {44 name = "nixpkgs-overlay";54 name = "nixpkgs-overlay";69 };79 };70 };80 };71 config = {81 config = {72 hosts = fleetLib.hostsToAttrs (host: {82 hosts = hostsToAttrs (host: {73 modules =83 modules =74 config.globalModules84 config.globalModules75 ++ [85 ++ [