12 cfg = config.services.morty;
24 enable = mkEnableOption "Morty proxy server. See https://github.com/asciimoo/morty";
29 description = "Allow IPv6 HTTP requests?";
36 HMAC url validation key (hexadecimal encoded).
37 Leave blank to disable. Without validation key, anyone can
38 submit proxy requests. Leave blank to disable.
39 Generate with `printf %s somevalue | openssl dgst -sha1 -hmac somekey`
46 description = "Request timeout in seconds.";
49 package = mkPackageOption pkgs "morty" { };
54 description = "Listing port";
57 listenAddress = mkOption {
59 default = "127.0.0.1";
60 description = "The address on which the service listens";
67 ###### Service definition
69 config = mkIf config.services.morty.enable {
72 description = "Morty user";
74 home = "/var/lib/morty";
78 users.groups.morty = { };
80 systemd.services.morty = {
81 description = "Morty sanitizing proxy server.";
82 after = [ "network.target" ];
83 wantedBy = [ "multi-user.target" ];
87 ${cfg.package}/bin/morty \
88 -listen ${cfg.listenAddress}:${toString cfg.port} \
89 ${optionalString cfg.ipv6 "-ipv6"} \
90 ${optionalString (cfg.key != "") "-key " + cfg.key} \
94 environment.systemPackages = [ cfg.package ];