summaryrefslogtreecommitdiff
path: root/hosts/oixos/default.nix
blob: ba853e2817b500c578f660bbc91a0d3f945592a6 (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
100
101
102
103
104
105
106
107
108
109
{
  systemState,
  user,
  hostname,
}:
{
  pkgs,
  config,
  inputs,
  lib,
  ...
}:
{
  imports = [
    inputs.disko.nixosModules.disko
    ./disko.nix
    ./hardware-configuration.nix
    ./cgit.nix
  ];

  nix.settings = {
    trusted-users = [ "@wheel" ];
    experimental-features = [
      "nix-command"
      "flakes"
    ];
    auto-optimise-store = true;
  };

  services.chrony.enable = true;

  time.timeZone = "UTC";
  i18n.defaultLocale = "en_US.UTF-8";

  boot.loader.systemd-boot = {
    enable = true;
    editor = false;
  };
  boot.loader.timeout = 0;
  boot.loader.efi.canTouchEfiVariables = false;

  # boot.loader.grub = {
  #   efiSupport = true;
  #   efiInstallAsRemovable = true;
  # };

  networking.hostName = hostname;
  networking.firewall.enable = true;
  networking.firewall.allowedTCPPorts = [
    80
    443
  ];
  networking.firewall.allowedUDPPorts = [ ];

  networking.useDHCP = true;

  services.openssh = {
    enable = true;
    settings = {
      PermitRootLogin = "prohibit-password";
      PasswordAuthentication = false;
    };
  };

  users.users.beeb5k = {
    isNormalUser = true;
    extraGroups = [ "wheel" ];

    openssh.authorizedKeys.keys = [
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGTMc0gNGM6vI8s9CrW+fYlW4ppRTKRCELOve3Izj1VD beeb5k"
    ];
  };

  services.cloud-init.enable = true;

  users.users.root.openssh.authorizedKeys.keys = [
    "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGTMc0gNGM6vI8s9CrW+fYlW4ppRTKRCELOve3Izj1VD beeb5k"
  ];

  environment.systemPackages = with pkgs; [
    git
    fastfetch
  ];

  # security.sudo.wheelNeedsPassword = false;

  programs.bash.promptInit = ''
    if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then
     # Removed the '1;' prefix to disable bold
     PROMPT_COLOR="31m"
     ((UID)) && PROMPT_COLOR="32m"

     if [ -n "$INSIDE_EMACS" ]; then
       PS1="\[\033[$PROMPT_COLOR\]\u@\h:\w\\$\[\033[0m\] "
     else
       PS1="\[\e[94m\]\u@\h \[\e[32m\]\w \[\e[39m\]\$ \[\e[0m\]"
     fi

     if test "$TERM" = "xterm"; then
       PS1="\[\033]2;\h:\u:\w\007\]$PS1"
     fi
    fi
  '';

  nixpkgs.hostPlatform = "aarch64-linux";

  system.stateVersion = systemState;

}