From 6d1fd47bea58a0bf0471e2307dfa4eadeb7a1195 Mon Sep 17 00:00:00 2001 From: lightly-toasted Date: Sun, 31 Aug 2025 22:16:33 +0900 Subject: [PATCH] feat: refactor home-manager configuration for multi-host support --- flake.nix | 32 ++++++++++++------- home/hosts/nixos.nix | 26 +++++++++++++++ home/{toast/home.nix => hosts/wsl.nix} | 7 ++-- .../gemini-cli.nix => modules/cli/gemini.nix} | 0 home/{toast/modules => modules/cli}/git.nix | 0 .../cli}/nixvim/default.nix | 0 .../cli}/nixvim/keymaps.nix | 0 .../cli}/nixvim/plugins/bufferline.nix | 0 .../cli}/nixvim/plugins/cmp.nix | 0 .../cli}/nixvim/plugins/colorizer.nix | 0 .../cli}/nixvim/plugins/comment.nix | 0 .../cli}/nixvim/plugins/gitsigns.nix | 0 .../cli}/nixvim/plugins/lsp.nix | 0 .../cli}/nixvim/plugins/lualine.nix | 0 .../cli}/nixvim/plugins/nvim-autopairs.nix | 0 .../cli}/nixvim/plugins/nvim-tree.nix | 0 .../cli}/nixvim/plugins/telescope.nix | 0 .../cli}/nixvim/plugins/treesitter.nix | 0 .../cli}/nixvim/plugins/wakatime.nix | 0 .../cli}/nixvim/plugins/web-devicons.nix | 0 .../cli}/nixvim/plugins/which-key.nix | 0 home/{toast/modules => modules/cli}/sops.nix | 0 home/{toast/modules => modules/cli}/xdg.nix | 0 home/{toast/modules => modules/cli}/yazi.nix | 0 home/{toast/modules => modules/cli}/zsh.nix | 0 .../modules => modules/graphical}/btop.nix | 0 .../modules => modules/graphical}/dunst.nix | 0 .../modules => modules/graphical}/firefox.nix | 0 .../modules => modules/graphical}/fonts.nix | 0 .../graphical}/hypridle.nix | 0 .../graphical}/hyprland.nix | 0 .../graphical}/keepassxc.nix | 0 .../modules => modules/graphical}/kitty.nix | 0 .../mouse-actions/actions/autoclick.nix | 0 .../mouse-actions/actions/deafen.nix | 0 .../mouse-actions/actions/default.nix | 0 .../mouse-actions/actions/sober-lag.nix | 0 .../graphical}/mouse-actions/cycle.nix | 0 .../graphical}/mouse-actions/default.nix | 0 .../graphical}/mouse-actions/run.nix | 0 .../modules => modules/graphical}/nixcord.nix | 0 .../graphical}/obsidian.nix | 0 .../graphical}/powermenu.nix | 0 .../graphical}/prismlauncher.nix | 0 .../modules => modules/graphical}/tofi.nix | 0 .../graphical}/waybar/default.nix | 0 .../graphical}/waybar/style.css | 0 47 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 home/hosts/nixos.nix rename home/{toast/home.nix => hosts/wsl.nix} (71%) rename home/{toast/modules/gemini-cli.nix => modules/cli/gemini.nix} (100%) rename home/{toast/modules => modules/cli}/git.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/default.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/keymaps.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/bufferline.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/cmp.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/colorizer.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/comment.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/gitsigns.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/lsp.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/lualine.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/nvim-autopairs.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/nvim-tree.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/telescope.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/treesitter.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/wakatime.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/web-devicons.nix (100%) rename home/{toast/modules => modules/cli}/nixvim/plugins/which-key.nix (100%) rename home/{toast/modules => modules/cli}/sops.nix (100%) rename home/{toast/modules => modules/cli}/xdg.nix (100%) rename home/{toast/modules => modules/cli}/yazi.nix (100%) rename home/{toast/modules => modules/cli}/zsh.nix (100%) rename home/{toast/modules => modules/graphical}/btop.nix (100%) rename home/{toast/modules => modules/graphical}/dunst.nix (100%) rename home/{toast/modules => modules/graphical}/firefox.nix (100%) rename home/{toast/modules => modules/graphical}/fonts.nix (100%) rename home/{toast/modules => modules/graphical}/hypridle.nix (100%) rename home/{toast/modules => modules/graphical}/hyprland.nix (100%) rename home/{toast/modules => modules/graphical}/keepassxc.nix (100%) rename home/{toast/modules => modules/graphical}/kitty.nix (100%) rename home/{toast/modules => modules/graphical}/mouse-actions/actions/autoclick.nix (100%) rename home/{toast/modules => modules/graphical}/mouse-actions/actions/deafen.nix (100%) rename home/{toast/modules => modules/graphical}/mouse-actions/actions/default.nix (100%) rename home/{toast/modules => modules/graphical}/mouse-actions/actions/sober-lag.nix (100%) rename home/{toast/modules => modules/graphical}/mouse-actions/cycle.nix (100%) rename home/{toast/modules => modules/graphical}/mouse-actions/default.nix (100%) rename home/{toast/modules => modules/graphical}/mouse-actions/run.nix (100%) rename home/{toast/modules => modules/graphical}/nixcord.nix (100%) rename home/{toast/modules => modules/graphical}/obsidian.nix (100%) rename home/{toast/modules => modules/graphical}/powermenu.nix (100%) rename home/{toast/modules => modules/graphical}/prismlauncher.nix (100%) rename home/{toast/modules => modules/graphical}/tofi.nix (100%) rename home/{toast/modules => modules/graphical}/waybar/default.nix (100%) rename home/{toast/modules => modules/graphical}/waybar/style.css (100%) diff --git a/flake.nix b/flake.nix index 9363141..741e9bb 100644 --- a/flake.nix +++ b/flake.nix @@ -29,18 +29,28 @@ rootPath = ./.; in { - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs rootPath; }; - modules = [ - ./hosts/nixos/configuration.nix - ]; + nixosConfigurations = { + nixos = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs rootPath; }; + modules = [ ./hosts/nixos/configuration.nix ]; + }; + wsl = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs rootPath; }; + modules = [ ./hosts/wsl/configuration.nix ]; + }; }; - homeConfigurations."toast@nixos" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = { inherit inputs rootPath; }; - modules = [ - ./home/toast/home.nix - ]; + + homeConfigurations = { + "toast@nixos" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { inherit inputs rootPath; }; + modules = [ ./home/hosts/nixos.nix ]; + }; + "toast@wsl" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { inherit inputs rootPath; }; + modules = [ ./home/hosts/wsl.nix ]; + }; }; packages.x86_64-linux.default = self.homeConfigurations."toast@nixos".activationPackage; diff --git a/home/hosts/nixos.nix b/home/hosts/nixos.nix new file mode 100644 index 0000000..25d3153 --- /dev/null +++ b/home/hosts/nixos.nix @@ -0,0 +1,26 @@ +{ config, pkgs, inputs, ... }: +{ + imports = [ + inputs.nixvim.homeManagerModules.nixvim + inputs.nixcord.homeModules.nixcord + inputs.nix-flatpak.homeManagerModules.nix-flatpak + inputs.sops-nix.homeManagerModules.sops + ] ++ ( + let + modulesPath = ../modules; + cliModules = builtins.attrNames (builtins.readDir ( modulesPath + "/cli" )); + graphicalModules = builtins.attrNames (builtins.readDir ( modulesPath + "/graphical" )); + in + map (module: modulesPath + "/cli/${module}") cliModules + ++ map (module: modulesPath + "/graphical/${module}") graphicalModules + ); + + home = { + username = "toast"; + homeDirectory = "/home/toast"; + stateVersion = "24.11"; + }; + + nixpkgs.config.allowUnfree = true; + systemd.user.startServices = "sd-switch"; +} diff --git a/home/toast/home.nix b/home/hosts/wsl.nix similarity index 71% rename from home/toast/home.nix rename to home/hosts/wsl.nix index 9fb4c5f..c3271da 100644 --- a/home/toast/home.nix +++ b/home/hosts/wsl.nix @@ -1,4 +1,5 @@ { config, pkgs, inputs, ... }: + { imports = [ inputs.nixvim.homeManagerModules.nixvim @@ -7,10 +8,10 @@ inputs.sops-nix.homeManagerModules.sops ] ++ ( let - modulesPath = ./modules; - moduleFiles = builtins.attrNames (builtins.readDir modulesPath); + modulesPath = ../modules; + cliModules = builtins.attrNames (builtins.readDir (modulesPath + "/cli/")); in - map (module: modulesPath + ("/" + module)) moduleFiles + map (module: modulesPath + "/cli/${module}") cliModules ); home = { diff --git a/home/toast/modules/gemini-cli.nix b/home/modules/cli/gemini.nix similarity index 100% rename from home/toast/modules/gemini-cli.nix rename to home/modules/cli/gemini.nix diff --git a/home/toast/modules/git.nix b/home/modules/cli/git.nix similarity index 100% rename from home/toast/modules/git.nix rename to home/modules/cli/git.nix diff --git a/home/toast/modules/nixvim/default.nix b/home/modules/cli/nixvim/default.nix similarity index 100% rename from home/toast/modules/nixvim/default.nix rename to home/modules/cli/nixvim/default.nix diff --git a/home/toast/modules/nixvim/keymaps.nix b/home/modules/cli/nixvim/keymaps.nix similarity index 100% rename from home/toast/modules/nixvim/keymaps.nix rename to home/modules/cli/nixvim/keymaps.nix diff --git a/home/toast/modules/nixvim/plugins/bufferline.nix b/home/modules/cli/nixvim/plugins/bufferline.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/bufferline.nix rename to home/modules/cli/nixvim/plugins/bufferline.nix diff --git a/home/toast/modules/nixvim/plugins/cmp.nix b/home/modules/cli/nixvim/plugins/cmp.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/cmp.nix rename to home/modules/cli/nixvim/plugins/cmp.nix diff --git a/home/toast/modules/nixvim/plugins/colorizer.nix b/home/modules/cli/nixvim/plugins/colorizer.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/colorizer.nix rename to home/modules/cli/nixvim/plugins/colorizer.nix diff --git a/home/toast/modules/nixvim/plugins/comment.nix b/home/modules/cli/nixvim/plugins/comment.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/comment.nix rename to home/modules/cli/nixvim/plugins/comment.nix diff --git a/home/toast/modules/nixvim/plugins/gitsigns.nix b/home/modules/cli/nixvim/plugins/gitsigns.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/gitsigns.nix rename to home/modules/cli/nixvim/plugins/gitsigns.nix diff --git a/home/toast/modules/nixvim/plugins/lsp.nix b/home/modules/cli/nixvim/plugins/lsp.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/lsp.nix rename to home/modules/cli/nixvim/plugins/lsp.nix diff --git a/home/toast/modules/nixvim/plugins/lualine.nix b/home/modules/cli/nixvim/plugins/lualine.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/lualine.nix rename to home/modules/cli/nixvim/plugins/lualine.nix diff --git a/home/toast/modules/nixvim/plugins/nvim-autopairs.nix b/home/modules/cli/nixvim/plugins/nvim-autopairs.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/nvim-autopairs.nix rename to home/modules/cli/nixvim/plugins/nvim-autopairs.nix diff --git a/home/toast/modules/nixvim/plugins/nvim-tree.nix b/home/modules/cli/nixvim/plugins/nvim-tree.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/nvim-tree.nix rename to home/modules/cli/nixvim/plugins/nvim-tree.nix diff --git a/home/toast/modules/nixvim/plugins/telescope.nix b/home/modules/cli/nixvim/plugins/telescope.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/telescope.nix rename to home/modules/cli/nixvim/plugins/telescope.nix diff --git a/home/toast/modules/nixvim/plugins/treesitter.nix b/home/modules/cli/nixvim/plugins/treesitter.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/treesitter.nix rename to home/modules/cli/nixvim/plugins/treesitter.nix diff --git a/home/toast/modules/nixvim/plugins/wakatime.nix b/home/modules/cli/nixvim/plugins/wakatime.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/wakatime.nix rename to home/modules/cli/nixvim/plugins/wakatime.nix diff --git a/home/toast/modules/nixvim/plugins/web-devicons.nix b/home/modules/cli/nixvim/plugins/web-devicons.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/web-devicons.nix rename to home/modules/cli/nixvim/plugins/web-devicons.nix diff --git a/home/toast/modules/nixvim/plugins/which-key.nix b/home/modules/cli/nixvim/plugins/which-key.nix similarity index 100% rename from home/toast/modules/nixvim/plugins/which-key.nix rename to home/modules/cli/nixvim/plugins/which-key.nix diff --git a/home/toast/modules/sops.nix b/home/modules/cli/sops.nix similarity index 100% rename from home/toast/modules/sops.nix rename to home/modules/cli/sops.nix diff --git a/home/toast/modules/xdg.nix b/home/modules/cli/xdg.nix similarity index 100% rename from home/toast/modules/xdg.nix rename to home/modules/cli/xdg.nix diff --git a/home/toast/modules/yazi.nix b/home/modules/cli/yazi.nix similarity index 100% rename from home/toast/modules/yazi.nix rename to home/modules/cli/yazi.nix diff --git a/home/toast/modules/zsh.nix b/home/modules/cli/zsh.nix similarity index 100% rename from home/toast/modules/zsh.nix rename to home/modules/cli/zsh.nix diff --git a/home/toast/modules/btop.nix b/home/modules/graphical/btop.nix similarity index 100% rename from home/toast/modules/btop.nix rename to home/modules/graphical/btop.nix diff --git a/home/toast/modules/dunst.nix b/home/modules/graphical/dunst.nix similarity index 100% rename from home/toast/modules/dunst.nix rename to home/modules/graphical/dunst.nix diff --git a/home/toast/modules/firefox.nix b/home/modules/graphical/firefox.nix similarity index 100% rename from home/toast/modules/firefox.nix rename to home/modules/graphical/firefox.nix diff --git a/home/toast/modules/fonts.nix b/home/modules/graphical/fonts.nix similarity index 100% rename from home/toast/modules/fonts.nix rename to home/modules/graphical/fonts.nix diff --git a/home/toast/modules/hypridle.nix b/home/modules/graphical/hypridle.nix similarity index 100% rename from home/toast/modules/hypridle.nix rename to home/modules/graphical/hypridle.nix diff --git a/home/toast/modules/hyprland.nix b/home/modules/graphical/hyprland.nix similarity index 100% rename from home/toast/modules/hyprland.nix rename to home/modules/graphical/hyprland.nix diff --git a/home/toast/modules/keepassxc.nix b/home/modules/graphical/keepassxc.nix similarity index 100% rename from home/toast/modules/keepassxc.nix rename to home/modules/graphical/keepassxc.nix diff --git a/home/toast/modules/kitty.nix b/home/modules/graphical/kitty.nix similarity index 100% rename from home/toast/modules/kitty.nix rename to home/modules/graphical/kitty.nix diff --git a/home/toast/modules/mouse-actions/actions/autoclick.nix b/home/modules/graphical/mouse-actions/actions/autoclick.nix similarity index 100% rename from home/toast/modules/mouse-actions/actions/autoclick.nix rename to home/modules/graphical/mouse-actions/actions/autoclick.nix diff --git a/home/toast/modules/mouse-actions/actions/deafen.nix b/home/modules/graphical/mouse-actions/actions/deafen.nix similarity index 100% rename from home/toast/modules/mouse-actions/actions/deafen.nix rename to home/modules/graphical/mouse-actions/actions/deafen.nix diff --git a/home/toast/modules/mouse-actions/actions/default.nix b/home/modules/graphical/mouse-actions/actions/default.nix similarity index 100% rename from home/toast/modules/mouse-actions/actions/default.nix rename to home/modules/graphical/mouse-actions/actions/default.nix diff --git a/home/toast/modules/mouse-actions/actions/sober-lag.nix b/home/modules/graphical/mouse-actions/actions/sober-lag.nix similarity index 100% rename from home/toast/modules/mouse-actions/actions/sober-lag.nix rename to home/modules/graphical/mouse-actions/actions/sober-lag.nix diff --git a/home/toast/modules/mouse-actions/cycle.nix b/home/modules/graphical/mouse-actions/cycle.nix similarity index 100% rename from home/toast/modules/mouse-actions/cycle.nix rename to home/modules/graphical/mouse-actions/cycle.nix diff --git a/home/toast/modules/mouse-actions/default.nix b/home/modules/graphical/mouse-actions/default.nix similarity index 100% rename from home/toast/modules/mouse-actions/default.nix rename to home/modules/graphical/mouse-actions/default.nix diff --git a/home/toast/modules/mouse-actions/run.nix b/home/modules/graphical/mouse-actions/run.nix similarity index 100% rename from home/toast/modules/mouse-actions/run.nix rename to home/modules/graphical/mouse-actions/run.nix diff --git a/home/toast/modules/nixcord.nix b/home/modules/graphical/nixcord.nix similarity index 100% rename from home/toast/modules/nixcord.nix rename to home/modules/graphical/nixcord.nix diff --git a/home/toast/modules/obsidian.nix b/home/modules/graphical/obsidian.nix similarity index 100% rename from home/toast/modules/obsidian.nix rename to home/modules/graphical/obsidian.nix diff --git a/home/toast/modules/powermenu.nix b/home/modules/graphical/powermenu.nix similarity index 100% rename from home/toast/modules/powermenu.nix rename to home/modules/graphical/powermenu.nix diff --git a/home/toast/modules/prismlauncher.nix b/home/modules/graphical/prismlauncher.nix similarity index 100% rename from home/toast/modules/prismlauncher.nix rename to home/modules/graphical/prismlauncher.nix diff --git a/home/toast/modules/tofi.nix b/home/modules/graphical/tofi.nix similarity index 100% rename from home/toast/modules/tofi.nix rename to home/modules/graphical/tofi.nix diff --git a/home/toast/modules/waybar/default.nix b/home/modules/graphical/waybar/default.nix similarity index 100% rename from home/toast/modules/waybar/default.nix rename to home/modules/graphical/waybar/default.nix diff --git a/home/toast/modules/waybar/style.css b/home/modules/graphical/waybar/style.css similarity index 100% rename from home/toast/modules/waybar/style.css rename to home/modules/graphical/waybar/style.css