From a2c7be1bd3ae33f764d8f5a7af590f1a97621069 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Thu, 23 Nov 2023 11:09:32 +0100 Subject: [PATCH] zsh for root user --- modules/zsh.nix | 54 ++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/modules/zsh.nix b/modules/zsh.nix index 99a9222..aab62c3 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -1,4 +1,28 @@ { config, pkgs, ... }: +let + zsh-config = { + enable = true; + shellAliases = { + #ll = "ls -l"; + #update = "sudo nixos-rebuild switch"; + }; + history.size = 1000; + history.ignoreDups = true; + #history.ignoreAllDups = true; + + oh-my-zsh = { + enable = true; + plugins = [ + # Provides many aliases and a few useful functions. + #"git" + # Easily prefix your current or previous commands with sudo by pressing `esc` twice. + #"sudo" + ]; + #theme = "robbyrussell"; + theme = "agnoster"; + }; + }; +in { # https://nixos.wiki/wiki/Command_Shell # https://nixos.wiki/wiki/Zsh @@ -8,31 +32,15 @@ # Inside the following Home Manager configuration block, # `config` refers to Home Manager configuration. home-manager.users.yoda = { osConfig, config, pkgs, ... }: { - programs.zsh = { - enable = true; - shellAliases = { - #ll = "ls -l"; - #update = "sudo nixos-rebuild switch"; - }; - history.size = 1000; - history.ignoreDups = true; - #history.ignoreAllDups = true; - + programs.zsh = zsh-config // { # nix-repl: config.home-manager.users.yoda.programs.zsh.history.path - # -> /home/yoda/.local/share/.histfile + # -> ~/.local/share/.histfile + history.path = "${config.xdg.dataHome}/.histfile"; + }; + }; + home-manager.users.root = { osConfig, config, pkgs, ... }: { + programs.zsh = zsh-config // { history.path = "${config.xdg.dataHome}/.histfile"; - - oh-my-zsh = { - enable = true; - plugins = [ - # Provides many aliases and a few useful functions. - #"git" - # Easily prefix your current or previous commands with sudo by pressing `esc` twice. - #"sudo" - ]; - #theme = "robbyrussell"; - theme = "agnoster"; - }; }; }; }