refactor: complete rewrite

This commit is contained in:
ooks-io 2024-10-23 23:46:25 +13:00
parent 19a4bbda3c
commit 8e81943cf9
399 changed files with 3396 additions and 8042 deletions

View file

@ -0,0 +1,7 @@
{
imports = [
./options
./profiles
./services
];
}

View file

@ -0,0 +1,5 @@
{
imports = [
./server.nix
];
}

View file

@ -0,0 +1,22 @@
{lib, ...}: let
inherit (lib) mkOption;
inherit (lib.types) nullOr listOf enum bool;
in {
options.ooknet.server = {
exitNode = mkOption {
type = bool;
default = false;
description = "Whether the server will act as a tailscale exit node or not";
};
profile = mkOption {
type = nullOr (enum ["linode"]);
default = null;
description = "The server profile the host will use as a base";
};
services = mkOption {
type = listOf (enum []);
default = [];
description = "List of services the server will host";
};
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./linode.nix
];
}

View file

@ -0,0 +1,59 @@
{
config,
lib,
pkgs,
...
}: let
inherit (builtins) attrValues;
inherit (lib) mkForce mkIf;
inherit (config.ooknet.server) profile;
in {
config = mkIf (profile == "linode") {
networking = {
tempAddresses = "disabled";
usePredictableInterfaceNames = mkForce false;
interfaces.eth0 = {
tempAddress = "disabled";
useDHCP = true;
};
};
boot = {
kernelModules = [];
# LISH console support
kernelParams = ["console=ttys0,19200n8"];
extraModulePackages = [];
initrd = {
availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"];
kernelModules = [];
};
loader = {
grub = {
enable = true;
device = "/dev/sda";
forceInstall = true;
copyKernels = true;
fsIdentifier = "provided";
extraConfig = ''
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1;
terminal_input serial;
terminal_output serial
'';
};
# disable base settings
efi.canTouchEfiVariables = mkForce false;
systemd-boot.enable = mkForce false;
};
};
environment.systemPackages = attrValues {
inherit
(pkgs)
inetutils
mtr
sysstat
linode-cli
;
};
};
}

View file

@ -0,0 +1,2 @@
{
}