From c26c43289062dead60420fa9d7c960ca42348081 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 7 Jul 2025 06:48:19 +0800 Subject: [PATCH] feat(nixos): pass hostName to nixosSystem, move hm modules --- nix/configurations.nix | 7 +++++-- nix/manifest.nix | 1 - nix/modules/{flake => }/home-manager.nix | 4 ++-- nix/modules/{nixos => }/users.nix | 0 4 files changed, 7 insertions(+), 5 deletions(-) rename nix/modules/{flake => }/home-manager.nix (62%) rename nix/modules/{nixos => }/users.nix (100%) diff --git a/nix/configurations.nix b/nix/configurations.nix index 9e20042..ddcdf3c 100644 --- a/nix/configurations.nix +++ b/nix/configurations.nix @@ -13,10 +13,13 @@ let mkConfigurations = class: hosts: mapAttrs ( - _: value: + name: value: if class == "nixos" then nixosSystem { - specialArgs = { inherit inputs; }; + specialArgs = { + inherit inputs; + hostName = name; + }; modules = [ (flattenAttrs cfg.modules.nixos) (value.extraCfg or { }) diff --git a/nix/manifest.nix b/nix/manifest.nix index 39e05fd..5c46f9f 100644 --- a/nix/manifest.nix +++ b/nix/manifest.nix @@ -1,4 +1,3 @@ - let testCfg = { hostName, ... }: diff --git a/nix/modules/flake/home-manager.nix b/nix/modules/home-manager.nix similarity index 62% rename from nix/modules/flake/home-manager.nix rename to nix/modules/home-manager.nix index 213e4ff..e81050f 100644 --- a/nix/modules/flake/home-manager.nix +++ b/nix/modules/home-manager.nix @@ -2,12 +2,12 @@ let hm = inputs.home-manager; globalCfg = { - imports = [ hm.nixosModules.home-manager ]; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; }; in { imports = [ hm.flakeModules.home-manager ]; - flake.modules.nixos.default = globalCfg; + flake.modules.nixos.default.imports = [ hm.nixosModules.home-manager ]; + flake.modules.nixos.default.config = globalCfg; } diff --git a/nix/modules/nixos/users.nix b/nix/modules/users.nix similarity index 100% rename from nix/modules/nixos/users.nix rename to nix/modules/users.nix