diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-01-27 00:42:12 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-01-27 00:42:12 +0000 |
commit | 0700c42ff2d689f335594d342b339c9b64413380 (patch) | |
tree | 14760ee884f65aca80df9e7f61718aafadbdd727 /nixpkgs | |
parent | 524624a29d4e6ae60cdc2f5dfd1125a49b1de275 (diff) | |
download | nixlib-0700c42ff2d689f335594d342b339c9b64413380.tar nixlib-0700c42ff2d689f335594d342b339c9b64413380.tar.gz nixlib-0700c42ff2d689f335594d342b339c9b64413380.tar.bz2 nixlib-0700c42ff2d689f335594d342b339c9b64413380.tar.lz nixlib-0700c42ff2d689f335594d342b339c9b64413380.tar.xz nixlib-0700c42ff2d689f335594d342b339c9b64413380.tar.zst nixlib-0700c42ff2d689f335594d342b339c9b64413380.zip |
nixos/public-inbox: support multiple mounts
Diffstat (limited to 'nixpkgs')
-rw-r--r-- | nixpkgs/nixos/modules/services/mail/public-inbox.nix | 36 | ||||
-rw-r--r-- | nixpkgs/nixos/modules/services/mail/public-inbox.psgi | 16 |
2 files changed, 26 insertions, 26 deletions
diff --git a/nixpkgs/nixos/modules/services/mail/public-inbox.nix b/nixpkgs/nixos/modules/services/mail/public-inbox.nix index 9bc5cf17a7f5..b13a54a0e2d1 100644 --- a/nixpkgs/nixos/modules/services/mail/public-inbox.nix +++ b/nixpkgs/nixos/modules/services/mail/public-inbox.nix @@ -67,11 +67,25 @@ let cp $forwardPath $out/.forward ''; - psgi = pkgs.substituteAll { - src = ./public-inbox.psgi; - perl = "${cfg.package.fullperl}/bin/perl"; - path = cfg.http.mount; - }; + psgi = pkgs.writeText "public-inbox.psgi" '' + #!${cfg.package.fullperl} -w + # Copyright (C) 2014-2019 all contributors <meta@public-inbox.org> + # License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt> + use strict; + use PublicInbox::WWW; + use Plack::Builder; + + my $www = PublicInbox::WWW->new; + $www->preload; + + builder { + enable 'Head'; + enable 'ReverseProxy'; + ${concatMapStrings (path: '' + mount q(${path}) => sub { $www->call(@_); }; + '') cfg.http.mounts} + } + ''; descriptionFile = { description, ... }: pkgs.writeText "description" description; @@ -206,12 +220,14 @@ in }; http = { - mount = mkOption { - type = types.str; - default = "/"; - example = "/lists/archives"; + mounts = mkOption { + type = with types; listOf str; + default = [ "/" ]; + example = [ "/lists/archives" ]; description = '' - Path components to prepend to public-inbox HTTP endpoints + Root paths or URLs that public-inbox will be served on. + If domain parts are present, only requests to those + domains will be accepted. ''; }; diff --git a/nixpkgs/nixos/modules/services/mail/public-inbox.psgi b/nixpkgs/nixos/modules/services/mail/public-inbox.psgi deleted file mode 100644 index 0808abe1d177..000000000000 --- a/nixpkgs/nixos/modules/services/mail/public-inbox.psgi +++ /dev/null @@ -1,16 +0,0 @@ -#!@perl@ -w -# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org> -# License: GPL-3.0+ <https://www.gnu.org/licenses/gpl-3.0.txt> -use strict; -use PublicInbox::WWW; -use Plack::Builder; - -my $www = PublicInbox::WWW->new; -$www->preload; - -builder { - enable 'Head'; - enable 'ReverseProxy'; - mount q(@path@) => sub { $www->call(@_) }; -} - |