about summary refs log tree commit diff
path: root/machines/profpatsch/leguin.nix
blob: 31aa1c26601d73a30d220213eb0ed076ab8b89ee (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
{ config, pkgs, lib, ... }:

let
  myLib  = import ./lib.nix  { inherit pkgs lib; };
  myPkgs = import ./pkgs.nix { inherit pkgs lib myLib; };

  tailscaleInterface = "tailscale0";
  # tailscaleAddress = "100.76.60.85";
  # ethernetInterface = "enp0s20";

  myKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNMQvmOfon956Z0ZVdp186YhPHtSBrXsBwaCt0JAbkf/U/P+4fG0OROA++fHDiFM4RrRHH6plsGY3W6L26mSsCM2LtlHJINFZtVILkI26MDEIKWEsfBatDW+XNAvkfYEahy16P5CBtTVNKEGsTcPD+VDistHseFNKiVlSLDCvJ0vMwOykHhq+rdJmjJ8tkUWC2bNqTIH26bU0UbhMAtJstWqaTUGnB0WVutKmkZbnylLMICAvnFoZLoMPmbvx8efgLYY2vD1pRd8Uwnq9MFV1EPbkJoinTf1XSo8VUo7WCjL79aYSIvHmXG+5qKB9ed2GWbBLolAoXkZ00E4WsVp9H philip@nyx";

in

{
  imports = [
    ./base-server.nix
  ];

  config = {

    # TODO abstract out
    vuizvui.modifyNixPath = false;
    nix.nixPath = [
      "nixpkgs=${with pkgs.vuizvui.profpatsch; filterSourceGitignoreWith {
          gitignoreLines =
            readGitignoreFile "${toString pkgs.path}/.gitignore";
          globMap = glob:
            # filter out the non-rooted file globs,
            # because those take forever to filter
            # (10(!) seconds evaluation time in my test).
            if (!glob.isDir && !glob.isRooted)
            then null
            else glob;
        } pkgs.path}"
      # TODO?
      # "vuizvui=/root/vuizvui"
      # TODO: nicer?
      "nixos-config=${pkgs.writeText "leguin-configuration.nix" ''
        (import <vuizvui/machines>).profpatsch.leguin.config
      ''}"
    ];

    boot.loader.grub.device = "/dev/sda";

    fileSystems = {
      "/" = {
        device = "/dev/sda3";
        fsType = "ext4";
      };
      "/boot" = {
        device = "/dev/sda2";
        fsType = "ext4";
      };
    };

    users.users = {
      root.openssh.authorizedKeys.keys = [ myKey ];
    };

    security.acme.acceptTerms = true;
    security.acme.email = "mail@profpatsch.de";

    networking = {
      nat = {
        # enable = true;
        # externalInterface = ethernetInterface;
        # internalInterfaces = [ wireguard.interface ];
      };

      hostName = "leguin";
      firewall = {
        allowedTCPPorts = [
          80 443
        ];
        allowedUDPPorts = [
        ];

        interfaces.${tailscaleInterface} = {
          allowedTCPPorts = [
          ];
        };
      };

      # nameservers = [
      #   "62.210.16.6"
      #   "62.210.16.7"
    };

    services.tailscale = {
      enable = true;
      # interfaceName = tailscaleInterface;
    };
  };
}