aboutsummaryrefslogtreecommitdiff
path: root/login.nix
blob: cf1646c2ff16968d138f57a3e8a1d535d898abc0 (plain) (blame)
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
100
101
102
103
104
105
106
107
108
109
110
{ pkgs, ... }:
let
  sessions = [
    ["tty1" windowManagers.dwm ]
    #["tty2" windowManagers.bspwm ]
  ];
  windowManagers = {
    dwm = looped "dwm";
    bspwm = exec "bspwm";
  };
  exec = s: "exec ${s}";
  looped = s: ''
    while true; do
      ssh-agent ${s} || break;
    done
  '';
in {
  # User
  users.users.imsohexy = {
    isNormalUser = true;
    extraGroups = [
      "wheel"
      "input"
      "audio"
      "video"
      "storage"
      "git"
      "networkmanager"
      "docker"
      "transmission"
    ];
    shell = pkgs.zsh;
  };
  #security.sudo.configFile = ''
  # %wheel ALL=(ALL) NOPASSWD: /sbin/poweroff, /sbin/reboot, /sbin/shutdown
  #'';

  # Global
  environment.variables = let
    apps = (import ./packages/sensible-apps/sensible-apps.nix).apps;
  in {
    EDITOR = apps.EDITOR;
    VISUAL = apps.EDITOR;
    TERMINAL = apps.TERMINAL;
    BROWSER = apps.BROWSER;
    PRIVATE_BROWSER = apps.PRIVATE_BROWSER;
  };
  environment.shells = with pkgs; [ zsh bashInteractive ];
  programs.zsh = {
    enable = true;
    enableCompletion = true;
    enableBashCompletion = true;
    autosuggestions.enable = true;
    syntaxHighlighting.enable = true;
    histFile = "~/.config/zshhistory";
    histSize = 50000;
    interactiveShellInit = ''source ~/.config/zsh/zshrc'';
    promptInit = "";
    loginShellInit = with builtins; let
      cases = map (s: ''
        /dev/${elemAt s 0})
          echo "~/.config/xorg/init.sh; ${elemAt s 1}" > ~/.xinitrc;
          sleep 0.2;
          startx;
        ;;
      '') sessions;
    in ''
      case "$(tty)" in
        ${toString cases}
        *) echo "Only tty for you, $(tty)" ;;
      esac;
    '';
  };
  services = {
    getty = {
      autologinUser = "imsohexy";
      helpLine = "";
      greetingLine = let
        c1 = "\\e{lightblue}";
        c2 = "\\e{lightcyan}";
        res = "\\e{reset}";
      in ''

${c1}          ▗▄▄▄       ${c2}▗▄▄▄▄    ▄▄▄▖${res}
${c1}          ▜███▙       ${c2}▜███▙  ▟███▛${res}                        ${c1}TTY:${res}       \e{bold}\l${res}
${c1}           ▜███▙       ${c2}▜███▙▟███▛${res}                         ${c2}Time:${res}      \e{halfbright}\d \t${res}
${c1}            ▜███▙       ${c2}▜██████▛${res}                          ${c2}Distr${res}      \e{halfbright}\S{PRETTY_NAME} \m${res}
${c1}     ▟█████████████████▙ ${c2}▜████▛     ${c1}▟▙${res}                    ${c2}Kernal:${res}    \e{halfbright}\s \r${res}
${c1}    ▟███████████████████▙ ${c2}▜███▙    ${c1}▟██▙${res}                   ${c2}WM:${res}        \e{halfbright}dwm${res}
${c1}           ▄▄▄▄▖           ▜███▙  ${c1}▟███▛${res}
${c1}          ▟███▛             ▜██▛ ${c1}▟███▛${res}
${c1}         ▟███▛               ▜▛ ${c1}▟███▛${res}
${c1}▟███████████▛                  ${c1}▟██████████▙${res}
${c1}▜██████████▛                  ${c1}▟███████████▛${res}
${c1}      ▟███▛ ${c1}▟▙               ▟███▛${res}
${c1}     ▟███▛ ${c1}▟██▙             ▟███▛${res}
${c1}    ▟███▛  ${c1}▜███▙           ▝▀▀▀▀${res}
${c1}    ▜██▛    ${c1}▜███▙ ${c2}▜██████████████████▛${res}
${c1}     ▜▛     ${c1}▟████▙ ${c2}▜████████████████▛${res}
${c1}           ▟██████▙       ${c2}▜███▙${res}
${c1}          ▟███▛▜███▙       ${c2}▜███▙${res}
${c1}         ▟███▛  ▜███▙       ${c2}▜███▙${res}
${c1}         ▝▀▀▀    ▀▀▀▀▘       ${c2}▀▀▀▘${res}



\e{bold}What's the password, dipshit?\e{reset}'';
    };
  };
}