commit 53116e85794779c2f9f83d1851796e5e4d090698
parent c250adab50d9408054790909b86b1071b361fc84
Author: Katja (ctucx) <git@ctu.cx>
Date: Tue, 18 Mar 2025 09:55:21 +0100
parent c250adab50d9408054790909b86b1071b361fc84
Author: Katja (ctucx) <git@ctu.cx>
Date: Tue, 18 Mar 2025 09:55:21 +0100
configurations/homeManager/programs: add `zsh`
2 files changed, 80 insertions(+), 8 deletions(-)
A
|
68
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/configurations/homeManager/programs/gpg.nix b/configurations/homeManager/programs/gpg.nix @@ -36,7 +36,18 @@ exec_always 'gpgconf --kill gpg-agent' ''; - programs = { + programs = let + shellExtraInit = '' + export GPG_TTY=$(tty) + export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + gpgconf --launch gpg-agent + ''; + + in { + + bash.initExtra = shellExtraInit; + zsh.initExtra = shellExtraInit; + gpg = { enable = true; mutableTrust = true; @@ -83,13 +94,6 @@ }; }; - bash.initExtra = '' - export GPG_TTY=$(tty) - export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - gpgconf --launch gpg-agent - ''; - - git.signing = { key = "4F1D8CCB"; signByDefault = true;
diff --git a/configurations/homeManager/programs/zsh.nix b/configurations/homeManager/programs/zsh.nix @@ -0,0 +1,68 @@ +{ config, pkgs, lib, ... }: + +{ + + home.packages = [ + pkgs.zsh + (lib.lowPrio pkgs.zsh-completions) + ]; + + programs.zsh = { + enable = true; + enableCompletion = true; + enableVteIntegration = lib.mkIf pkgs.stdenv.isLinux true; + + dotDir = ".config/zsh"; + + history = { + path = "${config.xdg.dataHome}/zsh/zsh_history"; + save = 100000000; + size = 1000000000; + expireDuplicatesFirst = true; + ignoreDups = true; + share = true; + }; + + oh-my-zsh = { + enable = true; + plugins = [ + "git" + "gitfast" + "sudo" + "systemd" + ]; + extraConfig = '' + zstyle ':completion:*' menu select + ''; + }; + + initExtra = '' + use() { + declare -a all + for p in "$@"; do + all+=("''${NIXPKGS_PATH}#$p") + done + eval nix shell ''${all[@]} + } + '' + lib.optionalString pkgs.stdenv.isDarwin '' + if [ "$TERM" != "dumb" ]; then + source "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" + nullglobStatus=$(shopt -p nullglob) + shopt -s nullglob + for p in $NIX_PROFILES; do + for m in "$p/etc/bash_completion.d/"*; do + source $m + done + done + eval "$nullglobStatus" + unset nullglobStatus p m + fi + + # Make bash check its window size after a process completes + shopt -s checkwinsize + + eval "$(/opt/homebrew/bin/brew shellenv)" + ''; + }; + +}