1 { config, lib, pkgs, ... }:
7 cfg = config.services.morty;
19 enable = mkEnableOption "Morty proxy server. See https://github.com/asciimoo/morty";
24 description = "Allow IPv6 HTTP requests?";
31 HMAC url validation key (hexadecimal encoded).
32 Leave blank to disable. Without validation key, anyone can
33 submit proxy requests. Leave blank to disable.
34 Generate with `printf %s somevalue | openssl dgst -sha1 -hmac somekey`
41 description = "Request timeout in seconds.";
44 package = mkPackageOption pkgs "morty" { };
49 description = "Listing port";
52 listenAddress = mkOption {
54 default = "127.0.0.1";
55 description = "The address on which the service listens";
62 ###### Service definition
64 config = mkIf config.services.morty.enable {
67 { description = "Morty user";
69 home = "/var/lib/morty";
73 users.groups.morty = {};
75 systemd.services.morty =
77 description = "Morty sanitizing proxy server.";
78 after = [ "network.target" ];
79 wantedBy = [ "multi-user.target" ];
82 ExecStart = ''${cfg.package}/bin/morty \
83 -listen ${cfg.listenAddress}:${toString cfg.port} \
84 ${optionalString cfg.ipv6 "-ipv6"} \
85 ${optionalString (cfg.key != "") "-key " + cfg.key} \
89 environment.systemPackages = [ cfg.package ];