diff options
| author | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-01-08 09:44:54 -0600 |
|---|---|---|
| committer | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-01-08 09:44:54 -0600 |
| commit | 2702decc9470cf0f553eb957145bdcda9e95e0bc (patch) | |
| tree | 5e49fadf94dfd39a766135efc9013851ef3e04f2 /modules/services/options.nix | |
| parent | 5474e411f4898b00014c1599bec4d26eb2741ad1 (diff) | |
clean up networking and selfhosted apps configuration
Diffstat (limited to 'modules/services/options.nix')
| -rw-r--r-- | modules/services/options.nix | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/modules/services/options.nix b/modules/services/options.nix index 072d970..f42dd12 100644 --- a/modules/services/options.nix +++ b/modules/services/options.nix @@ -4,13 +4,13 @@ ... }: let inherit (lib) mkOption mkEnableOption; + + ip_addr = lib.types.strMatching "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$"; + ip_addr_cidr = lib.types.strMatching "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])/(3[0-2]|[12]?[0-9])$"; in { options = { collinux.services = { - networking = let - ip_addr = lib.types.strMatching "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$"; - ip_addr_cidr = lib.types.strMatching "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])/(3[0-2]|[12]?[0-9])$"; - in { + networking = { enable = mkEnableOption "wifi"; iwd.enable = mkEnableOption "lightweight wifi daemon"; @@ -45,16 +45,42 @@ in { bluetuith.enable = mkEnableOption "terminal bluetooth manager"; }; - selfhost = { - navidrome = { - enable = mkEnableOption "navidrome music server"; - user = mkOption { - description = "user to run the service as"; - default = config.collinux.user.name; + selfhost = let + selfhostOptions = { + service_name, + default_port ? null, + ... + }: { + enable = mkEnableOption ""; + bind_host = mkOption { + type = ip_addr; + default = + if config.collinux.services.networking.tailscale.enable + then "100.69.160.89" + else "0.0.0.0"; + }; + port = mkOption { + type = lib.types.port; + default = default_port; }; + + root_url = mkOption { + type = lib.types.str; + default = + if config.collinux.services.networking.tailscale.enable + then "https://${service_name}.tail7cca06.ts.net" + else null; + }; + }; + in { + adguard = selfhostOptions { + service_name = "adguard"; + default_port = 8001; + }; + forgejo = selfhostOptions { + service_name = "forgejo"; + default_port = 8010; }; - adguard.enable = mkEnableOption "AdGuardHome network-wide adblocking"; - forgejo.enable = mkEnableOption "Forgejo self-hosted git server"; caddy = { enable = mkEnableOption "caddy https server"; envFile = mkOption { |
