diff options
Diffstat (limited to 'modules/by-name/sh/sharkey')
| -rw-r--r-- | modules/by-name/sh/sharkey/module.nix | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/modules/by-name/sh/sharkey/module.nix b/modules/by-name/sh/sharkey/module.nix deleted file mode 100644 index 186fed2..0000000 --- a/modules/by-name/sh/sharkey/module.nix +++ /dev/null @@ -1,135 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.vhack.sharkey; -in { - options = { - vhack.sharkey = { - enable = lib.mkEnableOption "sharkey"; - - fqdn = lib.mkOption { - description = "The fully qualified domain name of this instance."; - type = lib.types.str; - example = "sharkey.shonk.social"; - }; - - package = lib.mkOption { - type = lib.types.package; - default = pkgs.sharkey; - defaultText = lib.literalExpression "vhackPackages.sharkey"; - description = "Sharkey package to use."; - }; - - mediaDirectory = lib.mkOption { - type = lib.types.path; - default = "/var/lib/sharkey"; - description = "The directory where sharkey stores it's data."; - }; - - settings = lib.mkOption { - inherit (pkgs.formats.yaml {}) type; - default = {}; - description = '' - Extra Configuration for Sharkey, see - <link xlink:href="https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/.config/example.yml"/> - for supported settings. - - Note, that this is applied on-top of the neccessary config. - ''; - }; - }; - }; - - config = lib.mkIf cfg.enable { - services = { - sharkey = { - enable = true; - - inherit (cfg) package; - openFirewall = false; - setupRedis = true; - setupPostgresql = true; - - settings = - cfg.settings - // { - url = "https://${cfg.fqdn}/"; - port = 5312; - - inherit (cfg) mediaDirectory; - fulltextSearch.provider = "sqlLike"; - }; - }; - - nginx.virtualHosts."${cfg.fqdn}" = { - locations."/" = { - proxyPass = "http://127.0.0.1:${toString config.services.sharkey.settings.port}"; - proxyWebsockets = true; - }; - - enableACME = true; - forceSSL = true; - }; - }; - - systemd.services.sharkey = { - after = [ - "redis-sharkey.service" - ]; - bindsTo = [ - "redis-sharkey.service" - ]; - - serviceConfig = { - # The upstream service uses DynamicUsers, which currently poses issues to our - # directory persisting strategy. - User = "sharkey"; - Group = "sharkey"; - DynamicUser = lib.mkForce false; - }; - }; - - vhack = { - nginx.enable = true; - - persist.directories = [ - { - directory = "${config.services.redis.servers."sharkey".settings.dir}"; - user = "sharkey"; - group = "redis-sharey"; - mode = "0770"; - } - { - directory = "${cfg.mediaDirectory}"; - user = "sharkey"; - group = "sharkey"; - mode = "0700"; - } - ]; - }; - - users = { - groups.sharkey = { - gid = config.vhack.constants.ids.gids.sharkey; - }; - users.sharkey = { - isSystemUser = true; - group = "sharkey"; - uid = config.vhack.constants.ids.uids.sharkey; - home = cfg.package; - packages = [cfg.package]; - }; - - groups.redis-sharkey = { - gid = config.vhack.constants.ids.gids.redis-sharkey; - }; - users.redis-sharkey = { - group = "redis-sharkey"; - uid = config.vhack.constants.ids.uids.redis-sharkey; - }; - }; - }; -} |
