From af2c3219ce50a29eb027e35db1725d7a2cd55071 Mon Sep 17 00:00:00 2001 From: Matthew Bessette Date: Thu, 25 Jul 2024 22:34:05 -0400 Subject: [PATCH] Improved zsh and migrate ssh --- _hosts/argon/configuration.nix | 21 +++++++-------------- _hosts/argon/home.nix | 32 ++------------------------------ _hosts/bromine/configuration.nix | 1 + home-manager-modules/default.nix | 1 + home-manager-modules/ssh.nix | 23 +++++++++++++++++++++++ home-manager-modules/zsh.nix | 13 ++++++++----- nixos-modules/main-user.nix | 2 +- 7 files changed, 43 insertions(+), 50 deletions(-) create mode 100644 home-manager-modules/ssh.nix diff --git a/_hosts/argon/configuration.nix b/_hosts/argon/configuration.nix index 3291ccb..3ffab0d 100644 --- a/_hosts/argon/configuration.nix +++ b/_hosts/argon/configuration.nix @@ -82,30 +82,22 @@ # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - # users.users.mbessette = { - # isNormalUser = true; - # description = "Matthew Bessette"; - # extraGroups = [ "networkmanager" "wheel" ]; - # packages = with pkgs; []; - # }; - + ########### # MUTABLE # ########### - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - home-manager = { extraSpecialArgs = { inherit inputs; inherit system; }; backupFileExtension = "backup"; users.mbessette = import ./home.nix; }; + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ @@ -127,6 +119,7 @@ ############ programs.zsh.enable = true; + virtualisation.docker.enable = true; ############ # SERVICES # diff --git a/_hosts/argon/home.nix b/_hosts/argon/home.nix index b91f883..6ac1841 100644 --- a/_hosts/argon/home.nix +++ b/_hosts/argon/home.nix @@ -1,14 +1,12 @@ { config, pkgs, inputs, ... }: -let - agentPath = "~/.1password/agent.sock"; -in { imports = [ ../../home-manager-modules ]; firefox.enable = true; + ssh.enable = true; vscode.enable = true; zsh.enable = true; @@ -37,22 +35,7 @@ in # ''; }; - # 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 - # through Home Manager then you have to manually source 'hm-session-vars.sh' - # located at either - # - # ~/.nix-profile/etc/profile.d/hm-session-vars.sh - # - # or - # - # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh - # - # or - # - # /etc/profiles/per-user/mbessette/etc/profile.d/hm-session-vars.sh - # + home.sessionVariables = { EDITOR = "vim"; }; @@ -65,17 +48,6 @@ in userName = "Matthew Bessette"; }; - programs.ssh = { - enable = true; - extraConfig = '' - Host * - IdentityAgent ${agentPath} - Host bromine - HostName 192.168.1.247 - User mbessette - ''; - }; - nixpkgs = { config.allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [ diff --git a/_hosts/bromine/configuration.nix b/_hosts/bromine/configuration.nix index 84f66cb..3f2a8ee 100644 --- a/_hosts/bromine/configuration.nix +++ b/_hosts/bromine/configuration.nix @@ -80,6 +80,7 @@ ############ programs.zsh.enable = true; + programs.earthly.enable = true; ############ # SERVICES # diff --git a/home-manager-modules/default.nix b/home-manager-modules/default.nix index 7542724..8bb5e03 100644 --- a/home-manager-modules/default.nix +++ b/home-manager-modules/default.nix @@ -1,6 +1,7 @@ { imports = [ ./firefox.nix + ./ssh.nix ./vscode.nix ./zsh.nix ]; diff --git a/home-manager-modules/ssh.nix b/home-manager-modules/ssh.nix new file mode 100644 index 0000000..7a4d0d2 --- /dev/null +++ b/home-manager-modules/ssh.nix @@ -0,0 +1,23 @@ +{ config, lib, ... }: + +let + cfg = config.ssh; + agentPath = "~/.1password/agent.sock"; +in +{ + options = { + ssh.enable = lib.mkEnableOption "enable ssh module"; + }; + + config.programs.ssh = lib.mkIf cfg.enable { + enable = true; + extraConfig = '' + Host * + IdentityAgent ${agentPath} + Host bromine + HostName 192.168.1.200 + User mbessette + ForwardAgent yes + ''; + }; +} diff --git a/home-manager-modules/zsh.nix b/home-manager-modules/zsh.nix index 972699b..25c1362 100644 --- a/home-manager-modules/zsh.nix +++ b/home-manager-modules/zsh.nix @@ -10,10 +10,13 @@ in config.programs.zsh = lib.mkIf cfg.enable { enable = true; - # ohMyZsh.enable = true; - # ohMyZsh.theme = "robbyrussell"; - # ohMyZsh.plugins = [ - # "git" - # ]; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + oh-my-zsh.enable = true; + oh-my-zsh.theme = "robbyrussell"; + oh-my-zsh.plugins = [ + "git" + "npm" + ]; }; } diff --git a/nixos-modules/main-user.nix b/nixos-modules/main-user.nix index 4236a60..545fe6f 100644 --- a/nixos-modules/main-user.nix +++ b/nixos-modules/main-user.nix @@ -18,7 +18,7 @@ in initialPassword = "12345"; description = "main user"; shell = pkgs.zsh; - extraGroups = [ "networkmanager" "wheel" "docker"]; + extraGroups = [ "networkmanager" "wheel" "docker" ]; packages = with pkgs; []; openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxwgo35pdtk5dJKYBNLk723yvxmaJzN87KW3L2U82nY5HTYkMP6eoLN2S71RRN0deSE9//1xE3Pj1RXUates5Bq42csEa0s791VEC3zWdTlYeVaHbGgyRIOtNv6s5celwvqYZkMERbvbz/7cmTbOuQf5bdvopS7tofzj83s5iwOO8pmayavZ/xWSOfau07z0Sj2KuJSjqGkLtFD9P4o9BeNc3ZxghaMidZtpUNgSq/n06aph+dZOCLQpAQlQPIxqowGX/gQSailYId0SfAtuTesFvdgi9xkokia2erxv0RVbnblSZuucYoNdEm/sAX3bMxG9mLGxpyeIRfZjNynhzQh6jk4xLNsNszWVhmh49nrBADwmjXS6vO/QT8aaByKwJNmkPZxRMOquy18bZeEOl+Qya/Ui0g9diL3c6Mqmz4SwrWiROo70nFiInEMPAl/sXZSfpWsiFsAqqV2WyFKTNBzIM+XYE8wZf5h8thh8YuE3uGduR86u9HH7IU+fNCPR0="