Compare commits
No commits in common. "d9f629f3a9175e9af01131b3c356942098028dba" and "1c8bd0d8662c3604945935921d1e55db563715c6" have entirely different histories.
d9f629f3a9
...
1c8bd0d866
28 changed files with 130 additions and 463 deletions
88
flake.lock
generated
88
flake.lock
generated
|
|
@ -166,24 +166,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-parts_3": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs-lib": "nixpkgs-lib_3"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1726153070,
|
|
||||||
"narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=",
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "hercules-ci",
|
|
||||||
"repo": "flake-parts",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1629284811,
|
"lastModified": 1629284811,
|
||||||
|
|
@ -219,7 +201,7 @@
|
||||||
},
|
},
|
||||||
"flake-utils_3": {
|
"flake-utils_3": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems_7"
|
"systems": "systems_6"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726560853,
|
"lastModified": 1726560853,
|
||||||
|
|
@ -697,21 +679,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nix-filter": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1710156097,
|
|
||||||
"narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "nix-filter",
|
|
||||||
"rev": "3342559a24e85fc164b295c3444e8a139924675b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "nix-filter",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix-index-db": {
|
"nix-index-db": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
@ -772,18 +739,6 @@
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
|
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-lib_3": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1725233747,
|
|
||||||
"narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=",
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1720386169,
|
"lastModified": 1720386169,
|
||||||
|
|
@ -1030,29 +985,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ooknet-website": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-parts": "flake-parts_3",
|
|
||||||
"nix-filter": "nix-filter",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"systems": "systems_5"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1728305902,
|
|
||||||
"narHash": "sha256-761elKy4m30bx9+3QTlc2MGlRbESek/klbufIP75UqI=",
|
|
||||||
"ref": "refs/heads/master",
|
|
||||||
"rev": "b0ed4617e28b40e43cc286c9cd50d75d0e204668",
|
|
||||||
"revCount": 4,
|
|
||||||
"type": "git",
|
|
||||||
"url": "ssh://git@github.com/ooks-io/website"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "ssh://git@github.com/ooks-io/website"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ooks-scripts": {
|
"ooks-scripts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
|
@ -2861,9 +2793,8 @@
|
||||||
"nix-index-db": "nix-index-db",
|
"nix-index-db": "nix-index-db",
|
||||||
"nixpkgs": "nixpkgs_3",
|
"nixpkgs": "nixpkgs_3",
|
||||||
"nvf": "nvf",
|
"nvf": "nvf",
|
||||||
"ooknet-website": "ooknet-website",
|
|
||||||
"ooks-scripts": "ooks-scripts",
|
"ooks-scripts": "ooks-scripts",
|
||||||
"systems": "systems_6",
|
"systems": "systems_5",
|
||||||
"zjstatus": "zjstatus"
|
"zjstatus": "zjstatus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -2991,21 +2922,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems_6": {
|
"systems_6": {
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689347949,
|
|
||||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default-linux",
|
|
||||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default-linux",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems_7": {
|
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,6 @@
|
||||||
url = "git+ssh://git@github.com/ooks-io/scripts";
|
url = "git+ssh://git@github.com/ooks-io/scripts";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
ooknet-website = {
|
|
||||||
url = "git+ssh://git@github.com/ooks-io/website";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
|
|
||||||
nvf.url = "github:notashelf/nvf/v0.7";
|
nvf.url = "github:notashelf/nvf/v0.7";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
cpu.type = "amd";
|
cpu.type = "amd";
|
||||||
cpu.amd.pstate.enable = true;
|
cpu.amd.pstate.enable = true;
|
||||||
gpu.type = "amd";
|
gpu.type = "amd";
|
||||||
features = ["printing" "ssd" "audio" "video"];
|
features = ["ssd" "audio" "video"];
|
||||||
monitors = [
|
monitors = [
|
||||||
{
|
{
|
||||||
name = "DP-3";
|
name = "DP-3";
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,6 @@ in {
|
||||||
hostname = "github.com";
|
hostname = "github.com";
|
||||||
identityFile = "${osConfig.age.secrets.github_key.path}";
|
identityFile = "${osConfig.age.secrets.github_key.path}";
|
||||||
};
|
};
|
||||||
"git.ooknet.org" = {
|
|
||||||
user = "forgejo";
|
|
||||||
port = 2222;
|
|
||||||
hostname = "git.ooknet.org";
|
|
||||||
identityFile = "${osConfig.age.secrets.ooknet_org.path}";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkIf mkEnableOption mkOption;
|
|
||||||
inherit (lib.types) str;
|
|
||||||
cfg = config.ooknet.gaming;
|
|
||||||
in {
|
|
||||||
options.ooknet.gaming = {
|
|
||||||
enable = mkEnableOption;
|
|
||||||
|
|
||||||
gamesPath = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${config.home.homeDirectory}/Games";
|
|
||||||
description = "Location where games will be stored.";
|
|
||||||
};
|
|
||||||
|
|
||||||
prefixPath = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${cfg.gamesPath}/prefixes";
|
|
||||||
};
|
|
||||||
compatDataPath = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${cfg.prefixPath}/compatdata";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = mkIf cfg.enable {
|
|
||||||
xdg.userDirs.XDG_GAMES_DIR = cfg.gamesPath;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkIf mkEnableOption mkOption;
|
|
||||||
inherit (lib.types) str package;
|
|
||||||
inherit (config.ooknet) gaming;
|
|
||||||
gamesDir = config.xdg.userDirs.extraConfig.XDG_GAMES_DIR;
|
|
||||||
cfg = config.ooknet.gaming.world-of-warcraft;
|
|
||||||
in {
|
|
||||||
options.ooknet.gaming.world-of-warcraft = {
|
|
||||||
enable = mkEnableOption "Enable the World of Warcraft module";
|
|
||||||
|
|
||||||
proton = {
|
|
||||||
package = mkOption {
|
|
||||||
type = package;
|
|
||||||
default = pkgs.proton-ge-custom;
|
|
||||||
};
|
|
||||||
prefix = {
|
|
||||||
path = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${gaming.prefixPath}/WoW";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
compatDataPath = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${gaming.compatDataPath}/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
gamePrefixPath = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${cfg.winePrefixesPath}/WoW";
|
|
||||||
description = "Location where the World of Warcraft prefix will be stored.";
|
|
||||||
};
|
|
||||||
|
|
||||||
gamePath = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${cfg.world-of-warcraft.gamePrefixPath}/drive_c/Program Files (x86)/World of Warcraft";
|
|
||||||
description = "Location where the World of Warcraft installation will be symlinked.";
|
|
||||||
};
|
|
||||||
|
|
||||||
gameSharedPath = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "${cfg.wineProgramsPath}/World Of Warcraft";
|
|
||||||
description = "Location where World of Warcraft game files are stored.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config =
|
|
||||||
mkIf cfg.enable {
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
lib,
|
lib,
|
||||||
osConfig,
|
osConfig,
|
||||||
pkgs,
|
pkgs,
|
||||||
self',
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkIf elem;
|
inherit (lib) mkIf elem;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ in {
|
||||||
"libvirtd"
|
"libvirtd"
|
||||||
"streamer"
|
"streamer"
|
||||||
"torrenter"
|
"torrenter"
|
||||||
"www"
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
keys,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (config.ooknet.host) admin;
|
|
||||||
in {
|
|
||||||
users = {
|
|
||||||
groups.builder = {};
|
|
||||||
users.builder = (key: ''command="nix-daemon --stdio",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ${key}'') keys.users.${admin.name};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -27,7 +27,7 @@ in {
|
||||||
variables = paths;
|
variables = paths;
|
||||||
};
|
};
|
||||||
nix = {
|
nix = {
|
||||||
package = pkgs.lix;
|
# package = pkgs.lix;
|
||||||
|
|
||||||
# collect garbage
|
# collect garbage
|
||||||
gc = {
|
gc = {
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,6 @@ in {
|
||||||
owner = "${admin.name}";
|
owner = "${admin.name}";
|
||||||
group = "users";
|
group = "users";
|
||||||
};
|
};
|
||||||
ooknet_org = mkIf admin.homeManager {
|
|
||||||
file = "${self}/secrets/ooknet_org.age";
|
|
||||||
path = "/home/${admin.name}/.ssh/ooknet_org";
|
|
||||||
owner = "${admin.name}";
|
|
||||||
group = "users";
|
|
||||||
};
|
|
||||||
spotify_key = mkIf admin.homeManager {
|
spotify_key = mkIf admin.homeManager {
|
||||||
file = "${self}/secrets/spotify_key.age";
|
file = "${self}/secrets/spotify_key.age";
|
||||||
owner = "${admin.name}";
|
owner = "${admin.name}";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./postgresql.nix
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkIf elem optionals;
|
|
||||||
inherit (config.ooknet.server) services database;
|
|
||||||
in {
|
|
||||||
config = mkIf database.postgresql.enable {
|
|
||||||
services.postgresql = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
checkConfig = true;
|
|
||||||
|
|
||||||
ensureDatabases = optionals (elem "forgejo" services) ["forgejo"];
|
|
||||||
|
|
||||||
ensureUsers =
|
|
||||||
[
|
|
||||||
{
|
|
||||||
name = "postgres";
|
|
||||||
ensureClauses = {
|
|
||||||
login = true;
|
|
||||||
superuser = true;
|
|
||||||
replication = true;
|
|
||||||
createdb = true;
|
|
||||||
createrole = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
]
|
|
||||||
++ (optionals (elem "forgejo" services) [
|
|
||||||
{
|
|
||||||
name = "forgejo";
|
|
||||||
ensureDBOwnership = true;
|
|
||||||
}
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
{lib, ...}: let
|
|
||||||
inherit (lib) mkDefault;
|
|
||||||
in {
|
|
||||||
# from github:nix-community/srvos
|
|
||||||
|
|
||||||
# disable fonts
|
|
||||||
fonts.fontconfig.enable = false;
|
|
||||||
|
|
||||||
# dont generate documentation
|
|
||||||
documentation = {
|
|
||||||
enable = mkDefault false;
|
|
||||||
info.enable = mkDefault false;
|
|
||||||
man.enable = mkDefault false;
|
|
||||||
nixos.enable = mkDefault false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./options.nix
|
./options.nix
|
||||||
./debloat.nix
|
|
||||||
./services
|
./services
|
||||||
./webserver
|
./profiles
|
||||||
./database
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib) mkOption mkEnableOption;
|
inherit (lib) mkOption;
|
||||||
inherit (lib.types) str nullOr listOf enum bool;
|
inherit (lib.types) nullOr listOf enum bool;
|
||||||
in {
|
in {
|
||||||
options.ooknet.server = {
|
options.ooknet.server = {
|
||||||
exitNode = mkOption {
|
exitNode = mkOption {
|
||||||
|
|
@ -14,20 +14,9 @@ in {
|
||||||
description = "The server profile the host will use as a base";
|
description = "The server profile the host will use as a base";
|
||||||
};
|
};
|
||||||
services = mkOption {
|
services = mkOption {
|
||||||
type = listOf (enum ["website" "forgejo"]);
|
type = listOf (enum ["website"]);
|
||||||
default = [];
|
default = [];
|
||||||
description = "List of services the server will host";
|
description = "List of services the server will host";
|
||||||
};
|
};
|
||||||
domain = mkOption {
|
|
||||||
type = str;
|
|
||||||
default = "";
|
|
||||||
};
|
|
||||||
|
|
||||||
webserver = {
|
|
||||||
caddy.enable = mkEnableOption "";
|
|
||||||
};
|
|
||||||
database = {
|
|
||||||
postgresql.enable = mkEnableOption "";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./caddy.nix
|
./linode.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
94
modules/nixos/server/profiles/linode.nix
Normal file
94
modules/nixos/server/profiles/linode.nix
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (builtins) attrValues;
|
||||||
|
inherit (lib) mkForce getExe' mkIf;
|
||||||
|
inherit (config.ooknet.server) profile;
|
||||||
|
in {
|
||||||
|
config = mkIf (profile == "linode") {
|
||||||
|
services.qemuGuest.enable = true;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
tempAddresses = "disabled";
|
||||||
|
usePredictableInterfaceNames = mkForce false;
|
||||||
|
interfaces.eth0 = {
|
||||||
|
tempAddress = "disabled";
|
||||||
|
useDHCP = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/sda";
|
||||||
|
fsType = "ext4";
|
||||||
|
autoResize = true;
|
||||||
|
};
|
||||||
|
swapDevices = [{device = "/dev/sdb";}];
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
kernelModules = [];
|
||||||
|
# LISH console support
|
||||||
|
kernelParams = ["console=ttyS0,19200n8"];
|
||||||
|
extraModulePackages = [];
|
||||||
|
growPartition = true;
|
||||||
|
initrd = {
|
||||||
|
availableKernelModules = [
|
||||||
|
# modules generated by nixos-generate-config
|
||||||
|
"virtio_pci"
|
||||||
|
"virtio_scsi"
|
||||||
|
"ahci"
|
||||||
|
"sd_mod"
|
||||||
|
|
||||||
|
# qemu guest modules
|
||||||
|
"virtio_net"
|
||||||
|
"virtio_mmio"
|
||||||
|
"virtio_blk"
|
||||||
|
"virtio_scsi"
|
||||||
|
"9p"
|
||||||
|
"9pnet_virtio"
|
||||||
|
];
|
||||||
|
kernelModules = [
|
||||||
|
"virtio_balloon"
|
||||||
|
"virtio_console"
|
||||||
|
"virtio_rng"
|
||||||
|
"virtio_gpu"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
loader = {
|
||||||
|
grub = {
|
||||||
|
enable = true;
|
||||||
|
device = "nodev";
|
||||||
|
forceInstall = true;
|
||||||
|
copyKernels = true;
|
||||||
|
fsIdentifier = "label";
|
||||||
|
splashImage = null;
|
||||||
|
extraConfig = ''
|
||||||
|
serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1;
|
||||||
|
terminal_input serial;
|
||||||
|
terminal_output serial
|
||||||
|
'';
|
||||||
|
|
||||||
|
extraInstallCommands = "${getExe' pkgs.coreutils "ln"} -fs /boot/grub /boot/grub2";
|
||||||
|
};
|
||||||
|
timeout = mkForce 10;
|
||||||
|
# disable base settings
|
||||||
|
efi.canTouchEfiVariables = mkForce false;
|
||||||
|
systemd-boot.enable = mkForce false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
systemPackages = attrValues {
|
||||||
|
inherit
|
||||||
|
(pkgs)
|
||||||
|
inetutils
|
||||||
|
mtr
|
||||||
|
sysstat
|
||||||
|
linode-cli
|
||||||
|
;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,5 @@ in {
|
||||||
tempAddress = "disabled";
|
tempAddress = "disabled";
|
||||||
useDHCP = true;
|
useDHCP = true;
|
||||||
};
|
};
|
||||||
firewall.allowedUDPPorts = [443];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkIf;
|
|
||||||
inherit (config.ooknet.server) database;
|
|
||||||
in {
|
|
||||||
# hardware based postgresql configuration for: linode nano
|
|
||||||
# 4GB RAM 1 Core
|
|
||||||
# generated with: <http://pgconfigurator.cybertec.at>
|
|
||||||
config = mkIf database.postgresql {
|
|
||||||
services.postgresql = {
|
|
||||||
settings = {
|
|
||||||
# Connectivity
|
|
||||||
max_connections = 20;
|
|
||||||
superuser_reserved_connections = 3;
|
|
||||||
|
|
||||||
# Memory Settings
|
|
||||||
shared_buffers = "256 MB";
|
|
||||||
work_mem = "32 MB";
|
|
||||||
maintenance_work_mem = "320 MB";
|
|
||||||
huge_pages = "off";
|
|
||||||
effective_cache_size = "1 GB";
|
|
||||||
effective_io_concurrency = 100; # concurrent IO only really activated if OS supports posix_fadvise function
|
|
||||||
random_page_cost = 1.25; # speed of random disk access relative to sequential access (1.0)
|
|
||||||
|
|
||||||
# Monitoring
|
|
||||||
shared_preload_libraries = "pg_stat_statements"; # per statement resource usage stats
|
|
||||||
track_io_timing = "on"; # measure exact block IO times
|
|
||||||
track_functions = "pl"; # track execution times of pl-language procedures if any
|
|
||||||
|
|
||||||
# Replication
|
|
||||||
wal_level = "replica"; # consider using at least 'replica'
|
|
||||||
max_wal_senders = 0;
|
|
||||||
synchronous_commit = "on";
|
|
||||||
|
|
||||||
# Checkpointing:
|
|
||||||
checkpoint_timeout = "15 min";
|
|
||||||
checkpoint_completion_target = 0.9;
|
|
||||||
max_wal_size = "1024 MB";
|
|
||||||
min_wal_size = "512 MB";
|
|
||||||
|
|
||||||
# WAL writing
|
|
||||||
wal_compression = "on";
|
|
||||||
wal_buffers = -1; # auto-tuned by Postgres till maximum of segment size (16MB by default)
|
|
||||||
wal_writer_delay = "200ms";
|
|
||||||
wal_writer_flush_after = "1MB";
|
|
||||||
|
|
||||||
# Background writer
|
|
||||||
bgwriter_delay = "200ms";
|
|
||||||
bgwriter_lru_maxpages = 100;
|
|
||||||
bgwriter_lru_multiplier = 2.0;
|
|
||||||
bgwriter_flush_after = 0;
|
|
||||||
|
|
||||||
# Parallel queries:
|
|
||||||
max_worker_processes = 1;
|
|
||||||
max_parallel_workers_per_gather = 1;
|
|
||||||
max_parallel_maintenance_workers = 1;
|
|
||||||
max_parallel_workers = 1;
|
|
||||||
parallel_leader_participation = "on";
|
|
||||||
|
|
||||||
# Advanced features
|
|
||||||
enable_partitionwise_join = "on";
|
|
||||||
enable_partitionwise_aggregate = "on";
|
|
||||||
jit = "on";
|
|
||||||
max_slot_wal_keep_size = "1000 MB";
|
|
||||||
track_wal_io_timing = "on";
|
|
||||||
maintenance_io_concurrency = 100;
|
|
||||||
wal_recycle = "on";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./website
|
./website
|
||||||
./forgejo
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,66 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (config.ooknet.server) services domain;
|
|
||||||
inherit (lib) mkIf elem;
|
|
||||||
in {
|
|
||||||
config = mkIf (elem "forgejo" services) {
|
|
||||||
networking.firewall.allowedTCPPorts = [2222];
|
|
||||||
|
|
||||||
ooknet.server = {
|
|
||||||
webserver.caddy.enable = true;
|
|
||||||
database.postgresql.enable = true;
|
|
||||||
};
|
|
||||||
services = {
|
|
||||||
forgejo = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
server = {
|
|
||||||
DOMAIN = "git.${domain}";
|
|
||||||
ROOT_URL = "https://git.${domain}";
|
|
||||||
HTTP_PORT = 3000;
|
|
||||||
LANDING_PAGE = "explore";
|
|
||||||
|
|
||||||
START_SSH_SERVER = true;
|
|
||||||
SSH_PORT = 2222;
|
|
||||||
SSH_LISTEN_PORT = 2222;
|
|
||||||
};
|
|
||||||
database = {
|
|
||||||
type = "postgres";
|
|
||||||
createDatabase = true;
|
|
||||||
};
|
|
||||||
service = {
|
|
||||||
DISABLE_REGISTRATION = true;
|
|
||||||
};
|
|
||||||
security = {
|
|
||||||
INSTALL_LOCK = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
caddy.virtualHosts = {
|
|
||||||
"git.${domain}".extraConfig = ''
|
|
||||||
header {
|
|
||||||
Strict-Transport-Security "max-age=31536000;"
|
|
||||||
X-XSS-Protection "1; mode=block"
|
|
||||||
X-Frame-Options "DENY"
|
|
||||||
X-Content-Type-Options "nosniff"
|
|
||||||
-Server
|
|
||||||
Referrer-Policy "no-referrer"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Handle proxying
|
|
||||||
handle_path /* {
|
|
||||||
reverse_proxy localhost:3000 {
|
|
||||||
header_up X-Real-IP {remote_host}
|
|
||||||
header_up X-Forwarded-For {remote_host}
|
|
||||||
header_up X-Forwarded-Proto {scheme}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -9,7 +9,8 @@
|
||||||
inherit (self'.packages) website;
|
inherit (self'.packages) website;
|
||||||
in {
|
in {
|
||||||
config = mkIf (elem "website" services) {
|
config = mkIf (elem "website" services) {
|
||||||
ooknet.server.webserver.caddy.enable = true;
|
users.groups.www = {};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d /var/www 0775 caddy www"
|
"d /var/www 0775 caddy www"
|
||||||
"d /var/www/ooknet.org 0775 caddy www"
|
"d /var/www/ooknet.org 0775 caddy www"
|
||||||
|
|
@ -39,29 +40,34 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
# using caddy because it makes my life easy
|
# using caddy because it makes my life easy
|
||||||
services.caddy.virtualHosts = {
|
services.caddy = {
|
||||||
"ooknet.org".extraConfig =
|
enable = true;
|
||||||
# sh
|
group = "www";
|
||||||
''
|
|
||||||
encode zstd gzip
|
|
||||||
|
|
||||||
header {
|
virtualHosts = {
|
||||||
Strict-Transport-Security "max-age=31536000;"
|
"ooknet.org".extraConfig =
|
||||||
X-XSS-Protection "1; mode=block"
|
# sh
|
||||||
X-Frame-Options "DENY"
|
''
|
||||||
X-Content-Type-Options "nosniff"
|
encode zstd gzip
|
||||||
-Server
|
|
||||||
|
header {
|
||||||
|
Strict-Transport-Security "max-age=31536000;"
|
||||||
|
X-XSS-Protection "1; mode=block"
|
||||||
|
X-Frame-Options "DENY"
|
||||||
|
X-Content-Type-Options "nosniff"
|
||||||
|
-Server
|
||||||
|
|
||||||
|
|
||||||
Referrer-Policy: no-referrer
|
Referrer-Policy: no-referrer
|
||||||
}
|
}
|
||||||
|
|
||||||
root * /var/www/ooknet.org/
|
root * /var/www/ooknet.org/
|
||||||
file_server
|
file_server
|
||||||
|
'';
|
||||||
|
"www.ooknet.org".extraConfig = ''
|
||||||
|
redir https://ooknet.org{uri}
|
||||||
'';
|
'';
|
||||||
"www.ooknet.org".extraConfig = ''
|
};
|
||||||
redir https://ooknet.org{uri}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
inherit (lib) mkIf;
|
|
||||||
inherit (config.ooknet.server.webserver) caddy;
|
|
||||||
in {
|
|
||||||
config = mkIf caddy.enable {
|
|
||||||
users.groups.www = {};
|
|
||||||
services.caddy = {
|
|
||||||
enable = true;
|
|
||||||
group = "www";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -10,10 +10,9 @@ in {
|
||||||
inherit withSystem;
|
inherit withSystem;
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
hostname = "ooknode";
|
hostname = "ooknode";
|
||||||
domain = "ooknet.org";
|
|
||||||
type = "vm";
|
type = "vm";
|
||||||
profile = "linode";
|
profile = "linode";
|
||||||
services = ["website" "forgejo"];
|
services = ["website"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,6 @@
|
||||||
type,
|
type,
|
||||||
profile,
|
profile,
|
||||||
services,
|
services,
|
||||||
domain ? "",
|
|
||||||
additionalModules ? [],
|
additionalModules ? [],
|
||||||
specialArgs ? {},
|
specialArgs ? {},
|
||||||
}:
|
}:
|
||||||
|
|
@ -99,7 +98,7 @@
|
||||||
additionalModules = concatLists [
|
additionalModules = concatLists [
|
||||||
(singleton {
|
(singleton {
|
||||||
ooknet.server = {
|
ooknet.server = {
|
||||||
inherit domain services;
|
inherit services;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
core
|
core
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -5,5 +5,4 @@ in {
|
||||||
"tailscale-auth.age".publicKeys = [users.ooks] ++ workstations;
|
"tailscale-auth.age".publicKeys = [users.ooks] ++ workstations;
|
||||||
"github_key.age".publicKeys = [users.ooks] ++ workstations;
|
"github_key.age".publicKeys = [users.ooks] ++ workstations;
|
||||||
"spotify_key.age".publicKeys = [users.ooks] ++ workstations;
|
"spotify_key.age".publicKeys = [users.ooks] ++ workstations;
|
||||||
"ooknet_org.age".publicKeys = [users.ooks] ++ workstations;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue