From 4baf606551a1926aa7f392381def3cd99d9546e1 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 6 Jul 2025 05:40:06 +0800 Subject: [PATCH] feat(nixos): add common nixos profile; move hostspec config --- modules/configurations/nixos.nix | 5 ++++- modules/hostSpec.nix | 18 +++++------------- modules/profiles/nixos/common.nix | 9 +++++++++ 3 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 modules/profiles/nixos/common.nix diff --git a/modules/configurations/nixos.nix b/modules/configurations/nixos.nix index 226998c..b78bb98 100644 --- a/modules/configurations/nixos.nix +++ b/modules/configurations/nixos.nix @@ -20,7 +20,10 @@ let value = lib.nixosSystem { specialArgs = { inherit inputs hostName; }; #TODO: add profiles system - modules = [ value.extraCfg or { } ]; + modules = [ + config.flake.profiles.nixos.common + (value.extraCfg or { }) + ] ++ (value.profiles or [ ]); }; }; in diff --git a/modules/hostSpec.nix b/modules/hostSpec.nix index d86ae82..94cdab8 100644 --- a/modules/hostSpec.nix +++ b/modules/hostSpec.nix @@ -1,17 +1,9 @@ -{ config, ... }: { - flake.hostSpec.hosts = { - "nixos/test".extraCfg = { - imports = with config.flake.modules.nixos; [ networking ]; - config = { - boot.loader.systemd-boot.enable = true; - fileSystems."/" = { - device = "/dev/sda1"; - fsType = "ext4"; - }; - nixpkgs.hostPlatform = "x86_64-linux"; - system.stateVersion = "25.05"; - }; + flake.hostSpec.hosts."nixos/test".extraCfg = { + fileSystems."/" = { + device = "/dev/sda1"; + fsType = "ext4"; }; + nixpkgs.hostPlatform = "x86_64-linux"; }; } diff --git a/modules/profiles/nixos/common.nix b/modules/profiles/nixos/common.nix new file mode 100644 index 0000000..2138f02 --- /dev/null +++ b/modules/profiles/nixos/common.nix @@ -0,0 +1,9 @@ +{ + flake.profiles.nixos.common = + { hostName, ... }: + { + boot.loader.systemd-boot.enable = true; + system.stateVersion = "25.05"; + networking = { inherit hostName; }; + }; +}