2021-12-05 22:36:38 +01:00
|
|
|
{ config, lib, options, pkgs, ... }:
|
2017-08-22 12:27:00 +02:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.pgpkeyserver-lite;
|
|
|
|
sksCfg = config.services.sks;
|
2021-12-05 22:36:38 +01:00
|
|
|
sksOpt = options.services.sks;
|
2017-08-22 12:27:00 +02:00
|
|
|
|
|
|
|
webPkg = cfg.package;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.pgpkeyserver-lite = {
|
|
|
|
|
|
|
|
enable = mkEnableOption "pgpkeyserver-lite on a nginx vHost proxying to a gpg keyserver";
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
default = pkgs.pgpkeyserver-lite;
|
2021-10-03 18:06:03 +02:00
|
|
|
defaultText = literalExpression "pkgs.pgpkeyserver-lite";
|
2017-08-22 12:27:00 +02:00
|
|
|
type = types.package;
|
|
|
|
description = "
|
|
|
|
Which webgui derivation to use.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
hostname = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
description = "
|
|
|
|
Which hostname to set the vHost to that is proxying to sks.
|
|
|
|
";
|
2020-08-07 15:43:58 +02:00
|
|
|
};
|
2017-08-22 12:27:00 +02:00
|
|
|
|
|
|
|
hkpAddress = mkOption {
|
|
|
|
default = builtins.head sksCfg.hkpAddress;
|
2021-12-05 22:36:38 +01:00
|
|
|
defaultText = literalExpression "head config.${sksOpt.hkpAddress}";
|
2017-08-22 12:27:00 +02:00
|
|
|
type = types.str;
|
|
|
|
description = "
|
|
|
|
Wich ip address the sks-keyserver is listening on.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
hkpPort = mkOption {
|
|
|
|
default = sksCfg.hkpPort;
|
2021-12-05 22:36:38 +01:00
|
|
|
defaultText = literalExpression "config.${sksOpt.hkpPort}";
|
2017-08-22 12:27:00 +02:00
|
|
|
type = types.int;
|
|
|
|
description = "
|
|
|
|
Which port the sks-keyserver is listening on.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
services.nginx.enable = true;
|
|
|
|
|
|
|
|
services.nginx.virtualHosts = let
|
|
|
|
hkpPort = builtins.toString cfg.hkpPort;
|
|
|
|
in {
|
2019-08-13 23:52:01 +02:00
|
|
|
${cfg.hostname} = {
|
2017-08-22 12:27:00 +02:00
|
|
|
root = webPkg;
|
|
|
|
locations = {
|
|
|
|
"/pks".extraConfig = ''
|
|
|
|
proxy_pass http://${cfg.hkpAddress}:${hkpPort};
|
|
|
|
proxy_pass_header Server;
|
|
|
|
add_header Via "1.1 ${cfg.hostname}";
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|