From 89b6380859b1e40aa631742db634a3e9496cdc49 Mon Sep 17 00:00:00 2001 From: blake Date: Wed, 15 Oct 2025 22:58:39 -0500 Subject: [PATCH] move ssh out to its own file and add zsh --- hosts/default.nix | 2 +- users/blake/dots/ssh/default.nix | 28 ++++++ users/blake/dots/stylix/default.nix | 4 +- users/blake/dots/xdg/default.nix | 15 ++-- users/blake/dots/zsh/default.nix | 134 ++++++++++++++++++++++++++++ users/blake/home.nix | 48 ++++------ 6 files changed, 189 insertions(+), 42 deletions(-) create mode 100644 users/blake/dots/ssh/default.nix diff --git a/hosts/default.nix b/hosts/default.nix index 5b51597..ea75931 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -38,9 +38,9 @@ services.autoaspm.enable = true; powerManagement.powertop.enable = true; - # enable flakes nix.settings.experimental-features = ["nix-command" "flakes"]; + users.defaultUserShell = pkgs.zsh; # passwordless rebuild security.sudo.extraRules = [ diff --git a/users/blake/dots/ssh/default.nix b/users/blake/dots/ssh/default.nix new file mode 100644 index 0000000..7acb3ff --- /dev/null +++ b/users/blake/dots/ssh/default.nix @@ -0,0 +1,28 @@ +{ + pkgs, + config, + ... +}: { + programs.ssh = { + enable = true; + matchBlocks = { + "git.blakedheld.xyz" = { + user = "gitea"; + identityFile = "~/.ssh/id_snowbelle"; + }; + "git.snowbelle.lan" = { + user = "gitea"; + identityFile = "~/.ssh/id_snowbelle"; + }; + "bebe" = { + hostname = "10.10.0.1"; + user = "root"; + identityFile = "~/.ssh/id_snowbelle"; + }; + }; + }; + + # import sshkeys from keyring + home.file.".ssh/id_snowbelle".source = config.lib.file.mkOutOfStoreSymlink /home/blake/.nix/.keyring/ssh/id_snowbelle; + home.file.".ssh/id_snowbelle.pub".source = config.lib.file.mkOutOfStoreSymlink /home/blake/.nix/.keyring/ssh/id_snowbelle.pub; +} diff --git a/users/blake/dots/stylix/default.nix b/users/blake/dots/stylix/default.nix index 32d5b03..6db691c 100644 --- a/users/blake/dots/stylix/default.nix +++ b/users/blake/dots/stylix/default.nix @@ -6,8 +6,6 @@ ... }: { - imports = [ - inputs.stylix.homeManagerModules.default - ]; + imports = [inputs.stylix.homeManagerModules.default]; } diff --git a/users/blake/dots/xdg/default.nix b/users/blake/dots/xdg/default.nix index a338962..d7cb7a1 100644 --- a/users/blake/dots/xdg/default.nix +++ b/users/blake/dots/xdg/default.nix @@ -3,20 +3,18 @@ config, ... }: { - - home.packages = with pkgs; [ xdg-ninja ]; + home.packages = with pkgs; [xdg-ninja]; xdg = { enable = true; - configHome = "${config.home.homeDirectory}/.config"; cacheHome = "${config.home.homeDirectory}/.cache"; dataHome = "${config.home.homeDirectory}/.local/share"; stateHome = "${config.home.homeDirectory}/.local/state"; - userDirs = { # ~/.config/user-dirs.dirs - enable = true; - # You can override defaults here: + userDirs = { + enable = true; + # writes ~/.config/user-dirs.dirs desktop = "${config.home.homeDirectory}/desktop"; download = "${config.home.homeDirectory}/downloads"; documents = "${config.home.homeDirectory}/documents"; @@ -28,5 +26,10 @@ }; }; + # misc env variables to get things out of ~ (<3 xdg-ninja) + home.sessionVariables = { + GOPATH="$XDG_DATA_HOME/go"; + _JAVA_OPTIONS="-Djava.util.prefs.userRoot=""$XDG_CONFIG_HOME""/java"; + }; } diff --git a/users/blake/dots/zsh/default.nix b/users/blake/dots/zsh/default.nix index 38af7d8..bb14e57 100644 --- a/users/blake/dots/zsh/default.nix +++ b/users/blake/dots/zsh/default.nix @@ -3,6 +3,140 @@ config, ... }: { + # export some defaults + home.sessionVariables = { + EDITOR = "nvim"; + PAGER = "less"; + }; + programs.zsh = { + enable = true; + dotDir = ".config/zsh"; + autocd = true; + enableCompletion = true; + autosuggestion = { + enable = true; + highlight = "fg=#ff00ff,bg=cyan,bold,underline"; + }; + + syntaxHighlighting = { + enable = true; + highlighters = ["main" "brackets" "pattern" "regexp" "cursor" "root"]; + styles = { + "default" = "none"; + "unknown-token" = "fg=yellow,bold"; + "reserved-word" = "fg=blue,bold"; + "alias" = "fg=magenta"; + "suffix-alias" = "fg=magenta"; + "builtin" = "fg=cyan"; + "function" = "fg=cyan"; + "command" = "fg=white,bold"; + "precommand" = "fg=cyan,underline"; + "commandseparator" = "fg=white"; + "hashed-command" = "fg=blue"; + "path" = "fg=white,underline"; + "globbing" = "fg=magenta"; + "history-expansion" = "fg=yellow"; + "single-hyphen-option" = "fg=blue"; + "double-hyphen-option" = "fg=blue"; + "back-quoted-argument" = "fg=yellow"; + "single-quoted-argument" = "fg=white"; + "double-quoted-argument" = "fg=white"; + "dollar-double-quoted-argument" = "fg=cyan"; + "back-double-quoted-argument" = "fg=cyan"; + }; + }; + + history = { + size = 10000; + save = 10000; + share = true; + append = true; + extended = true; + path = "$XDG_STATE_HOME/zsh/history"; + }; + + shellAilses = { + # --- zsh --- + cfz = "nvim $HOME/.config/zsh/.zshrc"; + src = "source $HOME/.config/zsh/.zshrc"; + + # --- config editing --- + cfh = "nvim $HOME/.config/hypr/hyprland.conf"; + cfl = "nvim $HOME/.config/lf/lfrc"; + + # --- navigation --- + ls = "ls --color=auto --group-directories-first"; + ll = "ls -lh --color=auto --group-directories-first"; + la = "ls -Alh --color=auto --group-directories-first"; + ".." = "cd .."; + "..." = "cd ../.."; + fs = "du -h | sort -h"; + ds = "du -hs"; + + # --- shortcuts --- + vswap = "cd ~/.local/state/nvim/swap"; + rswap = "rm ~/.local/state/nvim/swap/*"; + v = "nvim"; + sv = "sudo nvim"; + vim = "nvim"; + + # --- safety --- + cp = "cp -iv"; + mv = "mv -iv"; + rm = "rm -Iv"; + + # --- colors --- + grep = "grep --color=auto"; + fgrep = "fgrep --color=auto"; + egrep = "egrep --color=auto"; + + # --- scripts --- + rebuild = "sh ~/.nix/bin/rebuild.sh"; + perms = "sudo sh ~/.nix/bin/perms.sh"; + bb = "sudo sh ~/.nix/bin/backup_browse.sh"; + + # --- git --- + status = "git status"; + add = "git add"; + commit = "git commit -am"; + push = "git push"; + pull = "git pull"; + dotfiles = "/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME"; + dtf = "/usr/bin/git --git-dir=$HOME/.dotfiles --work-tree=$HOME"; + + # --- systemd --- + stat = "sudo systemctl status"; + restart = "sudo systemctl restart"; + start = "sudo systemctl start"; + stop = "sudo systemctl stop"; + jou = "sudo journalctl -xeu"; + live = "sudo journalctl -o short-iso -n 50 -fu"; + + # --- system --- + peace = "systemctl poweroff"; + love = "systemctl reboot"; + lock = "loginctl lock-session"; + }; + + initContent = '' + + # the prompt + PS1='%F{0}%K{126}%B[%n@%m]%b%k%f:%F{015}%B[%~]%b%f%F{015}%S$%s%f ' + + # lf changes working dir on exit + alias lf='lfcd' + lfcd () {cd "$(command lf -print-last-dir "$@")"} + + ''; + + # zplug = { + # enable = true; + # zplugHome = "$XDG_STATE_HOME/zsh/zplug"; + # plugins = [ + # {name = "zsh-users/zsh-syntax-highlighting";} + # ]; + # }; + }; } diff --git a/users/blake/home.nix b/users/blake/home.nix index 3fb3a04..695c03f 100644 --- a/users/blake/home.nix +++ b/users/blake/home.nix @@ -8,6 +8,8 @@ imports = [ ./dots/neovim ./dots/lf + ./dots/zsh + ./dots/ssh ./dots/git ./dots/xdg ]; @@ -28,45 +30,27 @@ ]; # setup zsh - home.sessionVariables.ZDOTDIR = "$HOME/.config/zsh"; - programs.zsh = { - enable = true; - # dotDir = ".config/zsh"; - }; - # link dotfiles - xdg.configFile."zsh" = { - source = config.lib.file.mkOutOfStoreSymlink "/home/blake/.nix/users/blake/dotfiles/zsh"; - recursive = true; - }; + #home.sessionVariables.ZDOTDIR = "$HOME/.config/zsh"; + #programs.zsh = { + # enable = true; + # # dotDir = ".config/zsh"; + #}; + ## link dotfiles + #xdg.configFile."zsh" = { + # source = config.lib.file.mkOutOfStoreSymlink "/home/blake/.nix/users/blake/dotfiles/zsh"; + # recursive = true; + #}; programs.gpg = { enable = true; }; services.gpg-agent = { enable = true; + enableSshSupport = true; + #pinentry.package = pkgs.pinentry-qt; + #pinentry.program = "pinentry-qt"; }; - - programs.ssh = { - enable = true; - matchBlocks = { - "git.blakedheld.xyz" = { - user = "gitea"; - identityFile = "~/.ssh/id_snowbelle"; - }; - "git.snowbelle.lan" = { - user = "gitea"; - identityFile = "~/.ssh/id_snowbelle"; - }; - "dockers" = { - hostname = "10.10.0.30"; - user = "blake"; - identityFile = "~/.ssh/id_snowbelle"; - }; - }; - }; - # import sshkeys from keyring - home.file.".ssh/id_snowbelle".source = config.lib.file.mkOutOfStoreSymlink /home/blake/.nix/.keyring/ssh/id_snowbelle; - home.file.".ssh/id_snowbelle.pub".source = config.lib.file.mkOutOfStoreSymlink /home/blake/.nix/.keyring/ssh/id_snowbelle.pub; + #home.packages with pkgs; = [pinentry-qt pinentry_mac]; # # manage secrets with sops # sops.secrets = {