From cb14fc15fe62134cd52e2a3918873cbc7164efb6 Mon Sep 17 00:00:00 2001 From: Igor Rzegocki Date: Fri, 20 Dec 2024 20:41:18 +0100 Subject: [PATCH] feat: add wallos --- machines/deedee/configuration.nix | 1 + modules/system/containers/default.nix | 1 + modules/system/containers/wallos/default.nix | 71 ++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 modules/system/containers/wallos/default.nix diff --git a/machines/deedee/configuration.nix b/machines/deedee/configuration.nix index 57dead7..63132b5 100644 --- a/machines/deedee/configuration.nix +++ b/machines/deedee/configuration.nix @@ -287,6 +287,7 @@ rec { vaultwarden.enable = true; vikunja.enable = false; wakapi.enable = true; + wallos.enable = true; whoogle.enable = true; }; diff --git a/modules/system/containers/default.nix b/modules/system/containers/default.nix index cae637e..1d63021 100644 --- a/modules/system/containers/default.nix +++ b/modules/system/containers/default.nix @@ -37,6 +37,7 @@ _: { ./vaultwarden ./vikunja ./wakapi + ./wallos ./wg-easy ./whoogle ./zigbee2mqtt diff --git a/modules/system/containers/wallos/default.nix b/modules/system/containers/wallos/default.nix new file mode 100644 index 0000000..af12eed --- /dev/null +++ b/modules/system/containers/wallos/default.nix @@ -0,0 +1,71 @@ +{ + config, + lib, + svc, + ... +}: +let + cfg = config.mySystemApps.wallos; +in +{ + options.mySystemApps.wallos = { + enable = lib.mkEnableOption "wallos container"; + backup = lib.mkEnableOption "data backup" // { + default = true; + }; + dataDir = lib.mkOption { + type = lib.types.str; + description = "Path to directory containing data."; + default = "/var/lib/wallos"; + }; + }; + + config = lib.mkIf cfg.enable { + warnings = [ (lib.mkIf (!cfg.backup) "WARNING: Backups for wallos are disabled!") ]; + + virtualisation.oci-containers.containers.wallos = svc.mkContainer { + cfg = { + image = "ghcr.io/deedee-ops/wallos:2.41.0@sha256:14fc6f16aef48873df160863004ce53b8761e15eb0cb79a92f592ac01b3332e4"; + volumes = [ + "${cfg.dataDir}/config:/config" + "${cfg.dataDir}/data:/data" + ]; + }; + opts = { + # fetching logos + allowPublic = true; + }; + }; + + services = { + nginx.virtualHosts.wallos = svc.mkNginxVHost { + host = "wallos"; + proxyPass = "http://wallos.docker:9000"; + }; + restic.backups = lib.mkIf cfg.backup ( + svc.mkRestic { + name = "wallos"; + paths = [ cfg.dataDir ]; + } + ); + }; + + systemd.services.docker-wallos = { + preStart = lib.mkAfter '' + mkdir -p "${cfg.dataDir}/config" "${cfg.dataDir}/data" + chown 65000:65000 "${cfg.dataDir}/config" "${cfg.dataDir}/data" + ''; + }; + + environment.persistence."${config.mySystem.impermanence.persistPath}" = + lib.mkIf config.mySystem.impermanence.enable + { directories = [ cfg.dataDir ]; }; + + mySystemApps.homepage = { + services.Apps.wallos = svc.mkHomepage "wallos" // { + icon = "wallos.png"; + description = "Subscriptions manager"; + }; + }; + }; +}