1 { config, lib, pkgs, ... }:
7 cfg = config.services.morty;
19 enable = mkEnableOption
20 (lib.mdDoc "Morty proxy server. See https://github.com/asciimoo/morty");
25 description = lib.mdDoc "Allow IPv6 HTTP requests?";
31 description = lib.mdDoc ''
32 HMAC url validation key (hexadecimal encoded).
33 Leave blank to disable. Without validation key, anyone can
34 submit proxy requests. Leave blank to disable.
35 Generate with `printf %s somevalue | openssl dgst -sha1 -hmac somekey`
42 description = lib.mdDoc "Request timeout in seconds.";
48 defaultText = literalExpression "pkgs.morty";
49 description = lib.mdDoc "morty package to use.";
55 description = lib.mdDoc "Listing port";
58 listenAddress = mkOption {
60 default = "127.0.0.1";
61 description = lib.mdDoc "The address on which the service listens";
68 ###### Service definition
70 config = mkIf config.services.morty.enable {
73 { description = "Morty user";
75 home = "/var/lib/morty";
79 users.groups.morty = {};
81 systemd.services.morty =
83 description = "Morty sanitizing proxy server.";
84 after = [ "network.target" ];
85 wantedBy = [ "multi-user.target" ];
88 ExecStart = ''${cfg.package}/bin/morty \
89 -listen ${cfg.listenAddress}:${toString cfg.port} \
90 ${optionalString cfg.ipv6 "-ipv6"} \
91 ${optionalString (cfg.key != "") "-key " + cfg.key} \
95 environment.systemPackages = [ cfg.package ];