From 87bf486ca39060db380062acb39e25cf407945f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Thu, 13 Aug 2026 16:58:20 +0200 Subject: [PATCH] add wallabag service --- modules/services/wallabag.nix | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 modules/services/wallabag.nix diff --git a/modules/services/wallabag.nix b/modules/services/wallabag.nix new file mode 100644 index 0000000..02ced9d --- /dev/null +++ b/modules/services/wallabag.nix @@ -0,0 +1,53 @@ +{ + flake.nixosModules.wallabag = { + config, + lib, + ... + }: let + cfg = config.hive.wallabag; + in { + options.hive.wallabag = { + enable = lib.mkEnableOption "Enable wallabag service"; + localPort = lib.mkOption { + type = lib.types.int; + example = 8080; + default = 39128; + description = "Specify the local port wallabag server uses."; + }; + instanceFQDN = lib.mkOption { + type = lib.types.singleLineStr; + example = "wallabag.example.com"; + description = "Fully qualified domain name of the wallabag instance"; + }; + }; + + config = lib.mkIf cfg.enable { + # Fallback server with only 403 + services.nginx.virtualHosts.${config.networking.domain} = lib.mkDefault { + default = true; + locations."/".return = 403; + forceSSL = true; + enableACME = true; + }; + + # Virtual host for korrosync + services.nginx.virtualHosts."${cfg.instanceFQDN}" = { + forceSSL = true; + enableACME = true; + locations."/".proxyPass = "http://127.0.0.1:${toString cfg.localPort}"; + }; + + virtualisation.oci-containers.containers.wallabag = { + image = "wallabag/wallabag:latest"; + ports = ["127.0.0.1:${toString cfg.localPort}:80"]; + volumes = [ + "wallabag-data:/var/www/wallabag/data" + "wallabag-images:/var/www/wallabag/web/assets/images" + ]; + environment = { + "SYMFONY__ENV__DOMAIN_NAME" = "https://${cfg.instanceFQDN}:${toString cfg.localPort}"; + }; + }; + }; + }; +}