From 0700c42ff2d689f335594d342b339c9b64413380 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 27 Jan 2020 00:42:12 +0000 Subject: nixos/public-inbox: support multiple mounts --- .../nixos/modules/services/mail/public-inbox.nix | 36 ++++++++++++++++------ .../nixos/modules/services/mail/public-inbox.psgi | 16 ---------- 2 files changed, 26 insertions(+), 26 deletions(-) delete mode 100644 nixpkgs/nixos/modules/services/mail/public-inbox.psgi (limited to 'nixpkgs') 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 + # License: GPL-3.0+ + 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 -# License: GPL-3.0+ -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(@_) }; -} - -- cgit 1.4.1