add hledger
This commit is contained in:
@@ -24,5 +24,6 @@
|
||||
./mosquitto.nix
|
||||
./home-assistant.nix
|
||||
./weechat.nix
|
||||
./hledger-web.nix
|
||||
];
|
||||
}
|
||||
|
||||
43
modules/services/hledger-web.nix
Normal file
43
modules/services/hledger-web.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.services.hledger-web;
|
||||
fqdn = "${cfg.subdomain}.${config.networking.domain}";
|
||||
in
|
||||
{
|
||||
options.services.hledger-web = {
|
||||
subdomain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
basicAuthFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
};
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
group = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
hledger-web = {
|
||||
allow = lib.mkDefault "edit";
|
||||
baseUrl = "https://${fqdn}";
|
||||
};
|
||||
|
||||
webserver = {
|
||||
enable = lib.mkDefault true;
|
||||
vHosts.${fqdn}.locations."/" = {
|
||||
proxyPort = cfg.port;
|
||||
basicAuthFile = cfg.basicAuthFile;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.hledger-web.serviceConfig = {
|
||||
User = lib.mkForce cfg.user;
|
||||
Group = lib.mkForce cfg.group;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -13,6 +13,10 @@ let
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
};
|
||||
basicAuthFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
default = null;
|
||||
};
|
||||
extraConfig = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
@@ -91,9 +95,10 @@ in
|
||||
proxyPort,
|
||||
extraConfig,
|
||||
root,
|
||||
basicAuthFile,
|
||||
}:
|
||||
lib.mergeAttrsList [
|
||||
{ inherit extraConfig root; }
|
||||
{ inherit extraConfig root basicAuthFile; }
|
||||
(
|
||||
if (lib.isInt proxyPort) then
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user