refactoring for isServer and isWorkstation: part 5 (final?)
This commit is contained in:
parent
a52ca12286
commit
037d68a9d4
44 changed files with 120 additions and 115 deletions
|
|
@ -1,20 +0,0 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
services = {
|
||||
changedetection-io = {
|
||||
enable = true;
|
||||
behindProxy = true;
|
||||
datastorePath = "/data/changedetection";
|
||||
port = lib.toInt "${config.ports.changedetection-io}";
|
||||
baseURL = "https://detect.baduhai.dev";
|
||||
};
|
||||
|
||||
nginx.virtualHosts."detect.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://127.0.0.1:${config.ports.changedetection-io}";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
virtualisation.oci-containers.containers."cinny" = {
|
||||
image = "ghcr.io/cinnyapp/cinny:latest";
|
||||
ports = [ "${config.ports.cinny}:80" ];
|
||||
environment = {
|
||||
TZ = "America/Bahia";
|
||||
};
|
||||
volumes = [ "/data/matrix/cinny-config.json:/app/config.json" ];
|
||||
extraOptions = [
|
||||
"--pull=newer"
|
||||
"--label=io.containers.autoupdate=registry"
|
||||
];
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."matrix.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://127.0.0.1:${config.ports.cinny}";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
mkStringOption =
|
||||
default:
|
||||
lib.mkOption {
|
||||
inherit default;
|
||||
type = lib.types.str;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
./changedetection.nix
|
||||
./cinny.nix
|
||||
./forgejo.nix
|
||||
./hardware-configuration.nix
|
||||
./jellyfin.nix
|
||||
./librespeed.nix
|
||||
./memos.nix
|
||||
./minecraft.nix
|
||||
./nextcloud.nix
|
||||
./nginx.nix
|
||||
./paperless.nix
|
||||
./searx.nix
|
||||
./services.nix
|
||||
./users.nix
|
||||
./vaultwarden.nix
|
||||
];
|
||||
|
||||
options.ports = {
|
||||
bazaar = mkStringOption "6767";
|
||||
radarr = mkStringOption "7878";
|
||||
vaultwarden = mkStringOption "8000";
|
||||
changedetection-io = mkStringOption "8001";
|
||||
cinny = mkStringOption "8002";
|
||||
librespeed = mkStringOption "8003";
|
||||
paperless = mkStringOption "8004";
|
||||
yousable = mkStringOption "8005";
|
||||
cinny2 = mkStringOption "8006";
|
||||
searx = mkStringOption "8007";
|
||||
qbittorrent = mkStringOption "8008";
|
||||
actual = mkStringOption "8009";
|
||||
memos = mkStringOption "8010";
|
||||
collabora = mkStringOption "8011";
|
||||
jellyfin = mkStringOption "8096";
|
||||
sonarr = mkStringOption "8989";
|
||||
jackett = mkStringOption "9117";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
let
|
||||
domain = "git.baduhai.dev";
|
||||
in
|
||||
|
||||
{
|
||||
services = {
|
||||
forgejo = {
|
||||
enable = true;
|
||||
repositoryRoot = "/data/forgejo";
|
||||
settings = {
|
||||
session.COOKIE_SECURE = true;
|
||||
server = {
|
||||
PROTOCOL = "http+unix";
|
||||
DOMAIN = domain;
|
||||
ROOT_URL = "https://${domain}";
|
||||
OFFLINE_MODE = true; # disable use of CDNs
|
||||
SSH_DOMAIN = "baduhai.dev";
|
||||
};
|
||||
log.LEVEL = "Warn";
|
||||
mailer.ENABLED = false;
|
||||
actions.ENABLED = false;
|
||||
};
|
||||
};
|
||||
nginx.virtualHosts.${domain} = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://unix:${config.services.forgejo.settings.server.HTTP_ADDR}:/";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||
|
||||
boot = {
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"sd_mod"
|
||||
];
|
||||
kernelModules = [ ];
|
||||
};
|
||||
kernelModules = [ "kvm-intel" ];
|
||||
extraModulePackages = [ ];
|
||||
};
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/31289617-1d84-4432-a833-680b52e88525";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-uuid/4130-BE54";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
services = {
|
||||
jellyfin = {
|
||||
enable = true;
|
||||
user = "user";
|
||||
group = "hosted";
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
nginx.virtualHosts."jellyfin.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://127.0.0.1:${config.ports.jellyfin}";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
virtualisation.oci-containers.containers."librespeed" = {
|
||||
image = "lscr.io/linuxserver/librespeed:latest";
|
||||
environment = {
|
||||
TZ = "America/Bahia";
|
||||
};
|
||||
ports = [ "${config.ports.librespeed}:80" ];
|
||||
extraOptions = [
|
||||
"--pull=newer"
|
||||
"--label=io.containers.autoupdate=registry"
|
||||
];
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."speed.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://127.0.0.1:${config.ports.librespeed}";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
virtualisation.oci-containers.containers."memos" = {
|
||||
image = "docker.io/neosmemo/memos:stable";
|
||||
ports = [ "${config.ports.memos}:5230" ];
|
||||
environment = {
|
||||
TZ = "America/Bahia";
|
||||
};
|
||||
volumes = [ "/data/memos/:/var/opt/memos" ];
|
||||
extraOptions = [
|
||||
"--pull=newer"
|
||||
"--label=io.containers.autoupdate=registry"
|
||||
];
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts."notes.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://127.0.0.1:${config.ports.memos}";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.minecraft-servers = {
|
||||
enable = true;
|
||||
eula = true;
|
||||
dataDir = "/data/minecraft";
|
||||
servers."kingdomcums" = {
|
||||
enable = true;
|
||||
package = pkgs.fabricServers.fabric-1_20_1;
|
||||
openFirewall = true;
|
||||
serverProperties = {
|
||||
difficulty = "normal";
|
||||
gamemode = "survival";
|
||||
motd = "Kingdom Cums";
|
||||
online-mode = false;
|
||||
spawn-protection = false;
|
||||
};
|
||||
symlinks."mods" = pkgs.linkFarmFromDrvs "mods" (
|
||||
builtins.attrValues {
|
||||
villagerNames = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/gqRXDo8B/versions/rzXhJ2pH/villagernames-1.20.1-8.1.jar";
|
||||
sha256 = "0hcbbp3zi3nnr12kian9l645f22jr7495bcrlbng46nxp9h08pg5";
|
||||
};
|
||||
lithium = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/ZSNsJrPI/lithium-fabric-mc1.20.1-0.11.2.jar";
|
||||
sha256 = "1ycdvrs46bbdxsa6i38sfx70v47nvzzbmblfpy3hq3k8blsrbid0";
|
||||
};
|
||||
lootr = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/EltpO5cN/versions/fqmzdpE2/lootr-fabric-1.20-0.7.33.81.jar";
|
||||
sha256 = "0db0472rb07nbc9i925qp3n7s7nmrq6q3alhprflgc9gqg0j0f14";
|
||||
};
|
||||
malilib = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/GcWjdA9I/versions/V7yLDtJV/malilib-fabric-1.20.1-0.16.3.jar";
|
||||
sha256 = "129m1jnk58p0wid5fmagqx13wp6pw4gja01yx14aljdxgzr8kqas";
|
||||
};
|
||||
immersivePaintings = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/6txNkua3/versions/UjL11A4h/immersive_paintings-0.6.7%2B1.20.1-fabric.jar";
|
||||
sha256 = "1di9a67q372z6lplnsa1kmh86armya83mimn61c8ai7izjlsfnid";
|
||||
};
|
||||
entityCulling = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/NNAgCjsB/versions/mahLIqpj/entityculling-fabric-1.6.7-mc1.20.1.jar";
|
||||
sha256 = "01iz8rgljgzl0d8gcwpmr6wcvv3b0cf1siggp3dn8q5hv9przk9k";
|
||||
};
|
||||
fabricAPI = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/P7uGFii0/fabric-api-0.92.2%2B1.20.1.jar";
|
||||
sha256 = "1z3hcxng2p9ymph1c0k729vxxaasi34n6fcdsqwx0wsmqi2gh025";
|
||||
};
|
||||
fallingTree = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/Fb4jn8m6/versions/NrtzFkZE/FallingTree-1.20.1-4.3.4.jar";
|
||||
sha256 = "0sfv2laxzgmkhmr0kizi7g09r6fkccjhj9p5j0viqywnwx02r7fs";
|
||||
};
|
||||
carryOn = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/joEfVgkn/versions/Mkla4B3q/carryon-fabric-1.20.1-2.1.2.7.jar";
|
||||
sha256 = "1pgbqrjrxw7bgwn6phpywgpjfmf5h341ba93j76ibk649wbgn9cd";
|
||||
};
|
||||
collective = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/e0M1UDsY/versions/jo7YkyNS/collective-1.20.1-7.84.jar";
|
||||
sha256 = "01qvaqmd5kmxq7sins6703xq5ckc47qs5kd62gnjyfq1dbjp2y2b";
|
||||
};
|
||||
dynamicLights = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/7YjclEGc/versions/eU6PA0pr/dynamiclights-v1.8.3-mc1.17x-1.21x-mod.jar";
|
||||
sha256 = "0vdv525gis1vj514iqh4rbl6byp7k0ls3lsyj0c3db8g58d784gm";
|
||||
};
|
||||
appleSkin = pkgs.fetchurl {
|
||||
url = "https://cdn.modrinth.com/data/EsAfCjCV/versions/xcauwnEB/appleskin-fabric-mc1.20.1-2.5.1.jar";
|
||||
sha256 = "1d9qmzjlk763ycmizqpmhcq0hhqw9j8hij6xk8p8l11ljr13mql5";
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
services = {
|
||||
nextcloud = {
|
||||
enable = true;
|
||||
package = pkgs.nextcloud30;
|
||||
datadir = "/data/nextcloud";
|
||||
hostName = "cloud.baduhai.dev";
|
||||
configureRedis = true;
|
||||
https = true;
|
||||
autoUpdateApps.enable = true;
|
||||
secretFile = config.age.secrets."nextcloud-secrets.json".path;
|
||||
database.createLocally = true;
|
||||
maxUploadSize = "16G";
|
||||
caching = {
|
||||
apcu = true;
|
||||
redis = true;
|
||||
};
|
||||
settings = {
|
||||
trusted_proxies = [ "127.0.0.1" ];
|
||||
default_phone_region = "BR";
|
||||
maintenance_window_start = "4";
|
||||
enabledPreviewProviders = [
|
||||
"OC\\Preview\\BMP"
|
||||
"OC\\Preview\\EMF"
|
||||
"OC\\Preview\\Font"
|
||||
"OC\\Preview\\GIF"
|
||||
"OC\\Preview\\HEIC"
|
||||
"OC\\Preview\\Illustrator"
|
||||
"OC\\Preview\\JPEG"
|
||||
"OC\\Preview\\Krita"
|
||||
"OC\\Preview\\MarkDown"
|
||||
"OC\\Preview\\Movie"
|
||||
"OC\\Preview\\MP3"
|
||||
"OC\\Preview\\MSOffice2003"
|
||||
"OC\\Preview\\MSOffice2007"
|
||||
"OC\\Preview\\MSOfficeDoc"
|
||||
"OC\\Preview\\OpenDocument"
|
||||
"OC\\Preview\\PDF"
|
||||
"OC\\Preview\\Photoshop"
|
||||
"OC\\Preview\\PNG"
|
||||
"OC\\Preview\\Postscript"
|
||||
"OC\\Preview\\SVG"
|
||||
"OC\\Preview\\TIFF"
|
||||
"OC\\Preview\\TXT"
|
||||
"OC\\Preview\\XBitmap"
|
||||
];
|
||||
};
|
||||
config = {
|
||||
dbtype = "pgsql";
|
||||
adminpassFile = config.age.secrets.nextcloud-adminpass.path;
|
||||
};
|
||||
phpOptions = {
|
||||
"opcache.interned_strings_buffer" = "16";
|
||||
};
|
||||
};
|
||||
|
||||
collabora-online = {
|
||||
enable = true;
|
||||
port = lib.strings.toInt config.ports.collabora;
|
||||
settings.ssl = {
|
||||
enable = false;
|
||||
termination = true;
|
||||
};
|
||||
};
|
||||
|
||||
nginx.virtualHosts = {
|
||||
${config.services.nextcloud.hostName} = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
};
|
||||
"office.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:${config.ports.collabora}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
age.secrets = {
|
||||
"nextcloud-secrets.json" = {
|
||||
file = ../../../secrets/nextcloud-secrets.json.age;
|
||||
owner = "nextcloud";
|
||||
group = "hosted";
|
||||
};
|
||||
nextcloud-adminpass = {
|
||||
file = ../../../secrets/nextcloud-adminpass.age;
|
||||
owner = "nextcloud";
|
||||
group = "hosted";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
group = "hosted";
|
||||
recommendedGzipSettings = true;
|
||||
recommendedOptimisation = true;
|
||||
recommendedProxySettings = true;
|
||||
recommendedTlsSettings = true;
|
||||
};
|
||||
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults = {
|
||||
email = "baduhai@proton.me";
|
||||
dnsResolver = "1.1.1.1:53";
|
||||
dnsProvider = "cloudflare";
|
||||
credentialsFile = config.age.secrets.cloudflare.path;
|
||||
};
|
||||
certs."baduhai.dev" = {
|
||||
extraDomainNames = [ "*.baduhai.dev" ];
|
||||
};
|
||||
};
|
||||
|
||||
boot.kernel.sysctl = {
|
||||
"net.ipv4.ip_forward" = 1;
|
||||
"net.ipv6.conf.all.forwarding" = 1;
|
||||
};
|
||||
|
||||
age.secrets.cloudflare = {
|
||||
file = ../../../secrets/cloudflare.age;
|
||||
owner = "nginx";
|
||||
group = "hosted";
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
services = {
|
||||
paperless = {
|
||||
enable = true;
|
||||
dataDir = "/data/paperless/data";
|
||||
mediaDir = "/data/paperless/media";
|
||||
passwordFile = config.age.secrets.paperless.path;
|
||||
port = lib.toInt "${config.ports.paperless}";
|
||||
consumptionDirIsPublic = true;
|
||||
settings = {
|
||||
PAPERLESS_OCR_LANGUAGE = "eng+por+deu";
|
||||
};
|
||||
};
|
||||
|
||||
nginx.virtualHosts."docs.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://127.0.0.1:${config.ports.paperless}";
|
||||
};
|
||||
};
|
||||
|
||||
age.secrets.paperless = {
|
||||
file = ../../../secrets/paperless.age;
|
||||
owner = "paperless";
|
||||
group = "hosted";
|
||||
};
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
services = {
|
||||
searx = {
|
||||
enable = true;
|
||||
package = pkgs.searxng;
|
||||
settings.server = {
|
||||
port = lib.toInt "${config.ports.searx}";
|
||||
bind_address = "0.0.0.0";
|
||||
secret_key = "&yEf!xLA@y3FdJ5BjKnUnNAkqer$iW!9";
|
||||
method = "GET";
|
||||
};
|
||||
};
|
||||
|
||||
nginx.virtualHosts."search.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://127.0.0.1:${config.ports.searx}";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.postgresql.enable = true;
|
||||
|
||||
# TODO: remove when bug fix
|
||||
# serokell/deploy-rs/issues/57
|
||||
# NixOS/nixpkgs/issues/180175
|
||||
# Workaround for upstream bug in NetworkManager-wait-online.service
|
||||
systemd.services.NetworkManager-wait-online.enable = false;
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
users = {
|
||||
users = {
|
||||
nginx.extraGroups = [ "acme" ];
|
||||
};
|
||||
groups = {
|
||||
hosted = {
|
||||
gid = 1005;
|
||||
members = [
|
||||
"user"
|
||||
"minecraft"
|
||||
"paperless"
|
||||
"vaultwarden"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
services = {
|
||||
vaultwarden = {
|
||||
enable = true;
|
||||
config = {
|
||||
DOMAIN = "https://pass.baduhai.dev";
|
||||
SIGNUPS_ALLOWED = true;
|
||||
ROCKET_ADDRESS = "127.0.0.1";
|
||||
ROCKET_PORT = "${config.ports.vaultwarden}";
|
||||
};
|
||||
};
|
||||
|
||||
nginx.virtualHosts."pass.baduhai.dev" = {
|
||||
useACMEHost = "baduhai.dev";
|
||||
forceSSL = true;
|
||||
kTLS = true;
|
||||
locations."/".proxyPass = "http://127.0.0.1:${config.ports.vaultwarden}";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue