From c1a9e401cb8ee41f11802a9583317fd988de38f2 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Wed, 2 Jul 2025 22:56:10 -0500 Subject: [PATCH] broke out ssh module --- home.nix | 73 +------------------------------------- homeManagerModules/ssh.nix | 32 +++++++++++++++++ nixosModules/scripts.nix | 4 +++ 3 files changed, 37 insertions(+), 72 deletions(-) create mode 100644 homeManagerModules/ssh.nix diff --git a/home.nix b/home.nix index 4f85e11..0cd8922 100644 --- a/home.nix +++ b/home.nix @@ -4,6 +4,7 @@ imports = [ ./homeManagerModules/git.nix ./homeManagerModules/shell.nix + ./homeManagerModules/ssh.nix # inputs._1password-shell-plugins.hmModules.default ]; # Home Manager needs a bit of information about you and the paths it should @@ -21,15 +22,10 @@ busybox gnugrep dig - # eza gdu lazygit btop yazi - (writeShellScriptBin "nhmu" '' - nix flake update --flake ~/.config/home-manager - nix run home-manager -- switch --flake ~/.config/home-manager - '') # # It is sometimes useful to fine-tune packages, for example, by applying # # overrides. You can do that directly here, just don't forget the # # parentheses. Maybe you want to install Nerd Fonts with a limited number of @@ -37,21 +33,6 @@ # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) ]; - # Home Manager is pretty good at managing dotfiles. The primary way to manage - # plain files is through 'home.file'. - home.file = { - # # Building this configuration will create a copy of 'dotfiles/screenrc' in - # # the Nix store. Activating the configuration will then make '~/.screenrc' a - # # symlink to the Nix store copy. - # ".screenrc".source = dotfiles/screenrc; - - # # You can also set the file content immediately. - # ".gradle/gradle.properties".text = '' - # org.gradle.console=verbose - # org.gradle.daemon.idletimeout=3600000 - # ''; - }; - # Home Manager can also manage your environment variables through # 'home.sessionVariables'. These will be explicitly sourced when using a # shell provided by Home Manager. If you don't want to manage your shell @@ -75,58 +56,6 @@ # Let Home Manager install and manage itself. programs.home-manager.enable = true; - # programs.zsh = lib.mkIf config.shell { - # enable = true; - # enableCompletion = true; - # autosuggestion.enable = true; - # syntaxHighlighting.enable = true; - # oh-my-zsh = { - # enable = true; - # theme = "risto"; - # plugins = [ - # "sudo" - # "dotenv" - # "git" - # "ssh" - # "ssh-agent" - # ] ++ lib.optional config._1password "1password"; - # }; - # shellAliases.ls = "${pkgs.eza}/bin/eza -lgos type --no-time"; - # # initContent = lib.mkIf config._1password '' - # # source ${config.home.homeDirectory}/.config/op/plugins.sh - # # ''; - # }; - - programs.ssh = lib.mkIf config.ssh { - enable = true; - extraConfig = '' - SetEnv TERM="xterm-256color" - ${lib.optionalString config._1password "IdentityAgent ~/.1password/agent.sock"} - ''; - matchBlocks = lib.mkMerge [ - (lib.mkIf (config.profile == "personal") { - "panoptes" = { - hostname = "192.168.1.107"; - user = "panoptes"; - }; - "pve5070" = { - hostname = "192.168.1.130"; - user = "root"; - }; - "nix-test" = { - hostname = "192.168.1.36"; - user = "root"; - }; - }) - (lib.mkIf (config.profile == "work") { - "ubuntu-nvidia" = { - hostname = "10.118.46.120"; - user = "john"; - }; - }) - ]; - }; - # https://developer.1password.com/docs/cli/shell-plugins/nix/ programs._1password-shell-plugins = lib.mkIf config._1password { # enable 1Password shell plugins for bash, zsh, and fish shell diff --git a/homeManagerModules/ssh.nix b/homeManagerModules/ssh.nix new file mode 100644 index 0000000..a99c5fb --- /dev/null +++ b/homeManagerModules/ssh.nix @@ -0,0 +1,32 @@ +{ config, lib, ... }: +{ + programs.ssh = lib.mkIf config.ssh { + enable = true; + extraConfig = '' + SetEnv TERM="xterm-256color" + ${lib.optionalString config._1password "IdentityAgent ~/.1password/agent.sock"} + ''; + matchBlocks = lib.mkMerge [ + (lib.mkIf (config.profile == "personal") { + "panoptes" = { + hostname = "192.168.1.107"; + user = "panoptes"; + }; + "pve5070" = { + hostname = "192.168.1.130"; + user = "root"; + }; + "nix-test" = { + hostname = "192.168.1.36"; + user = "john"; + }; + }) + (lib.mkIf (config.profile == "work") { + "ubuntu-nvidia" = { + hostname = "10.118.46.120"; + user = "john"; + }; + }) + ]; + }; +} \ No newline at end of file diff --git a/nixosModules/scripts.nix b/nixosModules/scripts.nix index d3b1c2c..e2a1f92 100644 --- a/nixosModules/scripts.nix +++ b/nixosModules/scripts.nix @@ -4,6 +4,10 @@ let in { environment.systemPackages = with pkgs; [ + (writeShellScriptBin "nhmu" '' + nix flake update --flake ~/.config/home-manager + nix run home-manager -- switch --flake ~/.config/home-manager + '') (pkgs.writeShellScriptBin "nfs" '' sudo nixos-rebuild switch --flake $(readlink -f /etc/nixos)#${hostName} --impure '')