diff --git a/Droidnix/flake.nix b/Droidnix/flake.nix index c3ea22bc4..726e07678 100644 --- a/Droidnix/flake.nix +++ b/Droidnix/flake.nix @@ -47,4 +47,68 @@ machine: lib.nixosSystem { inherit system; - modules = + modules = [ + # Import machine-specific configurations + ./assets/flake/machines/${machine}/top.nix + + # Home Manager module + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = { + inherit user inputs; + flakeRoot = ./.; + }; + } + + # Catppuccin theme module + inputs.catppuccin.nixosModules.catppuccin + + # Anchoring all the other nixes + ./generated/top.nix + + # Enable Home Manager for the user + ( + { config, pkgs, ... }: + { + home-manager.users.${user.username} = { + enable = true; + homeDirectory = "/home/${user.username}"; + }; + } + ) + ]; + specialArgs = { + inherit user inputs; + flakeRoot = ./.; + }; + } + ); + + # Home Manager configurations for each user/machine + homeConfigurations = lib.genAttrs (map (machine: user.username + "@" + machine) machines) ( + userMachine: + let + parts = lib.splitString "@" userMachine; + username = builtins.elemAt parts 0; + machine = builtins.elemAt parts 1; + in + home-manager.lib.homeManagerConfiguration { + inherit system; + configuration = import ./assets/flake/users/${username}/home.nix { + inherit inputs user; + pkgs = import nixpkgs { inherit system; }; + }; + extraSpecialArgs = { + inherit user inputs; + flakeRoot = ./.; + }; + } + ); + + devShells.${system}.default = import ./assets/flake/terminal_shell/devshell.nix { + inherit (nixpkgs.legacyPackages.${system}) mkShell; + }; + }; +}