summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-07-16 10:46:04 +0530
committersinanmohd <sinan@sinanmohd.com>2024-07-16 10:46:13 +0530
commit92248682cb855a6a5d898ec6fdd6fcfcf3c0758c (patch)
tree721ac5dfc783e0b24139634ad2390136b49b0735
parent1c38e54a12c3a2e7980eef0ec28a042deaaa3946 (diff)
flake/nixosConfigurations: integrate home manager modules
-rw-r--r--flake.nix35
1 files changed, 26 insertions, 9 deletions
diff --git a/flake.nix b/flake.nix
index 70153b4..9a411fc 100644
--- a/flake.nix
+++ b/flake.nix
@@ -18,36 +18,53 @@
outputs = { self, nixpkgs, sops-nix, home-manager }: let
lib = nixpkgs.lib;
+ makeGlobalImports = host: [
+ ./global/common
+ ] ++ lib.optional (builtins.pathExists ./global/${host})
+ ./global/${host};
+
makeNixos = host: system: lib.nixosSystem {
inherit system;
modules = [
+ sops-nix.nixosModules.sops
+
+ ./os/${host}/configuration.nix
{
networking.hostName = host;
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
}
- ./global/common
- ./os/${host}/configuration.nix
- sops-nix.nixosModules.sops
- ] ++ lib.optional (builtins.pathExists ./global/${host})
- ./global/${host};
+ home-manager.nixosModules.home-manager
+ ({ config, ... }: let
+ username = config.global.userdata.name;
+ in {
+ home-manager = {
+ useGlobalPkgs = true;
+ useUserPackages = true;
+ users.${username} = { ... }: {
+ imports = [
+ ./home/${host}/home.nix
+ ] ++ (makeGlobalImports host);
+ };
+ };
+ })
+ ] ++ (makeGlobalImports host);
};
makeHome = host: system: home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
- ./global/common
./home/${host}/home.nix
- ] ++ lib.optional (builtins.pathExists ./global/${host})
- ./global/${host};
+ ] ++ (makeGlobalImports host);
};
in
{
nixosConfigurations =
lib.genAttrs [ "cez" "kay" "lia" "fscusat" "dspace" ]
(host: makeNixos host "x86_64-linux");
+
homeConfigurations =
- lib.genAttrs [ "common" "wayland" "cez" ]
+ lib.genAttrs [ "common" "wayland" "pc" "cez" ]
(host: makeHome host "x86_64-linux");
};
}