main
nix 97 lines 2.49 KB
Raw
1 {
2 config,
3 inputs,
4 lib,
5 ...
6 }:
7
8 {
9 imports = [
10 ./hardware.nix
11 inputs.srvos.nixosModules.server
12 inputs.srvos.nixosModules.hardware-hetzner-cloud-arm
13 ../../modules/common.nix
14 ../../modules/backup.nix
15 ../../modules/mailserver
16 ];
17
18 # Bootloader.
19 boot.loader.systemd-boot.enable = true;
20 boot.loader.timeout = lib.mkForce 5;
21 boot.loader.efi.efiSysMountPoint = "/efi";
22
23 # workaround because the console defaults to serial
24 boot.kernelParams = [ "console=tty" ];
25
26 services.cloud-init.enable = false;
27
28 networking = {
29 hostName = "umbriel";
30 domain = "nixos.org";
31 hostId = "36d29388";
32 };
33
34 disko.devices = import ./disko.nix;
35
36 systemd.network.networks."10-uplink" = {
37 matchConfig.MACAddress = "96:00:02:b5:f8:99";
38 address = [
39 "37.27.20.162/32"
40 "2a01:4f9:c011:8fb5::1/64"
41 ];
42 routes = [
43 { Gateway = "fe80::1"; }
44 {
45 Gateway = "172.31.1.1";
46 GatewayOnLink = true;
47 }
48 ];
49 linkConfig.RequiredForOnline = "routable";
50 };
51
52 # How to generate:
53 #
54 # $ cd non-critical-infra
55 # $ SECRET_PATH=secrets/storagebox-ssh-key.umbriel
56 # $ ssh-keygen -t ed25519 -f "$SECRET_PATH" -P "" -C root@umbriel
57 # $ sops encrypt --in-place "$SECRET_PATH"
58 # $ rm "$SECRET_PATH".pub
59 #
60 # Next, deploy this secret, ssh to the machine and install the secret on the storagebox:
61 #
62 # $ ssh-keygen -f /var/keys/storagebox-ssh-key -y | ssh -o "UserKnownHostsFile=/dev/null" -p23 u391032-sub4@u391032-sub4.your-storagebox.de install-ssh-key
63 sops.secrets.storagebox-ssh-key = {
64 sopsFile = ../../secrets/storagebox-ssh-key.umbriel;
65 format = "binary";
66 path = "/var/keys/storagebox-ssh-key";
67 mode = "0600";
68 owner = "root";
69 group = "root";
70 };
71
72 # How to generate:
73 #
74 # $ cd non-critical-infra
75 # $ SECRET_PATH=secrets/backup-secret.umbriel
76 # $ pwgen -s 64 1 > "$SECRET_PATH"
77 # $ sops encrypt --in-place "$SECRET_PATH"
78 sops.secrets.backup-secret = {
79 sopsFile = ../../secrets/backup-secret.umbriel;
80 format = "binary";
81 path = "/var/keys/borg-secret";
82 mode = "0600";
83 owner = "root";
84 group = "root";
85 };
86
87 services.backup = {
88 user = "u391032-sub4";
89 host = "u391032-sub4.your-storagebox.de";
90 hostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs";
91 port = 23;
92 sshKey = config.sops.secrets.storagebox-ssh-key.path;
93 secretPath = config.sops.secrets.backup-secret.path;
94 };
95
96 system.stateVersion = "23.05";
97 }