From cf90d3e876b6752ceaf4806d0de864a2d40cac1b Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Mon, 20 Apr 2026 23:52:03 -0500 Subject: [PATCH] various reorgs --- modules/features/shell-tools.nix | 29 +++++++----------- modules/hosts/john-pc/default.nix | 12 ++++---- modules/hosts/soteria/soteria.nix | 47 ++++++++++++++--------------- modules/nix-tools/rebuild.nix | 3 +- modules/nix-tools/user.nix | 3 ++ modules/programs/bash.nix | 3 +- modules/programs/zsh.nix | 3 +- modules/services/ssh.nix | 4 +++ modules/users/john.nix | 49 ++++++++++++++++--------------- 9 files changed, 74 insertions(+), 79 deletions(-) diff --git a/modules/features/shell-tools.nix b/modules/features/shell-tools.nix index 339948d..13b73c9 100644 --- a/modules/features/shell-tools.nix +++ b/modules/features/shell-tools.nix @@ -1,29 +1,20 @@ # This module provides all the shell options -{ inputs, lib, ... }: -{ +{ self, inputs, ... }: { flake.modules.homeManager.shell-tools = { config, pkgs, ... }: { - options.shell.program = lib.mkOption { - type = lib.types.enum [ "bash" "zsh" ]; - default = "zsh"; - description = "Which interactive shell configuration to enable."; - }; - imports = with inputs.self.modules.homeManager; [ - bash + # bash zsh files ]; - config = { - home.shell.enableShellIntegration = true; - programs.zsh.enable = lib.mkForce (config.shell.program == "zsh"); - home.packages = with pkgs; [ - btop - uv - xclip - inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.shell-tools - ]; - }; + home.packages = with pkgs; [ + btop + uv + xclip + inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.shell-tools + ]; + + home.shell.enableShellIntegration = true; }; perSystem = { system, pkgs, self', ... }: { diff --git a/modules/hosts/john-pc/default.nix b/modules/hosts/john-pc/default.nix index f9c719f..bf158f4 100644 --- a/modules/hosts/john-pc/default.nix +++ b/modules/hosts/john-pc/default.nix @@ -44,15 +44,13 @@ in # selfPkgs.step-bootstrap # selfPkgs.wg-platform # self'.packages.myWrappedPackage - # (inputs.self.wrappers.test-push.apply { - # inherit pkgs flakeDir; - # host = testHost; - # target = testTarget; - # }).wrapper + (inputs.self.wrappers.test-push.apply { + inherit pkgs flakeDir; + host = testHost; + target = testTarget; + }).wrapper ]; - shell.program = "zsh"; - homeManagerFlakeDir = flakeDir; docker.enable = true; diff --git a/modules/hosts/soteria/soteria.nix b/modules/hosts/soteria/soteria.nix index cb587b3..1314df0 100644 --- a/modules/hosts/soteria/soteria.nix +++ b/modules/hosts/soteria/soteria.nix @@ -1,4 +1,4 @@ -{ self, inputs, lib, ... }: +{ withSystem, self, inputs, lib, ... }: let username = "john"; hostname = "soteria"; @@ -84,14 +84,10 @@ in sops.defaultSopsFile = ./secrets.yaml; programs.zsh.enable = true; - home-manager.users."${username}" = { - imports = with inputs.self.modules; [ - homeManager."${hostname}" - ]; - }; + + home-manager.users."${username}".imports = [ inputs.self.modules.homeManager.soteria ]; environment.systemPackages = [ - inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.janus-ca inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-neovim inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh ]; @@ -99,25 +95,26 @@ in ]; }; - flake.modules.homeManager."${hostname}" = { config, pkgs, lib, ... }: { - imports = with inputs.self.modules; [ - homeManager.rebuild - homeManager.mysops - ]; + flake.modules.homeManager.soteria = { config, pkgs, lib, ... }: { + imports = [ + inputs.self.modules.homeManager.rebuild + inputs.self.modules.homeManager.mysops + ({ config, pkgs, lib, ... }: { + homeManagerFlakeDir = "${config.xdg.configHome}/home-manager"; + docker.enable = true; - homeManagerFlakeDir = "${config.xdg.configHome}/home-manager"; - shell.program = "zsh"; - docker.enable = true; - - # This will provide the edit-secrets script targeting this file - mysops.hostSecretFile = "${config.homeManagerFlakeDir}/modules/hosts/soteria/secrets.yaml"; - }; - - flake.homeConfigurations."${hostname}" = inputs.home-manager.lib.homeManagerConfiguration { - pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; - modules = with inputs.self.modules; [ - homeManager."${username}" - homeManager."${hostname}" + # This will provide the edit-secrets script targeting this file + mysops.hostSecretFile = "${config.homeManagerFlakeDir}/modules/hosts/soteria/secrets.yaml"; + }) ]; }; + + flake.homeConfigurations.soteria = withSystem "x86_64-linux" (ctx@{ config, inputs', ...}: + inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs'.nixpkgs.legacyPackages; + modules = [ + inputs.self.modules.homeManager."${username}" + inputs.self.modules.homeManager.soteria + ]; + }); } \ No newline at end of file diff --git a/modules/nix-tools/rebuild.nix b/modules/nix-tools/rebuild.nix index 641fc2e..140f6eb 100644 --- a/modules/nix-tools/rebuild.nix +++ b/modules/nix-tools/rebuild.nix @@ -140,8 +140,9 @@ args = [ "home" "switch" "--configuration" "${config.configuration}" + "$@" "${config.flakeDir}" - ] ++ config.extraOptions ++ [ "$@" ]; + ] ++ config.extraOptions; }; }); } diff --git a/modules/nix-tools/user.nix b/modules/nix-tools/user.nix index 495fee4..f48a45e 100644 --- a/modules/nix-tools/user.nix +++ b/modules/nix-tools/user.nix @@ -14,8 +14,11 @@ inputs.home-manager.nixosModules.home-manager ]; + users.groups."${username}" = {}; + users.users."${username}" = { isNormalUser = true; + group = username; home = "/home/${username}"; shell = lib.mkIf config.programs.zsh.enable pkgs.zsh; extraGroups = [ "input" "networkmanager" ] diff --git a/modules/programs/bash.nix b/modules/programs/bash.nix index 8fef51b..08dc0ba 100644 --- a/modules/programs/bash.nix +++ b/modules/programs/bash.nix @@ -1,10 +1,9 @@ { flake.modules.homeManager.bash = { pkgs, lib, config, ... }: { - programs.bash = lib.mkIf (config.shell.program == "bash") { + programs.bash = { enable = true; enableCompletion = true; - package = pkgs.bash; }; }; } \ No newline at end of file diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 79e5f1f..2ba7c40 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -35,7 +35,7 @@ in homeManager.zsh = { pkgs, config, ... }: { programs.zsh = { enable = true; - package = pkgs.zsh; + package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh; enableCompletion = true; autosuggestion.enable = true; # syntaxHighlighting.enable = true; @@ -157,6 +157,7 @@ in format = "[$ssh_symbol$hostname]($style)"; style = "bg:red fg:crust"; }; + os.symbols.NixOS = " "; format = lib.replaceStrings ["\n"] [""] '' [](red) $os diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix index 70174af..db2e191 100644 --- a/modules/services/ssh.nix +++ b/modules/services/ssh.nix @@ -197,6 +197,10 @@ in "test-nix" = { hostname = "fded:fb16:653e:25da:be24:11ff:fea0:753f"; user = "john"; + extraOptions = { + RequestTTY = "force"; + RemoteCommand = "/run/current-system/sw/bin/jsl-zsh"; + }; }; }) ]; diff --git a/modules/users/john.nix b/modules/users/john.nix index fa5fabf..ba23aec 100644 --- a/modules/users/john.nix +++ b/modules/users/john.nix @@ -1,6 +1,10 @@ { self, inputs, lib, ... }: let username = "john"; + baseUserModules = self.factory.user { + username = username; + isAdmin = true; + }; in { flake.meta.users."${username}" = { @@ -8,41 +12,38 @@ in name = "John Lancaster"; inherit username; key = ""; - keygrip = [ - ]; + keygrip = [ ]; authorizedKeys = [ # "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIAUa4dcg1TWc4pW++uodyhX4eOqrX/QYIxFWtEP7HFJ john@john-pc-ubuntu" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMOkGLo4N/L3RYvaIZ1FmePlxa1HK0fMciZxKtRhN58F root@janus" ]; }; - flake.modules = lib.mkMerge [ - (self.factory.user { - username = username; - isAdmin = true; - }) - { - nixos."${username}" = { - imports = [ - inputs.home-manager.nixosModules.home-manager - ]; - users.users."${username}" = { - openssh.authorizedKeys.keys = inputs.self.meta.users."${username}".authorizedKeys; - }; + flake.modules = { + nixos."${username}" = { ... }: { + imports = [ + baseUserModules.nixos."${username}" + ]; + users.users."${username}" = { + openssh.authorizedKeys.keys = inputs.self.meta.users."${username}".authorizedKeys; }; + }; - # This module will be imported by the user factory - homeManager."${username}" = with inputs.self.meta.users."${username}"; { + # This module will be imported by the user factory + homeManager."${username}" = { pkgs, ... }: + with inputs.self.meta.users."${username}"; { home.stateVersion = "25.11"; + imports = [ + inputs.self.modules.homeManager.shell-tools + inputs.self.modules.homeManager.ssh + inputs.self.modules.homeManager.git + ]; + # home.packages = [ + # inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.shell-tools + # ]; xdg.enable = true; programs.git.settings.user.name = name; programs.git.settings.user.email = email; - imports = with inputs.self.modules.homeManager; [ - ssh - shell-tools - git - ]; }; - } - ]; + }; }