about summary refs log tree commit diff
path: root/configuration.nix
blob: bf8b46c43a72594111cd25b4271e8486037ce5a2 (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
110
111
112
113
114
115
116
117
118
{ pkgs, lib, ... }:

let
  util = import ./util.nix { inherit lib; };

  me = util.checkMe (import ./me.nix);
  security = import ./security.nix;
in
{
  system.stateVersion = "23.05";

  imports = [
    ./modules
    (./hardware + "/${me.name}.nix")
    (./machines + "/${me.name}.nix")
  ];

  nixpkgs = {
    config.allowUnfree = true;
    overlays = [ (super: final: import ./pkgs final )];
  };

  boot.loader.systemd-boot.enable = true;

  users.mutableUsers = false;
  users.users.mel = {
    isNormalUser = true;
    home = "/home/mel";
    shell = pkgs.fish;
    extraGroups = [ "wheel" "docker" ];

    openssh.authorizedKeys.keys = security.keys; 
    hashedPassword = security.password;
  };

  users.motd = ''

/^  /^
\ ' ' 7   < Hi, I'm ${util.titleCase me.name}
/    \

  '';

  networking = {
    hostName = me.name;

    firewall = {
      enable = true;
      allowedTCPPorts = [ 80 443 ];
      trustedInterfaces = [ "tailscale0" ];
    };
  };

  services = {
    openssh = {
      enable = true;
      openFirewall = false;
      settings = {
        PasswordAuthentication = false;
        KbdInteractiveAuthentication = false; 
        PermitRootLogin = "no";
      }; 
    };
    tailscale = {
      enable = true;
      useRoutingFeatures = "client";
    };
    nginx = {
      enable = true;
      recommendedGzipSettings = true;
      recommendedOptimisation = true;
      recommendedProxySettings = true;
      recommendedTlsSettings = true;
    };
  };

  virtualisation = {
    docker = {
      enable = true;
      enableOnBoot = true;
    };
  };

  security.acme = {
    acceptTerms = true;
    defaults.email = "einebeere@gmail.com";
  };

  programs = {
    vim = {
      defaultEditor = true;
      package = pkgs.vim-full.customize {
        vimrcFile = ./configs/.vimrc;
      };
    };
    fish = {
      enable = true;
      interactiveShellInit = ''
        set fish_greeting
      '';
    };
    git.enable = true;
    tmux.enable = true;
  };

  services.nginx.virtualHosts = {
    default = { default = true; };
    "${me.name}.rnrd.eu" = { root = "/var/www/html"; };
  };


  environment.systemPackages = with pkgs; [
    file unzip jq dig htop wget inetutils tcpdump
    ripgrep gnumake gdb
    glances
  ]; 
}