From 7adfefae12ade1eb1f1d3258d74bfd259efe494f Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Tue, 11 Jun 2024 11:38:20 -0500 Subject: [PATCH] puter --- hosts/nas/configuration.nix | 2 ++ modules/apps/puter/default.nix | 30 ++++++++++++++++++++ modules/apps/puter/options.nix | 52 ++++++++++++++++++++++++++++++++++ modules/default.nix | 1 + 4 files changed, 85 insertions(+) create mode 100644 modules/apps/puter/default.nix create mode 100644 modules/apps/puter/options.nix diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix index ed2a1a7..acd523b 100644 --- a/hosts/nas/configuration.nix +++ b/hosts/nas/configuration.nix @@ -79,6 +79,8 @@ in orca-slicer.enable = true; + puter.enable = true; + vscode.enable = true; swag.enable = true; diff --git a/modules/apps/puter/default.nix b/modules/apps/puter/default.nix new file mode 100644 index 0000000..559887c --- /dev/null +++ b/modules/apps/puter/default.nix @@ -0,0 +1,30 @@ +{ + lib, + pkgs, + config, + ... +}: +with lib; +let + cfg = config.nas-apps.puter; +in +{ + imports = [ ./options.nix ]; + + config = mkIf cfg.enable { + virtualisation.oci-containers.containers."${cfg.name}" = { + autoStart = cfg.autoStart; + image = cfg.image; + ports = [ "${cfg.httpPort}:4100" ]; + volumes = [ + "${cfg.configPath}:/etc/puter" + "${cfg.dataPath}:/var/puter" + ]; + environment = { + PUID = cfg.puid; + PGID = cfg.pgid; + TZ = cfg.timeZone; + }; + }; + }; +} diff --git a/modules/apps/puter/options.nix b/modules/apps/puter/options.nix new file mode 100644 index 0000000..79739e3 --- /dev/null +++ b/modules/apps/puter/options.nix @@ -0,0 +1,52 @@ +{ lib, ... }: +with lib; +{ + options.nas-apps.puter = { + enable = mkEnableOption "puter docker service"; + + autoStart = mkOption { + type = types.bool; + default = true; + }; + + httpPort = mkOption { + type = types.str; + default = "4100"; + }; + + name = mkOption { + type = types.str; + default = "puter"; + }; + + image = mkOption { + type = types.str; + default = "ghcr.io/heyputer/puter"; + }; + + configPath = mkOption { + type = types.str; + default = "/home/admin/ssd/ssd_app_data/puter/config"; + }; + + dataPath = mkOption { + type = types.str; + default = "/home/admin/ssd/ssd_app_data/puter/data"; + }; + + puid = mkOption { + type = types.str; + default = "911"; + }; + + pgid = mkOption { + type = types.str; + default = "1000"; + }; + + timeZone = mkOption { + type = types.str; + default = "America/Chicago"; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix index 6325b06..90cbed4 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -15,6 +15,7 @@ ./apps/ollama ./apps/open-webui ./apps/orca-slicer + ./apps/puter ./apps/radarr ./apps/sabnzbd ./apps/sonarr