summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/zsh-user.nix
blob: e0ea046cf31cfebf21a3126a50ba212059457dbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ config, lib, pkgs, ... }:
let
  mainUser = config.krebs.build.user.name;
in
{
  programs.zsh= {
    enable = true;
    enableCompletion = false; #manually at the end

    promptInit = ''
      RPROMPT=""
      autoload colors && colors
      case $UID in
         0) PROMPT="%{$fg[red]%}%~%{$reset_color%} " ;;
      9001) PROMPT="%{$fg[green]%}%~%{$reset_color%} " ;;
         *) PROMPT="%{$fg[yellow]%}%n %{$fg[green]%}%~%{$reset_color%} " ;;
      esac
      if test -n "$SSH_CLIENT"; then
        PROMPT="%{$fg[magenta]%}%m $PROMPT"
      fi
      '';
  };

  users.users.${mainUser} = {
    shell = "/run/current-system/sw/bin/zsh";
    packages = [ pkgs.nix-zsh-completions ];
  };
}