made services in defiant configurable

This commit is contained in:
Leyla Becker 2024-09-21 12:52:44 -05:00
parent a0e047db97
commit e3990cb6d2
3 changed files with 157 additions and 120 deletions

View file

@ -38,8 +38,6 @@ set up git configuration for local development: `git config --local include.path
## Tech Debt ## Tech Debt
- allowUnfree should be enabled user side not host side (this isn't enabled at all right now for some reason???) - allowUnfree should be enabled user side not host side (this isn't enabled at all right now for some reason???)
- move services from defiant into own flake
- made base domain in nas services configurable
- vscode extensions should be in own flake (make sure to add the nixpkgs.overlays in it too) - vscode extensions should be in own flake (make sure to add the nixpkgs.overlays in it too)
- server service system users should also be on local systems for file permission reasons - server service system users should also be on local systems for file permission reasons
## New Features ## New Features

View file

@ -1,4 +1,5 @@
{ {
lib,
config, config,
pkgs, pkgs,
... ...
@ -7,6 +8,44 @@
../common ../common
]; ];
options = {
domains = {
base_domain = lib.mkOption { type = lib.types.str; };
headscale = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that headscale will be hosted at";
default = "headscale";
};
};
jellyfin = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that jellyfin will be hosted at";
default = "jellyfin";
};
hostname = lib.mkOption {
type = lib.types.str;
description = "hosname that jellyfin will be hosted at";
default = "${config.domains.jellyfin.subdomain}.${config.domains.base_domain}";
};
};
forgejo = {
subdomain = lib.mkOption {
type = lib.types.str;
description = "subdomain of base domain that foregjo will be hosted at";
default = "forgejo";
};
hostname = lib.mkOption {
type = lib.types.str;
description = "hosname that forgejo will be hosted at";
default = "${config.domains.forgejo.subdomain}.${config.domains.base_domain}";
};
};
};
};
config = {
users = { users = {
groups = { groups = {
jellyfin_media = { jellyfin_media = {
@ -46,11 +85,7 @@
# "d /home/forgejo/data 750 forgejo forgejo -" # "d /home/forgejo/data 750 forgejo forgejo -"
]; ];
services = let services = {
jellyfinDomain = "jellyfin.jan-leila.com";
headscaleDomain = "headscale.jan-leila.com";
# forgejoDomain = "forgejo.jan-leila.com";
in {
nfs.server = { nfs.server = {
enable = true; enable = true;
exports = '' exports = ''
@ -66,8 +101,8 @@
address = "0.0.0.0"; address = "0.0.0.0";
port = 8080; port = 8080;
settings = { settings = {
server_url = "https://${headscaleDomain}"; server_url = "${config.domains.headscale.subdomain}.${config.domains.base_domain}";
dns_config.base_domain = "jan-leila.com"; dns_config.base_domain = config.domains.base_domain;
logtail.enabled = false; logtail.enabled = false;
}; };
}; };
@ -78,7 +113,6 @@
group = "jellyfin"; group = "jellyfin";
dataDir = "/home/jellyfin/config"; # location on existing server: /home/docker/jellyfin/config dataDir = "/home/jellyfin/config"; # location on existing server: /home/docker/jellyfin/config
cacheDir = "/home/jellyfin/cache"; # location on existing server: /home/docker/jellyfin/cache cacheDir = "/home/jellyfin/cache"; # location on existing server: /home/docker/jellyfin/cache
openFirewall = false;
}; };
# TODO: figure out what needs to be here # TODO: figure out what needs to be here
@ -98,7 +132,7 @@
nginx = { nginx = {
enable = false; # TODO: enable this when you want to test all the configs enable = false; # TODO: enable this when you want to test all the configs
virtualHosts = { virtualHosts = {
${headscaleDomain} = { ${config.domains.headscale.hostname} = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/" = { locations."/" = {
@ -106,12 +140,12 @@
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };
${jellyfinDomain} = { ${config.domains.jellyfin.hostname} = {
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/".proxyPass = "http://localhost:8096"; locations."/".proxyPass = "http://localhost:8096";
}; };
# ${forgejoDomain} = { # ${config.domains.forgejo.hostname} = {
# forceSSL = true; # forceSSL = true;
# enableACME = true; # enableACME = true;
# locations."/".proxyPass = "http://localhost:${toString config.services.forgejo.settings.server.HTTP_PORT}"; # locations."/".proxyPass = "http://localhost:${toString config.services.forgejo.settings.server.HTTP_PORT}";
@ -141,4 +175,5 @@
pkgs.jellyfin-web pkgs.jellyfin-web
pkgs.jellyfin-ffmpeg pkgs.jellyfin-ffmpeg
]; ];
};
} }

View file

@ -25,6 +25,10 @@
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
domains = {
base_domain = "jan-leila.com";
};
services = { services = {
zfs = { zfs = {
autoScrub.enable = true; autoScrub.enable = true;