financier-nix/module.nix

33 lines
699 B
Nix
Raw Normal View History

{ config, lib, pkgs, system, ... }:
with lib;
let
cfg = config.services.financier;
financier-dist = import ./dist.nix { inherit pkgs system; };
in
{
imports = [];
options.services.financier = {
enable = mkEnableOption "Financier";
hostName = mkOption {
type = types.str;
description = ''
Name for the nginx virtual host.
'';
example = "example.org";
};
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx.virtualHosts."${cfg.hostName}" = {
forceSSL = true;
enableACME = true;
root = financier-dist;
locations."/".tryFiles = "$uri $uri/ /index.html";
};
};
}