aboutsummaryrefslogtreecommitdiff
path: root/modules/services/nixos/selfhost
diff options
context:
space:
mode:
authorCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-01-29 20:15:19 -0600
committerCollin Williams <96917990+bluedragon1221@users.noreply.github.com>2026-01-30 08:38:21 -0600
commitc9a1d2da80bca0a85e8c18f6d2db71c4d1127eda (patch)
tree9da79e318ff0533a3708aee85a0b6a6d7f1d1036 /modules/services/nixos/selfhost
parentc81952cbcb6c6f1b41c2b6e2a366891991cceaee (diff)
Spring Cleaning
- create new module, `system`, that consumes the `boot` module and takes in the more system-interested services from the `services` module - touch up left over services (which are more self-hosting interested) - touch up yo and yoshi configs
Diffstat (limited to 'modules/services/nixos/selfhost')
-rw-r--r--modules/services/nixos/selfhost/adguard.nix47
-rw-r--r--modules/services/nixos/selfhost/caddy.nix28
-rw-r--r--modules/services/nixos/selfhost/default.nix8
-rw-r--r--modules/services/nixos/selfhost/forgejo.nix54
-rw-r--r--modules/services/nixos/selfhost/headscale.nix75
-rw-r--r--modules/services/nixos/selfhost/jellyfin.nix20
-rw-r--r--modules/services/nixos/selfhost/navidrome.nix19
7 files changed, 0 insertions, 251 deletions
diff --git a/modules/services/nixos/selfhost/adguard.nix b/modules/services/nixos/selfhost/adguard.nix
deleted file mode 100644
index 69fb8a4..0000000
--- a/modules/services/nixos/selfhost/adguard.nix
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- config,
- lib,
- ...
-}: let
- cfg = config.collinux.services.selfhost.adguard;
-in
- lib.mkIf cfg.enable {
- services.adguardhome = {
- enable = true;
- port = cfg.port;
- mutableSettings = true;
- settings = {
- http = {
- pprof.enabled = false;
- address = "localhost:${toString cfg.port}";
- };
- users = []; # disable auth (only accessable over tailscale anyway)
- dns = {
- bind_hosts = ["127.0.0.1" cfg.bind_host];
- upstream_dns = ["https://dns.quad9.net/dns-query"];
- enable_dnssec = true;
- };
- tls.enabled = false;
- dhcp.enabled = false;
- };
- };
-
- # disable systemd-resolved (https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ#bindinuse)
- services.resolved.extraConfig = lib.mkIf config.services.resolved.enable ''
- DNS=127.0.0.1
- DNSStubListener=no
- '';
-
- services.tailscale.extraSetFlags = lib.optional config.collinux.services.networking.tailscale.enable "--accept-dns=false"; # would create an infinite loop of dns lookups
-
- services.caddy = lib.mkIf cfg.caddy.enable {
- virtualHosts.${cfg.root_url}.extraConfig = ''
- ${
- if cfg.caddy.bind_tailscale
- then "bind tailscale/${cfg.service_name}"
- else ""
- }
- reverse_proxy ${cfg.bind_host}:${toString cfg.port}
- '';
- };
- }
diff --git a/modules/services/nixos/selfhost/caddy.nix b/modules/services/nixos/selfhost/caddy.nix
deleted file mode 100644
index f625f62..0000000
--- a/modules/services/nixos/selfhost/caddy.nix
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- pkgs,
- lib,
- config,
- ...
-}: let
- cfg = config.collinux.services.selfhost.caddy;
-in
- lib.mkIf cfg.enable (lib.mkMerge [
- {
- services.caddy = {
- enable = true;
- environmentFile = cfg.envFile;
- };
- networking.firewall.allowedTCPPorts = [80 443];
- environment.systemPackages = with pkgs; [nss]; # required for caddy https stuff
- }
- (lib.mkIf config.collinux.services.networking.tailscale.enable {
- services.caddy = {
- package = pkgs.caddy.withPlugins {
- plugins = [
- "github.com/tailscale/caddy-tailscale@v0.0.0-20251204171825-f070d146dd61"
- ];
- hash = "sha256-cK7C5ISsTwX0FMf891s/Vr22JvRqYEC8GkLfP1L1Mus=";
- };
- };
- })
- ])
diff --git a/modules/services/nixos/selfhost/default.nix b/modules/services/nixos/selfhost/default.nix
deleted file mode 100644
index de1078b..0000000
--- a/modules/services/nixos/selfhost/default.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- imports = [
- ./adguard.nix
- ./forgejo.nix
- ./headscale.nix
- ./caddy.nix
- ];
-}
diff --git a/modules/services/nixos/selfhost/forgejo.nix b/modules/services/nixos/selfhost/forgejo.nix
deleted file mode 100644
index 1b02628..0000000
--- a/modules/services/nixos/selfhost/forgejo.nix
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- lib,
- config,
- ...
-}: let
- cfg = config.collinux.services.selfhost.forgejo;
-in
- lib.mkIf cfg.enable {
- services.forgejo = {
- enable = true;
- database.type = "sqlite3";
- settings = {
- server = {
- DOMAIN = "localhost";
- ROOT_URL = cfg.root_url;
- HTTP_PORT = cfg.port;
-
- # ssh
- START_SSH_SERVER = true; # use builtin ssh server
- BUILTIN_SSH_SERVER_USER = "git";
- SSH_DOMAIN = "ganymede";
- SSH_PORT = 2225; # don't conflict with system ssh
- SSH_LISTEN_HOST = cfg.bind_host;
- SSH_LISTEN_PORT = 2225;
- };
- service = {
- DISABLE_REGISTRATION = false;
- ENABLE_REVERSE_PROXY_AUTHENTICATION = true;
- };
- repository = {
- # disable stuff
- DISABLE_MIGRATIONS = true;
- DISABLE_STARS = true;
- DISABLE_DOWNLOAD_SOURCE_ARCHIVES = true;
- };
- };
- };
-
- systemd.services."forgejo" = lib.mkIf config.collinux.services.networking.networkd.enable {
- after = lib.mkAfter ["network-online.target"];
- wants = lib.mkAfter ["network-online.target"];
- };
-
- services.caddy = lib.mkIf cfg.caddy.enable {
- virtualHosts.${cfg.root_url}.extraConfig = ''
- ${
- if cfg.caddy.bind_tailscale
- then "bind tailscale/${cfg.service_name}"
- else ""
- }
- reverse_proxy ${cfg.bind_host}:${toString cfg.port}
- '';
- };
- }
diff --git a/modules/services/nixos/selfhost/headscale.nix b/modules/services/nixos/selfhost/headscale.nix
deleted file mode 100644
index 2bdcca1..0000000
--- a/modules/services/nixos/selfhost/headscale.nix
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- config,
- pkgs,
- lib,
- ...
-}: let
- cfg = config.collinux.services.selfhost.headscale;
-
- acl_file = (pkgs.formats.json {}).generate "acl.json" {
- ssh = [
- {
- src = ["collin@"];
- dst = ["collin@"];
- users = ["autogroup:nonroot" "root"];
- action = "accept";
- }
- ];
- };
-in
- lib.mkIf cfg.enable {
- services.headscale = {
- enable = true;
- address = cfg.bind_host;
- port = cfg.port;
- settings = {
- server_url = "https://${cfg.root_url}";
-
- database.type = "sqlite";
-
- dns = {
- magic_dns = true;
- base_domain = "collinux.tailnet";
- override_local_dns = true;
- nameservers.global = ["9.9.9.9" "149.112.112.112" "2620:fe::fe" "2620:fe::9"];
- };
-
- policy.path = "${acl_file}";
-
- prefixes = {
- "v4" = "100.100.0.0/16";
- allocation = "random";
- };
-
- # leave tls for caddy to worry about
- tls_cert_path = null;
- tls_key_path = null;
-
- logtail.enabled = false;
- };
- };
-
- # make sure headscale can start before tailscale
- systemd.services."headscale" = lib.mkIf config.collinux.services.networking.tailscale.enable {
- after = lib.mkForce ["network.target"];
- before = lib.mkForce ["headscale.target"];
- wants = lib.mkForce ["network.target" "headscale.target"];
- };
-
- systemd.targets."headscale" = {
- description = "Target represents headscale is running. started by headscale.service";
- };
-
- environment.systemPackages = [pkgs.headscale];
-
- services.caddy = lib.mkIf cfg.caddy.enable {
- virtualHosts.${cfg.root_url}.extraConfig = ''
- ${
- if cfg.caddy.bind_tailscale
- then "bind tailscale/${cfg.service_name}"
- else ""
- }
- reverse_proxy ${cfg.bind_host}:${toString cfg.port}
- '';
- };
- }
diff --git a/modules/services/nixos/selfhost/jellyfin.nix b/modules/services/nixos/selfhost/jellyfin.nix
deleted file mode 100644
index 59ea473..0000000
--- a/modules/services/nixos/selfhost/jellyfin.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- config,
- lib,
- ...
-}: let
- cfg = config.collinux.services.selfhost.jellyfin;
-in
- lib.mkIf cfg.enable (lib.mkMerge [
- {
- services.jellyfin = {
- enable = true;
- };
- }
- # (lib.mkIf (with config.collinux.services; networking.tailscale.enable && selfhost.caddy.enable) {
- # services.caddy.virtualHosts."https://jellyfin.tail7cca06.ts.net".extraConfig = ''
- # bind tailscale/jellyfin
- # reverse_proxy localhost:${config.services.jellyfin.port}
- # '';
- # })
- ])
diff --git a/modules/services/nixos/selfhost/navidrome.nix b/modules/services/nixos/selfhost/navidrome.nix
deleted file mode 100644
index 5250b85..0000000
--- a/modules/services/nixos/selfhost/navidrome.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- config,
- lib,
- ...
-}: let
- cfg = config.collinux.services.selfhost.navidrome;
-in
- lib.mkIf cfg.enable {
- services.navidrome = {
- enable = true;
- inherit (cfg) user;
- settings = {
- Port = 4533;
- Address = "0.0.0.0";
- EnableInsightsCollector = false;
- MusicFolder = "/home/${cfg.user}/Music";
- };
- };
- }