Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: 2024 Auxolotl Infrastructure Contributors |
| 2 | # SPDX-FileCopyrightText: 2024 Clicks Codes |
| 3 | # |
| 4 | # SPDX-License-Identifier: GPL-3.0-only |
| 5 | |
Skyler Grey | 61f0f85 | 2024-06-09 00:02:53 +0000 | [diff] [blame] | 6 | { |
| 7 | pkgs, |
| 8 | modulesPath, |
| 9 | lib, |
| 10 | config, |
| 11 | ... |
| 12 | }: |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 13 | { |
| 14 | boot.loader.systemd-boot.enable = true; |
| 15 | boot.loader.efi.canTouchEfiVariables = true; |
| 16 | |
| 17 | time.timeZone = "Etc/UTC"; |
| 18 | |
| 19 | environment.systemPackages = with pkgs; [ neovim ]; |
| 20 | |
| 21 | clicks = { |
| 22 | nix.enable = true; |
| 23 | |
| 24 | security = { |
| 25 | doas.enable = true; |
| 26 | |
| 27 | acme = { |
| 28 | enable = true; |
| 29 | email = "minion@clicks.codes"; |
| 30 | }; |
| 31 | }; |
| 32 | |
| 33 | services = { |
| 34 | ssh.enable = true; |
Skyler Grey | 61f0f85 | 2024-06-09 00:02:53 +0000 | [diff] [blame] | 35 | headscale = { |
| 36 | enable = true; |
| 37 | url = "clicks.domains"; |
| 38 | oidc = { |
| 39 | enable = true; |
| 40 | issuer = "https://login.clicks.codes/realms/master"; |
| 41 | allowed_groups = [ "/clicks" ]; |
| 42 | client_secret_path = |
| 43 | config.clicks.secrets."${lib.clicks.secrets.name ./headscale.sops.json}".paths.oidc_client_secret; |
| 44 | }; |
| 45 | database_password_path = |
| 46 | config.clicks.secrets."${lib.clicks.secrets.name ./headscale.sops.json}".paths.database_password; |
| 47 | noise_private_key_path = |
| 48 | config.clicks.secrets."${lib.clicks.secrets.name ./headscale.sops.json}".paths.noise_private_key; |
| 49 | private_key_path = |
| 50 | config.clicks.secrets."${lib.clicks.secrets.name ./headscale.sops.json}".paths.private_key; |
| 51 | }; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 52 | }; |
Skyler Grey | 40ae7a0 | 2024-06-06 21:22:25 +0000 | [diff] [blame] | 53 | |
Skyler Grey | 8ef3481 | 2024-06-09 19:42:15 +0000 | [diff] [blame] | 54 | networking.tailscale = { |
| 55 | enable = true; |
| 56 | authKeyFile = |
| 57 | config.clicks.secrets."${lib.clicks.secrets.name ./tailscale.sops.json}".paths.authKey; |
| 58 | }; |
| 59 | |
Skyler Grey | 40ae7a0 | 2024-06-06 21:22:25 +0000 | [diff] [blame] | 60 | storage = { |
Skyler Grey | f4d05f0 | 2024-06-06 21:25:39 +0000 | [diff] [blame] | 61 | raid.enable = true; |
Skyler Grey | 40ae7a0 | 2024-06-06 21:22:25 +0000 | [diff] [blame] | 62 | impermanence = { |
| 63 | enable = true; |
Skyler Grey | d337740 | 2024-06-06 22:01:26 +0000 | [diff] [blame] | 64 | devices = { |
| 65 | root = "/dev/disk/by-uuid/ab5c2f52-a737-4b29-a505-e3d0b9d0714c"; |
| 66 | persist = "/dev/md/a1d1:persist"; |
| 67 | }; |
Skyler Grey | 40ae7a0 | 2024-06-06 21:22:25 +0000 | [diff] [blame] | 68 | }; |
| 69 | }; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | boot.initrd.availableKernelModules = [ |
| 73 | "nvme" |
| 74 | "xhci_pci" |
| 75 | "ahci" |
| 76 | "usbhid" |
| 77 | "uas" |
| 78 | "usb_storage" |
| 79 | "sd_mod" |
| 80 | ]; |
| 81 | boot.initrd.kernelModules = [ ]; |
| 82 | boot.kernelModules = [ "kvm-amd" ]; |
| 83 | boot.extraModulePackages = [ ]; |
| 84 | |
Skyler Grey | 40ae7a0 | 2024-06-06 21:22:25 +0000 | [diff] [blame] | 85 | fileSystems."/nix" = { |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 86 | device = "/dev/disk/by-uuid/ab5c2f52-a737-4b29-a505-e3d0b9d0714c"; |
| 87 | fsType = "btrfs"; |
Skyler Grey | 40ae7a0 | 2024-06-06 21:22:25 +0000 | [diff] [blame] | 88 | options = [ "subvol=@nix" ]; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | fileSystems."/boot" = { |
| 92 | device = "/dev/disk/by-uuid/880D-BBAB"; |
| 93 | fsType = "vfat"; |
| 94 | options = [ |
| 95 | "fmask=0022" |
| 96 | "dmask=0022" |
| 97 | ]; |
| 98 | }; |
| 99 | |
| 100 | swapDevices = [ ]; |
| 101 | |
| 102 | networking.useDHCP = true; |
| 103 | |
| 104 | system.stateVersion = "24.05"; |
Skyler Grey | 61f0f85 | 2024-06-09 00:02:53 +0000 | [diff] [blame] | 105 | |
| 106 | clicks.secrets."${lib.clicks.secrets.name ./headscale.sops.json}" = { |
| 107 | file = ./headscale.sops.json; |
| 108 | group = "headscale"; |
| 109 | keys = [ |
| 110 | "oidc_client_secret" |
| 111 | "database_password" |
| 112 | "noise_private_key" |
| 113 | "private_key" |
| 114 | ]; |
| 115 | neededForUsers = false; |
| 116 | }; |
Skyler Grey | 8ef3481 | 2024-06-09 19:42:15 +0000 | [diff] [blame] | 117 | |
| 118 | clicks.secrets."${lib.clicks.secrets.name ./tailscale.sops.json}" = { |
| 119 | file = ./tailscale.sops.json; |
| 120 | keys = [ "authKey" ]; |
| 121 | }; |
Skyler Grey | f08a619 | 2024-06-01 23:55:20 +0000 | [diff] [blame] | 122 | } |