summaryrefslogtreecommitdiff
path: root/nixos/modules/system/users/default.nix
blob: d9ac254820412f82062b5c6e2992ad3e6c4fad3b (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{ pkgs, ... }:

{
  # Main desktop user.
  users.users."seraphim" = {
    isNormalUser = true;
    description = "seraphim";
    shell = pkgs.zsh;
    # wheel for sudo/doas, networkmanager to manage connections itself.
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [];
  };

  # doas (simpler sudo replacement)
  security.doas = {
    enable = true;
    # Give seraphim persistent passwordless-ish privileges, keeping the env.
    extraRules = [
      {
        users = [ "seraphim" ];
        keepEnv = true;
        persist = true;
      }
    ];
  };

  # fzf -- proper key bindings + completion for zsh.
  programs.fzf = {
    fuzzyCompletion = true;
    keybindings = true;
  };

  # ZSH + completion, oh-my-zsh, autosuggestions.
  programs.zsh = {
    enable = true;
    enableCompletion = true;
    ohMyZsh.enable = true;
    autosuggestions = {
      enable = true;
      highlightStyle = "fg=#6c7086";
      strategy = [ "history" "completion" ];
    };
    interactiveShellInit = ''
      # Fish-style full-screen Ctrl+R history search.
      export FZF_CTRL_R_OPTS="
        --layout=reverse
        --scheme=history
        --height=100%
        --border=sharp
        --border-label=' Ctrl+R '
        --highlight-line
        --pointer=→
        --info=inline-right
        --header-first
        --header='enter: accept · ctrl-/ : toggle preview'
        --preview='echo {}' --preview-window=down:3:hidden:wrap
        --bind=ctrl-/:toggle-preview
      "
    '';
    shellAliases = {
      ls = "eza -al --icons=auto";
      ll = "eza -al --icons=auto";
      fs = "fastfetch";
      hf = "hyfetch";
      sudo = "doas";
      open = "xdg-open";
    };
  };
}