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
- 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)
- server service system users should also be on local systems for file permission reasons
## New Features

View file

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

View file

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