summaryrefslogtreecommitdiff
path: root/nixos/modules/system/users/default.nix
blob: 6eafd7cc1066a62f7c0650061913539931d0787e (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
{ 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;
      }
    ];
  };

  # ZSH + completion, oh-my-zsh, autosuggestions, and fzf key bindings.
  programs.zsh = {
    enable = true;
    enableCompletion = true;
    ohMyZsh.enable = true;
    autosuggestions = {
      enable = true;
      highlightStyle = "fg=#6c7086";
      strategy = [ "history" "completion" ];
    };
    interactiveShellInit = ''
      source ${pkgs.fzf}/share/fzf/key-bindings.zsh
      source ${pkgs.fzf}/share/fzf/completion.zsh
    '';
    shellAliases = {
      ls = "eza -al --icons=auto";
      ll = "eza -al --icons=auto";
      sudo = "doas";
      open = "xdg-open";
    };
  };
}