From 05183b75b4d269d9ff69de7dccd2abfe42a469d3 Mon Sep 17 00:00:00 2001 From: Joshua Yuen Date: Tue, 20 Jan 2026 15:32:08 -0500 Subject: [PATCH] Add home-manager configuration --- flake.nix | 19 +++++++------- homes/josh/home.nix | 25 +++++++++++++++++++ hosts/vm/default.nix | 1 + modules/core/stylix.nix | 2 -- modules/core/user.nix | 9 +------ modules/{home => homes}/default.nix | 1 - modules/{home => homes}/direnv.nix | 0 modules/{home => homes}/fzf.nix | 0 modules/{home => homes}/hyprland/binds.nix | 4 +-- modules/{home => homes}/hyprland/default.nix | 0 modules/{home => homes}/hyprland/hyprland.nix | 4 +-- modules/{home => homes}/kitty.nix | 6 ++--- modules/{home => homes}/overlays.nix | 0 modules/{home => homes}/stylix.nix | 0 modules/{home => homes}/vscodium.nix | 0 modules/{home => homes}/xdg.nix | 12 +++++---- modules/{home => homes}/zsh/completion.nix | 3 +-- modules/{home => homes}/zsh/completion.zsh | 0 modules/{home => homes}/zsh/default.nix | 3 +-- modules/{home => homes}/zsh/p10k.nix | 3 +-- modules/{home => homes}/zsh/p10k.zsh | 0 profiles/desktop/default.nix | 10 ++++++++ profiles/vm/default.nix | 1 - rebuild.sh | 2 +- 24 files changed, 65 insertions(+), 40 deletions(-) create mode 100644 homes/josh/home.nix rename modules/{home => homes}/default.nix (94%) rename modules/{home => homes}/direnv.nix (100%) rename modules/{home => homes}/fzf.nix (100%) rename modules/{home => homes}/hyprland/binds.nix (96%) rename modules/{home => homes}/hyprland/default.nix (100%) rename modules/{home => homes}/hyprland/hyprland.nix (96%) rename modules/{home => homes}/kitty.nix (86%) rename modules/{home => homes}/overlays.nix (100%) rename modules/{home => homes}/stylix.nix (100%) rename modules/{home => homes}/vscodium.nix (100%) rename modules/{home => homes}/xdg.nix (80%) rename modules/{home => homes}/zsh/completion.nix (83%) rename modules/{home => homes}/zsh/completion.zsh (100%) rename modules/{home => homes}/zsh/default.nix (98%) rename modules/{home => homes}/zsh/p10k.nix (82%) rename modules/{home => homes}/zsh/p10k.zsh (100%) create mode 100644 profiles/desktop/default.nix diff --git a/flake.nix b/flake.nix index 5ebb0ed..d31f704 100644 --- a/flake.nix +++ b/flake.nix @@ -27,12 +27,13 @@ nixpkgs, home-manager, install-system, + stylix, ... }@inputs: let system = "x86_64-linux"; host = "vm"; - profile = "vm"; + profile = "desktop"; username = "josh"; in { @@ -64,19 +65,19 @@ ./hosts/${host} ]; }; + }; - nixosvm = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { + homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration { + extraSpecialArgs = { inherit inputs; - inherit host; inherit profile; inherit username; }; - modules = [ - ./hosts/${host} - ]; - }; + pkgs = nixpkgs.legacyPackages.${system}; + modules = [ + ./homes/${username}/home.nix + stylix.homeModules.stylix + ]; }; devShell.${system} = nixpkgs.legacyPackages.${system}.pkgs.mkShell { diff --git a/homes/josh/home.nix b/homes/josh/home.nix new file mode 100644 index 0000000..e5c3c3d --- /dev/null +++ b/homes/josh/home.nix @@ -0,0 +1,25 @@ +{ + profile, + ... +}: +{ + imports = [ + ../../modules/homes + ../../modules/options + ../../profiles/${profile} + ]; + + modules.zsh.enable = true; + modules.shell.defaultShell = "zsh"; + + home = { + username = "josh"; + homeDirectory = "/home/josh"; + stateVersion = "25.11"; + }; + + # Let Home Manager install and manage itself + programs.home-manager.enable = true; + + nix.settings.allowed-users = [ "josh" ]; +} \ No newline at end of file diff --git a/hosts/vm/default.nix b/hosts/vm/default.nix index 4c1d5fe..fb6b2ea 100644 --- a/hosts/vm/default.nix +++ b/hosts/vm/default.nix @@ -5,6 +5,7 @@ { imports = [ ../../profiles/${profile} + ../../profiles/vm ../../modules/core ../../modules/options diff --git a/modules/core/stylix.nix b/modules/core/stylix.nix index ad48dde..9ec018f 100644 --- a/modules/core/stylix.nix +++ b/modules/core/stylix.nix @@ -1,10 +1,8 @@ { inputs, - lib, pkgs, ... }: -with lib; { imports = [ inputs.stylix.nixosModules.stylix ]; diff --git a/modules/core/user.nix b/modules/core/user.nix index 00098b5..ebd2438 100644 --- a/modules/core/user.nix +++ b/modules/core/user.nix @@ -26,12 +26,7 @@ in ; }; users.${username} = { - imports = [ ./../home ]; - home = { - username = "${username}"; - homeDirectory = "/home/${username}"; - stateVersion = "25.05"; - }; + imports = [ ../../homes/${username}/home.nix ]; }; }; @@ -57,6 +52,4 @@ in environment.pathsToLink = [ ] ++ (if zshCfg.enable then [ "/share/zsh" ] else [ ]); - - nix.settings.allowed-users = [ "${username}" ]; } diff --git a/modules/home/default.nix b/modules/homes/default.nix similarity index 94% rename from modules/home/default.nix rename to modules/homes/default.nix index 8466e92..7e847a2 100644 --- a/modules/home/default.nix +++ b/modules/homes/default.nix @@ -1,5 +1,4 @@ { - inputs, ... }: { diff --git a/modules/home/direnv.nix b/modules/homes/direnv.nix similarity index 100% rename from modules/home/direnv.nix rename to modules/homes/direnv.nix diff --git a/modules/home/fzf.nix b/modules/homes/fzf.nix similarity index 100% rename from modules/home/fzf.nix rename to modules/homes/fzf.nix diff --git a/modules/home/hyprland/binds.nix b/modules/homes/hyprland/binds.nix similarity index 96% rename from modules/home/hyprland/binds.nix rename to modules/homes/hyprland/binds.nix index 5627f43..a33b6fd 100644 --- a/modules/home/hyprland/binds.nix +++ b/modules/homes/hyprland/binds.nix @@ -1,9 +1,9 @@ { - osConfig, + config, ... }: let - cfg = osConfig.modules.hyprland; + cfg = config.modules.hyprland; in { wayland.windowManager.hyprland.settings = { diff --git a/modules/home/hyprland/default.nix b/modules/homes/hyprland/default.nix similarity index 100% rename from modules/home/hyprland/default.nix rename to modules/homes/hyprland/default.nix diff --git a/modules/home/hyprland/hyprland.nix b/modules/homes/hyprland/hyprland.nix similarity index 96% rename from modules/home/hyprland/hyprland.nix rename to modules/homes/hyprland/hyprland.nix index e4b3f5a..6ffbed0 100644 --- a/modules/home/hyprland/hyprland.nix +++ b/modules/homes/hyprland/hyprland.nix @@ -1,12 +1,12 @@ { + config, lib, - osConfig, pkgs, ... }: with lib; let - cfg = osConfig.modules.hyprland; + cfg = config.modules.hyprland; in { wayland.windowManager.hyprland = { diff --git a/modules/home/kitty.nix b/modules/homes/kitty.nix similarity index 86% rename from modules/home/kitty.nix rename to modules/homes/kitty.nix index 6b26923..1bb5ad4 100644 --- a/modules/home/kitty.nix +++ b/modules/homes/kitty.nix @@ -1,13 +1,13 @@ { + config, lib, - osConfig, pkgs, ... }: with lib; let - hyprlandCfg = osConfig.modules.hyprland; - zshCfg = osConfig.modules.zsh; + hyprlandCfg = config.modules.hyprland; + zshCfg = config.modules.zsh; in { config = mkIf (hyprlandCfg.terminal == "kitty") { diff --git a/modules/home/overlays.nix b/modules/homes/overlays.nix similarity index 100% rename from modules/home/overlays.nix rename to modules/homes/overlays.nix diff --git a/modules/home/stylix.nix b/modules/homes/stylix.nix similarity index 100% rename from modules/home/stylix.nix rename to modules/homes/stylix.nix diff --git a/modules/home/vscodium.nix b/modules/homes/vscodium.nix similarity index 100% rename from modules/home/vscodium.nix rename to modules/homes/vscodium.nix diff --git a/modules/home/xdg.nix b/modules/homes/xdg.nix similarity index 80% rename from modules/home/xdg.nix rename to modules/homes/xdg.nix index d2dbdc1..5b0812f 100644 --- a/modules/home/xdg.nix +++ b/modules/homes/xdg.nix @@ -1,19 +1,21 @@ { - osConfig, + config, + lib, pkgs, ... }: +with lib; let - hyprlandCfg = osConfig.modules.hyprland; - pipewireCfg = osConfig.modules.pipewire; - plasmaCfg = osConfig.modules.plasma; + hyprlandCfg = config.modules.hyprland; + pipewireCfg = config.modules.pipewire; + plasmaCfg = config.modules.plasma; in { xdg = { enable = true; mime.enable = true; mimeApps.enable = true; - portal = { + portal = mkIf (hyprlandCfg.enable or plasmaCfg.enable) { enable = true; extraPortals = [ ] diff --git a/modules/home/zsh/completion.nix b/modules/homes/zsh/completion.nix similarity index 83% rename from modules/home/zsh/completion.nix rename to modules/homes/zsh/completion.nix index f4fbb02..c1864a0 100644 --- a/modules/home/zsh/completion.nix +++ b/modules/homes/zsh/completion.nix @@ -1,12 +1,11 @@ { config, lib, - osConfig, ... }: with lib; let - cfg = osConfig.modules.zsh; + cfg = config.modules.zsh; xdgCfg = config.xdg; in { diff --git a/modules/home/zsh/completion.zsh b/modules/homes/zsh/completion.zsh similarity index 100% rename from modules/home/zsh/completion.zsh rename to modules/homes/zsh/completion.zsh diff --git a/modules/home/zsh/default.nix b/modules/homes/zsh/default.nix similarity index 98% rename from modules/home/zsh/default.nix rename to modules/homes/zsh/default.nix index 86943e8..8e21986 100644 --- a/modules/home/zsh/default.nix +++ b/modules/homes/zsh/default.nix @@ -1,13 +1,12 @@ { config, lib, - osConfig, pkgs, ... }: with lib; let - cfg = osConfig.modules.zsh; + cfg = config.modules.zsh; xdgCfg = config.xdg; in { diff --git a/modules/home/zsh/p10k.nix b/modules/homes/zsh/p10k.nix similarity index 82% rename from modules/home/zsh/p10k.nix rename to modules/homes/zsh/p10k.nix index e06c453..86a7458 100644 --- a/modules/home/zsh/p10k.nix +++ b/modules/homes/zsh/p10k.nix @@ -1,12 +1,11 @@ { config, lib, - osConfig, ... }: with lib; let - cfg = osConfig.modules.zsh; + cfg = config.modules.zsh; xdgCfg = config.xdg; in { diff --git a/modules/home/zsh/p10k.zsh b/modules/homes/zsh/p10k.zsh similarity index 100% rename from modules/home/zsh/p10k.zsh rename to modules/homes/zsh/p10k.zsh diff --git a/profiles/desktop/default.nix b/profiles/desktop/default.nix new file mode 100644 index 0000000..816ea91 --- /dev/null +++ b/profiles/desktop/default.nix @@ -0,0 +1,10 @@ +{ + ... +}: +{ + imports = [ ../../modules/options ]; + + modules.hyprland = { + enable = true; + }; +} \ No newline at end of file diff --git a/profiles/vm/default.nix b/profiles/vm/default.nix index cb7583f..ed322f7 100644 --- a/profiles/vm/default.nix +++ b/profiles/vm/default.nix @@ -1,5 +1,4 @@ { - vm, ... }: { diff --git a/rebuild.sh b/rebuild.sh index eafe880..6d0997a 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -4,7 +4,7 @@ echo "Removing old qcow2 disk ..." rm -f ./vm.qcow2 echo "Building new VM ..." -nix build .#nixosConfigurations.nixosvm.config.system.build.vm +nix build .#nixosConfigurations.nixos.config.system.build.vm if [ $? -ne 0 ]; then echo "Failed to build VM"