diff --git a/hosts/homex/configuration.nix b/hosts/homex/configuration.nix old mode 100644 new mode 100755 index e4975e0..f123c80 --- a/hosts/homex/configuration.nix +++ b/hosts/homex/configuration.nix @@ -8,13 +8,13 @@ imports = [ ../../modules/nixos/systems/set-user.nix ../../modules/nixos/config/host.nix - ../../modules/nixos/homelab + ../../modules/server ./hardware-configuration.nix ./secrets.nix ./users ]; - homelab = { + server = { enable = true; flakeDir = "/home/guz/.nix#homex"; name = "homex"; @@ -46,7 +46,7 @@ forgejo = { enable = true; - settings.server.url = "https://${config.homelab.forgejo.settings.server.domain}"; + settings.server.url = "https://${config.server.forgejo.settings.server.domain}"; settings.users."user1" = { name = /. + config.sops.secrets."forgejo/user1/name".path; email = /. + config.sops.secrets."forgejo/user1/email".path; diff --git a/hosts/homex/secrets.nix b/hosts/homex/secrets.nix index 26ab6ff..4223648 100644 --- a/hosts/homex/secrets.nix +++ b/hosts/homex/secrets.nix @@ -7,13 +7,13 @@ sops.defaultSopsFormat = "yaml"; sops.secrets."forgejo/user1/name" = { - owner = config.homelab.forgejo.user; + owner = config.server.forgejo.user; }; sops.secrets."forgejo/user1/password" = { - owner = config.homelab.forgejo.user; + owner = config.server.forgejo.user; }; sops.secrets."forgejo/user1/email" = { - owner = config.homelab.forgejo.user; + owner = config.server.forgejo.user; }; /* diff --git a/modules/nixos/homelab/adguard.nix b/modules/server/adguard.nix similarity index 93% rename from modules/nixos/homelab/adguard.nix rename to modules/server/adguard.nix index 15d555d..084641d 100644 --- a/modules/nixos/homelab/adguard.nix +++ b/modules/server/adguard.nix @@ -1,11 +1,11 @@ { config, lib, ... }: let - cfg = config.homelab.adguard; + cfg = config.server.adguard; in { imports = [ ]; - options.homelab.adguard = with lib; with lib.types; { + options.server.adguard = with lib; with lib.types; { enable = mkEnableOption ""; extraArgs = mkOption { type = listOf str; @@ -13,7 +13,7 @@ in }; domain = mkOption { type = str; - default = "adguard." + config.homelab.domain; + default = "adguard." + config.server.domain; }; port = mkOption { type = port; diff --git a/modules/nixos/homelab/caddy.nix b/modules/server/caddy.nix similarity index 86% rename from modules/nixos/homelab/caddy.nix rename to modules/server/caddy.nix index 110d774..ca66e8c 100644 --- a/modules/nixos/homelab/caddy.nix +++ b/modules/server/caddy.nix @@ -1,11 +1,11 @@ { config, lib, ... }: let - cfg = config.homelab.caddy; + cfg = config.server.caddy; in { imports = [ ]; - options.homelab.caddy = with lib; with lib.types; { + options.server.caddy = with lib; with lib.types; { enable = mkEnableOption ""; settings = { virtualHosts = mkOption { diff --git a/modules/nixos/homelab/default.nix b/modules/server/default.nix similarity index 95% rename from modules/nixos/homelab/default.nix rename to modules/server/default.nix index f34afe6..86cd311 100644 --- a/modules/nixos/homelab/default.nix +++ b/modules/server/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: let - cfg = config.homelab; + cfg = config.server; homelab = pkgs.writeShellScriptBin "homelab" '' gum="${pkgs.gum}/bin/gum"; flakeDir="${toString cfg.flakeDir}"; @@ -33,7 +33,7 @@ in ./photoprism.nix ./tailscale.nix ]; - options.homelab = with lib; with lib.types; { + options.server = with lib; with lib.types; { enable = mkEnableOption ""; name = mkOption { type = str; @@ -76,7 +76,7 @@ in }; }; - homelab = with lib; mkIf cfg.handleDomains { + server = with lib; mkIf cfg.handleDomains { adguard = { enable = true; settings.dns.rewrites = (if hasPrefix "*." cfg.domain then { diff --git a/modules/nixos/homelab/forgejo.nix b/modules/server/forgejo.nix similarity index 97% rename from modules/nixos/homelab/forgejo.nix rename to modules/server/forgejo.nix index e4ea8a9..b97b330 100644 --- a/modules/nixos/homelab/forgejo.nix +++ b/modules/server/forgejo.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: let - cfg = config.homelab.forgejo; + cfg = config.server.forgejo; users = (builtins.attrValues (builtins.mapAttrs (username: info: { name = if isNull info.name then username else info.name; @@ -13,7 +13,7 @@ let in { imports = [ ]; - options.homelab.forgejo = with lib; with lib.types; { + options.server.forgejo = with lib; with lib.types; { enable = mkEnableOption ""; user = mkOption { type = str; @@ -29,7 +29,7 @@ in }; domain = mkOption { type = str; - default = "forgejo." + config.homelab.domain; + default = "forgejo." + config.server.domain; }; port = mkOption { type = port; @@ -38,7 +38,7 @@ in data = { root = mkOption { type = path; - default = config.homelab.storage + /forgejo; + default = config.server.storage + /forgejo; }; }; handleUndeclaredUsers = mkOption { diff --git a/modules/nixos/homelab/jellyfin.nix b/modules/server/jellyfin.nix similarity index 98% rename from modules/nixos/homelab/jellyfin.nix rename to modules/server/jellyfin.nix index 99dc3d2..581b728 100644 --- a/modules/nixos/homelab/jellyfin.nix +++ b/modules/server/jellyfin.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: let - cfg = config.homelab.jellyfin; + cfg = config.server.jellyfin; networkConfig = pkgs.writeTextFile { name = "network.json"; text = builtins.toJSON cfg.settings.network; @@ -19,7 +19,7 @@ in imports = [ ./jellyseerr.nix ]; - options.homelab.jellyfin = with lib; with lib.types; { + options.server.jellyfin = with lib; with lib.types; { enable = mkEnableOption ""; user = mkOption { type = str; @@ -31,7 +31,7 @@ in }; domain = mkOption { type = str; - default = "jellyfin." + config.homelab.domain; + default = "jellyfin." + config.server.domain; }; port = mkOption { type = port; @@ -40,7 +40,7 @@ in data = { root = mkOption { type = path; - default = config.homelab.storage + /jellyfin; + default = config.server.storage + /jellyfin; }; }; jellyseerr = mkOption { @@ -600,7 +600,7 @@ in openFirewall = true; }; - homelab.jellyseerr.enable = cfg.jellyseerr; + server.jellyseerr.enable = cfg.jellyseerr; systemd.services."homelab-jellyfin-config" = { script = '' diff --git a/modules/nixos/homelab/jellyseerr.nix b/modules/server/jellyseerr.nix similarity index 57% rename from modules/nixos/homelab/jellyseerr.nix rename to modules/server/jellyseerr.nix index 2368b41..d2222c2 100644 --- a/modules/nixos/homelab/jellyseerr.nix +++ b/modules/server/jellyseerr.nix @@ -1,19 +1,19 @@ -{ config, lib, pkgs, ... }: +{ config, lib, ... }: let - cfg = config.homelab.jellyseerr; + cfg = config.server.jellyseerr; in { imports = [ ]; - options.homelab.jellyseerr = with lib; with lib.types; { + options.server.jellyseerr = with lib; with lib.types; { enable = mkEnableOption ""; domain = mkOption { type = str; - default = "jellyseerr." + config.homelab.domain; + default = "jellyseerr." + config.server.domain; }; port = mkOption { type = port; - default = config.homelab.jellyfin.port + 10; + default = config.server.jellyfin.port + 10; }; }; config = lib.mkIf cfg.enable { diff --git a/modules/nixos/homelab/network.nix b/modules/server/network.nix similarity index 83% rename from modules/nixos/homelab/network.nix rename to modules/server/network.nix index 4d797c0..8264ffb 100644 --- a/modules/nixos/homelab/network.nix +++ b/modules/server/network.nix @@ -1,25 +1,25 @@ { config, lib, ... }: let - cfg = config.homelab.network; + cfg = config.server.network; in { imports = [ ]; - options.homelab.network = with lib; with lib.types; { + options.server.network = with lib; with lib.types; { enable = mkOption { type = bool; default = true; }; hostName = mkOption { type = str; - default = config.homelab.name; + default = config.server.name; }; interface = mkOption { type = str; }; localIp = mkOption { type = str; - default = config.homelab.localIp; + default = config.server.localIp; }; defaultGateway = mkOption { type = str; @@ -50,7 +50,7 @@ in }]; defaultGateway = cfg.defaultGateway; nameservers = [ - (if config.homelab.tailscale.enable then "100.100.100.100" else null) + (if config.server.tailscale.enable then "100.100.100.100" else null) ] ++ cfg.nameservers; }; diff --git a/modules/nixos/homelab/nextcloud.nix b/modules/server/nextcloud.nix similarity index 82% rename from modules/nixos/homelab/nextcloud.nix rename to modules/server/nextcloud.nix index 2faf932..0233817 100644 --- a/modules/nixos/homelab/nextcloud.nix +++ b/modules/server/nextcloud.nix @@ -1,11 +1,11 @@ { config, lib, pkgs, ... }: let - cfg = config.homelab.nextcloud; + cfg = config.server.nextcloud; in { imports = [ ]; - options.homelab.nextcloud = with lib; with lib.types; { + options.server.nextcloud = with lib; with lib.types; { enable = mkEnableOption ""; user = mkOption { type = str; @@ -17,7 +17,7 @@ in }; domain = mkOption { type = str; - default = "nextcloud." + config.homelab.domain; + default = "nextcloud." + config.server.domain; }; port = mkOption { type = port; @@ -26,7 +26,7 @@ in data = { root = mkOption { type = path; - default = config.homelab.storage + /nextcloud; + default = config.server.storage + /nextcloud; }; }; configureRedis = mkOption { @@ -55,7 +55,6 @@ in hostName = cfg.domain; https = true; package = cfg.package; - # phpPackage = pkgs.php; }; }; } diff --git a/modules/nixos/homelab/photoprism.nix b/modules/server/photoprism.nix similarity index 77% rename from modules/nixos/homelab/photoprism.nix rename to modules/server/photoprism.nix index 667dc65..0a1f600 100644 --- a/modules/nixos/homelab/photoprism.nix +++ b/modules/server/photoprism.nix @@ -1,11 +1,11 @@ -{ config, lib, pkgs, ... }: +{ config, lib, ... }: let - cfg = config.homelab.photoprism; + cfg = config.server.photoprism; in { imports = [ ]; - options.homelab.photoprism = with lib; with lib.types; { + options.server.photoprism = with lib; with lib.types; { enable = mkEnableOption ""; user = mkOption { type = str; @@ -13,7 +13,7 @@ in }; domain = mkOption { type = str; - default = "photoprism." + config.homelab.domain; + default = "photoprism." + config.server.domain; }; port = mkOption { type = port; diff --git a/modules/nixos/homelab/tailscale.nix b/modules/server/tailscale.nix similarity index 72% rename from modules/nixos/homelab/tailscale.nix rename to modules/server/tailscale.nix index e631f54..02fdeff 100644 --- a/modules/nixos/homelab/tailscale.nix +++ b/modules/server/tailscale.nix @@ -1,13 +1,13 @@ { config, lib, ... }: let - cfg = config.homelab.tailscale; + cfg = config.server.tailscale; in { imports = [ ./network.nix ]; - options.homelab.tailscale = with lib; with lib.types; { + options.server.tailscale = with lib; with lib.types; { enable = mkEnableOption ""; mode = mkOption { type = enum [ @@ -29,8 +29,7 @@ in useRoutingFeatures = cfg.mode; }; - homelab.network = lib.mkIf cfg.exitNode { portForwarding = lib.mkDefault true; }; - + server.network = lib.mkIf cfg.exitNode { portForwarding = lib.mkDefault true; }; }; }