volpe/nix/module.nix

33 lines
No EOL
650 B
Nix

{
config,
lib,
pkgs,
...
}: let
cfg = config.services.volpe;
pkg = pkgs.callPackage ./package.nix {};
in {
options.services.volpe = {
enable = lib.mkEnableOption "volpe blog";
domain = lib.mkOption {
type = lib.types.str;
default = "localhost";
description = "Domain name for nginx virtual host.";
};
};
config = lib.mkIf cfg.enable {
services.nginx = {
enable = true;
virtualHosts.${cfg.domain} = {
root = "${pkg}";
locations."/" = {
tryFiles = "$uri $uri/ /index.html";
};
};
};
networking.firewall.allowedTCPPorts = [80 443];
};
}