summaryrefslogtreecommitdiff
path: root/nixos/modules/users/eth.nix
blob: 0890443207cccc9044691ec6513787acd5d7525e (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{ config, lib, pkgs, ... }:
with lib;

let 
  cfg = config.eth.users.eth;

  defaultPackages = with pkgs; [
    home-manager

    ag
    direnv
    dnsutils
    file
    go
    htop
    iotop
    killall
    moreutils
    mosh
    rlwrap
    tmux
    unzip
    vim
    wget
    zip
  ];

  developmentPackages = with pkgs; [
    direnv
    entr
    git
    gitAndTools.tig
    goimports
    html-tidy
    imagemagick
    jq
    latest.rustChannels.stable.rust
    nix-prefetch-git
    pre-commit
    python3
    screen
  ];

  guiPackages = with pkgs; [
    chromium
    feh
    firefox
    mpv
    mupdf
    rxvt-unicode
    vlc
    wl-clipboard
  ];

in {

  options.eth.users.eth = {
    enable = mkEnableOption "Create the user eth";

    packages = {
      development = mkOption {
        type = types.bool;
        default = false;
        description = "install development packages (Go, Git, etc)";
      };
      gui = mkOption {
        type = types.bool;
        default = false;
        description = "install GUI packages (Firefox, VLC, etc)";
      };
    };

    extraPackages = mkOption {
       type = types.listOf types.package;
       default = [];
    };
  };

  config = {

    users.users.eth = mkIf cfg.enable {
      isNormalUser = true;

      extraGroups = [ "dialout" "wheel" ] ++
        (if config.programs.wireshark.enable then [ "wireshark" ] else []);

      shell = pkgs.fish;

      packages = defaultPackages ++ cfg.extraPackages
        ++ (if cfg.packages.development then developmentPackages else [])
        ++ (if cfg.packages.gui         then guiPackages else []);

      openssh.authorizedKeys.keys = [
        "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqcW3HzqQxPUjZteAs5HmDbCEAtHcThnj7qfJacEXBmpO5srinU3mhV/EhrqcAMkEoEIS2az2uQQEsF13nEqDD1uZh/Q7qwEnZepzElgBOIToQ+Np2qziRExV3ROBddJfmD3XBTPc7wA5BohYku+eCsfR37ZrRTgKUIALhZ4MSRxgQqnhtgaxHpL2Nk6ZdxRHO1ISlcmiWhOETP0fj76zN4+CgSv4rkPdYxKYpWVT8XTdKgu6ENbAPbOBzplui9MmrdS17ZaWy0KrKCiyMjhA5qSsOxWLXKL9P8lRuuXkWAl5cpt3vWWKAOzlLV1UCUbtlBblyH2KkeIKfO8AC45wX keychain@eth.moe"
        "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGf+geluXR5/hxK2OthfS+bG+7QbUVqV25bslT4KgMid+zkOVeWfA49n8/iuXUjYZmB0hP9oiFkM1wjFfC5JtET1OX3V8r0nuexXfhvG4gtWIk6Yw5HfPLv1qYYti4SrPKgQlP+C2i6WjHO6Y4VWSpJkgXgO+XvEa57fGSsjcy3rV6l/B56tpIhNchvwVxm1gHJnb4eZAKtQYcz8Pven2TFNFGLMMzQ7Y7JWAH80TDrdUywxfktaKmswo4rQ6i3zUKXrzaPuaH+egoNLqfZqM3+Q92PWs8bU2Y7uxXUQJXD32KuStRUwEz32A+O55nVVGTrnwKUUqnx9H04KCYBOVP backup@eth.moe"
      ];
    };
  };
}