diff options
author | tdback <tyler@tdback.net> | 2025-03-22 15:56:13 -0400 |
---|---|---|
committer | tdback <tyler@tdback.net> | 2025-03-22 15:56:13 -0400 |
commit | 99d725b51bda1dfe38cbee939f7d6ff215491084 (patch) | |
tree | 2370e19b812524d9765673431d9268d34558df2d | |
parent | f517b4789e6543f77958a143f302ce5d6b5a696e (diff) |
-rw-r--r-- | modules/customs/soft-serve/default.nix | 65 | ||||
-rw-r--r-- | modules/services/immich/default.nix | 55 | ||||
-rw-r--r-- | modules/services/llm/default.nix | 70 | ||||
-rw-r--r-- | modules/services/sftpgo/default.nix | 63 |
4 files changed, 0 insertions, 253 deletions
diff --git a/modules/customs/soft-serve/default.nix b/modules/customs/soft-serve/default.nix deleted file mode 100644 index 102ee1c..0000000 --- a/modules/customs/soft-serve/default.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.services.soft-serve; - cfgFile = format.generate "config.yaml" cfg.settings; - format = pkgs.formats.yaml { }; - dataDir = cfg.dataDir; - docUrl = "https://github.com/charmbracelet/soft-serve"; -in -{ - disabledModules = [ "services/misc/soft-serve.nix" ]; - - options = { - services.soft-serve = { - enable = mkEnableOption "soft-serve"; - package = mkPackageOption pkgs "soft-serve" { }; - dataDir = mkOption { - type = types.str; - default = "/var/lib/soft-serve"; - description = '' - The directory where soft-serve stores its data files. - ''; - }; - settings = mkOption { - type = format.type; - default = { }; - description = '' - soft-serve server configurations stored under your data directory. - See <${docUrl}>. - ''; - }; - }; - }; - - config = mkIf cfg.enable { - systemd.tmpfiles.rules = [ - "L+ ${dataDir}/config.yaml - - - - ${cfgFile}" - ]; - - systemd.services.soft-serve = { - description = "Soft Serve git server"; - documentation = [ docUrl ]; - requires = [ "network-online.target" ]; - after = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; - environment.SOFT_SERVE_DATA_PATH = dataDir; - serviceConfig = { - Type = "simple"; - Restart = "always"; - RestartSec = 1; - ExecStart = "${getExe cfg.package} serve"; - WorkingDirectory = dataDir; - }; - }; - - environment.systemPackages = with pkgs; [ - git - ]; - }; -} diff --git a/modules/services/immich/default.nix b/modules/services/immich/default.nix deleted file mode 100644 index 95da536..0000000 --- a/modules/services/immich/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.modules.services.immich; -in -{ - options.modules.services.immich = { - enable = mkEnableOption "immich"; - port = mkOption { - default = 2283; - type = types.int; - }; - url = mkOption { - default = null; - type = types.str; - }; - mediaDir = mkOption { - default = "/var/lib/immich"; - type = types.str; - }; - }; - - config = mkIf cfg.enable { - networking.firewall.allowedTCPPorts = mkIf (cfg.url != null) [ - 80 - 443 - ]; - - services.caddy = mkIf (cfg.url != null) { - enable = true; - virtualHosts = { - "photographs.brownbread.net".extraConfig = '' - encode zstd gzip - reverse_proxy http://localhost:${builtins.toString cfg.port} - ''; - }; - }; - - services.immich = { - enable = true; - package = pkgs.immich; - host = "localhost"; - port = cfg.port; - mediaLocation = cfg.mediaDir; - environment = { - IMMICH_LOG_LEVEL = "log"; - }; - }; - }; -} diff --git a/modules/services/llm/default.nix b/modules/services/llm/default.nix deleted file mode 100644 index e2e08a9..0000000 --- a/modules/services/llm/default.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; -let - cfg = config.modules.services.llm; -in -{ - options.modules.services.llm = { - enable = mkEnableOption "llm"; - port = mkOption { - default = 8080; - type = types.int; - description = "Which port the Open-WebUI server listens to."; - }; - subnet = mkOption { - default = null; - type = types.str; - description = "The network subnet allowed to acccess Open-WebUI and the ollama API"; - }; - nvidiaGpu = mkOption { - default = false; - type = types.bool; - description = "Use NVIDIA cuda for hardware acceleration."; - }; - models = mkOption { - default = [ ]; - type = types.listOf types.str; - description = "Automatically download these models."; - }; - }; - - config = mkIf cfg.enable { - services.ollama = { - enable = true; - acceleration = if cfg.nvidiaGpu then "cuda" else false; - loadModels = cfg.models; - }; - - services.open-webui = { - enable = true; - host = if cfg.subnet == null then "127.0.0.1" else "0.0.0.0"; - port = cfg.port; - }; - - # Only expose Open-WebUI and ollama API to the local network, since this - # server might have a public IPv6 address. - networking.firewall.extraCommands = - with config.services; - let - api = builtins.toString ollama.port; - web = builtins.toString open-webui.port; - in - mkIf (cfg.subnet != null) '' - iptables -A nixos-fw -p tcp --source ${cfg.subnet} --dport ${api}:${api} -j nixos-fw-accept - iptables -A nixos-fw -p tcp --source ${cfg.subnet} --dport ${web}:${web} -j nixos-fw-accept - ''; - - # Enable the proprietary NVIDIA drivers in a headless fashion. - hardware.graphics.enable = cfg.nvidiaGpu; - services.xserver.videoDrivers = mkIf cfg.nvidiaGpu [ "nvidia" ]; - hardware.nvidia = mkIf cfg.nvidiaGpu { - package = config.boot.kernelPackages.nvidiaPackages.stable; - open = false; - nvidiaPersistenced = true; - }; - }; -} diff --git a/modules/services/sftpgo/default.nix b/modules/services/sftpgo/default.nix deleted file mode 100644 index ae0af24..0000000 --- a/modules/services/sftpgo/default.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; -let - cfg = config.modules.services.sftpgo; -in -{ - options.modules.services.sftpgo = { - enable = mkEnableOption "sftpgo"; - port = mkOption { - default = 8080; - type = types.int; - }; - url = mkOption { - default = null; - type = types.str; - }; - dataDir = mkOption { - default = "/var/lib/sftpgo"; - type = types.str; - }; - }; - - config = - let - caddy = cfg.url != null; - in - mkIf cfg.enable { - networking.firewall.allowedTCPPorts = mkIf caddy [ - 80 - 443 - ]; - - services.caddy = mkIf caddy { - enable = true; - virtualHosts = { - ${cfg.url}.extraConfig = '' - root * /web/client - encode zstd gzip - reverse_proxy http://localhost:${builtins.toString cfg.port} - ''; - }; - }; - - services.sftpgo = { - enable = true; - package = pkgs.sftpgo; - dataDir = cfg.dataDir; - settings = { - httpd.bindings = lib.singleton { - port = cfg.port; - address = "0.0.0.0"; - enable_web_client = true; - enable_web_admin = true; - }; - }; - }; - }; -} |