Skip to content

Commit

Permalink
zsh configuration default with Nix Home Manager
Browse files Browse the repository at this point in the history
Much like Nix's tmux defaults, the Home Manager's defaults for zsh
have a lot of configurations set by default:

    cat ~/.zshrc

    typeset -U path cdpath fpath manpath

    for profile in ${(z)NIX_PROFILES}; do
      fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
    done

    HELPDIR="/nix/store/xkr4dr8zhi1r1k4x0w17hhprj62cjxw2-zsh-5.9/share/zsh/$ZSH_VERSION/help"

    # Oh-My-Zsh/Prezto calls compinit during initialization,
    # calling it twice causes slight start up slowdown
    # as all $fpath entries will be traversed again.
    autoload -U compinit && compinit

    # History options should be set in .zshrc and after oh-my-zsh sourcing.
    # See nix-community/home-manager#177.
    HISTSIZE="10000"
    SAVEHIST="10000"

    HISTFILE="$HOME/.zsh_history"
    mkdir -p "$(dirname "$HISTFILE")"

    setopt HIST_FCNTL_LOCK
    setopt HIST_IGNORE_DUPS
    setopt HIST_IGNORE_SPACE
    unsetopt HIST_EXPIRE_DUPS_FIRST
    setopt SHARE_HISTORY
    unsetopt EXTENDED_HISTORY

    # Aliases

    # Named Directory Hashes

I'm not too familiar with how Nix works, but I'd assume that the first
part is there to make sure Nix can properly function.

Then, the compinit line can be disabled by switching off
`enableCompletion`:

    programs.zsh = {
      enable = true;
      enableCompletion = false;
    };

Aside from that, there doesn't seem to be a way to turn the hisotry
settings off outside of overwriting their values.
  • Loading branch information
jeffkreeftmeijer committed Mar 15, 2023
1 parent 801a73d commit 53e6329
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion modules/zsh.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{ pkgs, ... }:

{
programs.zsh.enable = true;
programs.zsh = {
enable = true;
enableCompletion = false;
};
}
16 changes: 15 additions & 1 deletion nix.org
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,17 @@ index 6f6f86d..09e001a 100644
#+RESULTS:
: zsh 5.9 (x86_64-apple-darwin22.3.0)

*** Settings
:PROPERTIES:
:header-args: :noweb-ref zsh-settings
:END:

**** [[id:340AEBBE-52C4-4157-B2D4-608484F3BD71][Disable command completion]]

#+begin_src nix
enableCompletion = false;
#+end_src

*** Nix configuration

#+caption: =~/.config/nixpkgs/modules/zsh.nix=
Expand All @@ -348,7 +359,10 @@ index 6f6f86d..09e001a 100644
{ pkgs, ... }:

{
programs.zsh.enable = true;
programs.zsh = {
enable = true;
<<zsh-settings>>
};
}
#+end_src

Expand Down

0 comments on commit 53e6329

Please sign in to comment.