8 cfg = config.services.hatsu;
11 meta.doc = ./hatsu.md;
12 meta.maintainers = with lib.maintainers; [ kwaa ];
14 options.services.hatsu = {
15 enable = lib.mkEnableOption "Self-hosted and fully-automated ActivityPub bridge for static sites";
17 package = lib.mkPackageOption pkgs "hatsu" { };
19 settings = lib.mkOption {
20 type = lib.types.submodule {
33 HATSU_DATABASE_URL = lib.mkOption {
35 default = "sqlite:///var/lib/hatsu/hatsu.sqlite?mode=rwc";
36 example = "postgres://username:password@host/database";
37 description = "Database URL.";
40 HATSU_DOMAIN = lib.mkOption {
42 description = "The domain name of your instance (eg 'hatsu.local').";
45 HATSU_LISTEN_HOST = lib.mkOption {
47 default = "127.0.0.1";
48 description = "Host where hatsu should listen for incoming requests.";
51 HATSU_LISTEN_PORT = lib.mkOption {
52 type = lib.types.port;
55 description = "Port where hatsu should listen for incoming requests.";
58 HATSU_PRIMARY_ACCOUNT = lib.mkOption {
60 description = "The primary account of your instance (eg 'example.com').";
68 Configuration for Hatsu, see
69 <link xlink:href="https://hatsu.cli.rs/admins/environments.html"/>
75 config = lib.mkIf cfg.enable {
76 systemd.services.hatsu = {
77 environment = cfg.settings;
79 description = "Hatsu server";
80 documentation = [ "https://hatsu.cli.rs/" ];
82 after = [ "network-online.target" ];
83 wants = [ "network-online.target" ];
85 wantedBy = [ "multi-user.target" ];
89 ExecStart = "${lib.getExe cfg.package}";
90 Restart = "on-failure";
91 StateDirectory = "hatsu";
93 WorkingDirectory = "%S/hatsu";