30 lines
682 B
Nix
30 lines
682 B
Nix
{ config, lib, ... }:
|
|
let
|
|
cfg = config.services.iana-angl;
|
|
in
|
|
{
|
|
options.services.iana-angl = {
|
|
enable = lib.mkEnableOption "iana-angl static site";
|
|
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
description = "Static iana-angl site package to serve.";
|
|
};
|
|
|
|
domain = lib.mkOption {
|
|
type = lib.types.strMatching ".+";
|
|
description = "Nonempty nginx virtual host domain for iana-angl.";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.nginx = {
|
|
enable = true;
|
|
virtualHosts.${cfg.domain}.locations."/".extraConfig = ''
|
|
alias ${cfg.package}/;
|
|
try_files $uri $uri/ /index.html;
|
|
'';
|
|
};
|
|
};
|
|
}
|