From e25f7420ff4a1680be5db9b139d499034cc33451 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Sun, 8 Mar 2026 12:31:03 -0500 Subject: [PATCH] working home manager switch without --impure --- modules/home-manager/bash.nix | 2 +- modules/home-manager/eza.nix | 14 ++++++ modules/home-manager/files.nix | 1 + modules/home-manager/profiles/desktop.nix | 18 +------ modules/home-manager/profiles/shell-tools.nix | 23 +++++++++ modules/home-manager/shell.nix | 47 +++++-------------- modules/home-manager/users/john.nix | 35 +++++++++++++- modules/users/john-sys.nix | 22 +++++++++ modules/users/john.nix | 39 --------------- 9 files changed, 109 insertions(+), 92 deletions(-) create mode 100644 modules/home-manager/eza.nix create mode 100644 modules/home-manager/profiles/shell-tools.nix create mode 100644 modules/users/john-sys.nix delete mode 100644 modules/users/john.nix diff --git a/modules/home-manager/bash.nix b/modules/home-manager/bash.nix index b4a1f03..1b3a6bb 100644 --- a/modules/home-manager/bash.nix +++ b/modules/home-manager/bash.nix @@ -1,5 +1,5 @@ { - flake.homeModules.bash = { pkgs, lib, ... }: + flake.homeModules.bash = { pkgs, ... }: { programs.bash = { enable = true; diff --git a/modules/home-manager/eza.nix b/modules/home-manager/eza.nix new file mode 100644 index 0000000..89df6bf --- /dev/null +++ b/modules/home-manager/eza.nix @@ -0,0 +1,14 @@ +{ inputs, pkgs, lib, ... }: +{ + flake.homeModules.eza = { pkgs, lib, ... }: { + programs.eza = { + enable = true; + package = pkgs.eza; + enableBashIntegration = true; + enableZshIntegration = true; + }; + home.shellAliases = { + ls = "${lib.getExe pkgs.eza} -lgos type --no-time --follow-symlinks"; + }; + }; +} \ No newline at end of file diff --git a/modules/home-manager/files.nix b/modules/home-manager/files.nix index f544d6d..ca344bc 100644 --- a/modules/home-manager/files.nix +++ b/modules/home-manager/files.nix @@ -8,6 +8,7 @@ home.packages = with pkgs; [ gdu + # TODO: find a CLI file editor that's not insane ]; }; } \ No newline at end of file diff --git a/modules/home-manager/profiles/desktop.nix b/modules/home-manager/profiles/desktop.nix index 6865ec7..8c0766a 100644 --- a/modules/home-manager/profiles/desktop.nix +++ b/modules/home-manager/profiles/desktop.nix @@ -1,25 +1,11 @@ +# This module is for programs with GUIs that run in a desktop environment { inputs, ... }: { flake.homeModules.desktop = - { pkgs, ... } : { - xdg.enable = true; - imports = with inputs.self.homeModules; [ - rebuild - john - ssh - git - shell + onepassword ghostty - sops ]; }; - - flake.homeConfigurations.desktop = inputs.home-manager.lib.homeManagerConfiguration { - pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; - modules = with inputs.self.homeModules; [ - desktop - ]; - }; } diff --git a/modules/home-manager/profiles/shell-tools.nix b/modules/home-manager/profiles/shell-tools.nix new file mode 100644 index 0000000..1263008 --- /dev/null +++ b/modules/home-manager/profiles/shell-tools.nix @@ -0,0 +1,23 @@ +{ inputs, ... }: +{ + flake.homeModules.shell-tools = { pkgs, ... }: { + imports = with inputs.self.homeModules; [ + shell # Includes option to select between zsh and bash + + # Tools + eza + files + ]; + home.packages = with pkgs; [ + wget + curl + cacert + busybox + gnugrep + dig + btop + uv + xclip + ]; + }; +} diff --git a/modules/home-manager/shell.nix b/modules/home-manager/shell.nix index 052a0ed..be1e7f0 100644 --- a/modules/home-manager/shell.nix +++ b/modules/home-manager/shell.nix @@ -1,42 +1,19 @@ -{ inputs, ... }: +{ inputs, lib, ... }: { - flake.homeModules.shell = {pkgs, lib, ...}: + flake.homeModules.shell = { config, ... }: { - imports = with inputs.self.homeModules; [ - # Shells - # bash - zsh - - # Tools - shell-tools - files - docker - ]; - - programs.eza = { - enable = true; - package = pkgs.eza; - enableBashIntegration = true; - enableZshIntegration = true; + options.shell.program = lib.mkOption { + type = lib.types.enum [ "bash" "zsh" ]; + default = "zsh"; + description = "Which interactive shell configuration to enable."; }; - home.shell.enableShellIntegration = true; - home.shellAliases = { - ls = "${lib.getExe pkgs.eza} -lgos type --no-time --follow-symlinks"; - }; - }; + imports = with inputs.self.homeModules; [ bash zsh ]; - flake.homeModules.shell-tools = {pkgs, ...}: { - home.packages = with pkgs; [ - wget - curl - cacert - busybox - gnugrep - dig - btop - uv - xclip - ]; + config = { + programs.bash.enable = lib.mkForce (config.shell.program == "bash"); + programs.zsh.enable = lib.mkForce (config.shell.program == "zsh"); + home.shell.enableShellIntegration = true; + }; }; } diff --git a/modules/home-manager/users/john.nix b/modules/home-manager/users/john.nix index 0447a60..3f34ace 100644 --- a/modules/home-manager/users/john.nix +++ b/modules/home-manager/users/john.nix @@ -1,10 +1,43 @@ +{ inputs, ... }: { - flake.homeModules.users.john = { + flake.homeModules.john = { home.username = "john"; home.homeDirectory = "/home/john"; home.stateVersion = "25.11"; + xdg.enable = true; programs.git.settings.user.name = "John Lancaster"; programs.git.settings.user.email = "32917998+jsl12@users.noreply.github.com"; + + imports = with inputs.self.homeModules; [ + rebuild + sops + git + ssh + shell-tools + home # placeholder + docker + sublime + desktop + # resticprofile + ]; }; + + flake.homeConfigurations.john = inputs.home-manager.lib.homeManagerConfiguration { + pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; + modules = [ + inputs.self.homeModules.john + + # Include another inline module to set the options created through the jsl-home modules + { + homeManagerFlakeDir = "~/.config/home-manager"; + docker.enable = true; + ssh.matchSets = { + certs = true; + appdaemon = true; + homelab = true; + }; + } + ]; + }; } diff --git a/modules/users/john-sys.nix b/modules/users/john-sys.nix new file mode 100644 index 0000000..d2be4bc --- /dev/null +++ b/modules/users/john-sys.nix @@ -0,0 +1,22 @@ +{ inputs, ... }: +let + userName = "john"; +in +{ + flake.modules.nixos.user = + { pkgs, ... }: + { + users.users."${userName}" = { + name = "${userName}"; + shell = pkgs.zsh; + }; + programs.zsh.enable = true; + + home-manager.users."${userName}" = { + imports = [ + inputs.self.homeModules."${userName}" + ]; + }; + }; + +} diff --git a/modules/users/john.nix b/modules/users/john.nix deleted file mode 100644 index 0c24d1d..0000000 --- a/modules/users/john.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ inputs, ... }: -let - userName = "john"; -in -{ - flake.modules.nixos.user = - { pkgs, ... }: - { - users.users."${userName}" = { - name = "${userName}"; - shell = pkgs.zsh; - }; - programs.zsh.enable = true; - - home-manager.users."${userName}" = { - imports = [ - inputs.self.homeModules."${userName}" - ]; - }; - }; - - flake.homeConfigurations.${userName} = inputs.home-manager.lib.homeManagerConfiguration { - pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; - modules = [ - inputs.self.homeModules.users."${userName}" - - # Include another inline module to set the options created through the jsl-home modules - { - homeManagerFlakeDir = "~/.config/home-manager"; - docker.enable = true; - ssh.matchSets = { - certs = true; - appdaemon = true; - homelab = true; - }; - } - ]; - }; -}