aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/roots/gaia.nix
blob: e6c9472f469541a94fe90d1b85cca7007d0055f1 (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
119
120
121
122
123
124
125
126
127
128
/* TOP LEVEL DEVICE CONFIGURATION FOR
 * 
 *    gaia (data storage node)
 *
 *
 * This file is part of LIBKOOKIE, a collection of nix expressions.
 * LIBKOOKIE is licensed under the GPL-3.0 (or later) -- see LICENSE
 */

{ lib, config, pkgs, ... } @ args:

let klib = (import <modules/harness/lib.nix>) args;
in
{
  ###################################################################
  #                    libkookie configuration
  #
  #
  #


  imports = with klib; [
    # Load base modules required to bootstrap libkookie
    <home-manager/nixos> <modules> <configuration/nix>

    # BUILD A BETTER LOADER GOD DAMN IT
    <configuration/server/acme/gaia.nix>
    <configuration/server/datacore>
    <configuration/server/ferm2/gaia.nix>
    <configuration/server/syncthing>
    <configuration/server/jellyfin>
    <configuration/server/nextcloud>
    <configuration/server/openssh>
    <configuration/server/syncthing>
    <configuration/server/wireguard/gaia.nix>
  ];

  # TODO: build a klib function to patch cfg here
  libkookie.activeUsers = with klib; [
    (patchAttrs(load <configuration/users/spacekookie>) (a: {
      cfg.extraGroups = a.cfg.extraGroups ++ [ "core" ];
      cfg.homeDir = "/home/spacekookie";
    }))
    (patchAttrs(load <configuration/users/qyliss>) ({ ... }: { cfg.extraGroups = [ "core" ]; }))
  ];

  # Enable fish shell handling on the system
  libkookie.base.fish.enable = true;


  #
  #
  #
  #
  ###################################################################

  ###################################################################
  #                    NixOS base system options
  #
  #
  #

  
  boot.cleanTmpDir = true;
  boot.tmpOnTmpfs = true;
  boot.supportedFilesystems = [ "zfs" "exfat" ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = [ ];
  boot.loader.grub.device = "/dev/sdg";
  
  fileSystems."/" =
    { device = "zroot";
      fsType = "zfs";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/e5b36b2d-bdc7-4963-9a60-c2e1611a9676";
      fsType = "ext4";
    };

  swapDevices = [ ];
  nix.maxJobs = 4;

  networking = {
    defaultGateway = "10.7.1.1";
    nameservers = [ "10.7.1.2" "1.1.1.1" ];
    interfaces.eno1 = {
      ipv4.addresses = [ { address = "10.7.1.3"; prefixLength = 24; } ];
    };
    hostName = "gaia";
    hostId = "59405489";
    dhcpcd.enable = false;

    firewall.allowedTCPPorts = [ 80 443 ];
    nat = {
      enable = true;
      internalInterfaces = ["ve-+"];
      externalInterface = "eno1";
    };
  };
  
  time.timeZone = "Europe/Berlin";
  programs.mtr.enable = true;

   # Torrenting container
  # containers.trnsmssn =
  #   { autoStart = true;
  #     privateNetwork = true;
  #     hostAddress = "10.7.1.3";
  #     localAddress = "10.7.1.13";
  #     config = { config, pkgs, ... }:
  #       { services.mullvad.enable = true;
  #         services.transmission = { enable = true; };
  #         environment.systemPackages = with pkgs; [ transmission openvpn ];
  #       };
  #   };

  users.users."spacekookie".hashedPassword = "$6$rounds=1000000$Nnlc.bdBdGIVXtL$Ndb0WoOT.xl3eV2ba4jHe0ajbrGfVSf.RoS2hdaU8hvV8.UHBAZbDtLtXLqQ59Q6eUfjui3YIY6XWUGxAZNYF.";
  
  # This is pinned here because nextcloud/postgres is being unstable
  # at version 18.  In the future you might wanna look at upgrading
  # again, but for now, just be happily one major version behind!
  system.stateVersion = "20.09";
}