add hledger

This commit is contained in:
Joakim Repomaa
2025-05-26 09:36:55 +03:00
parent d625368bd0
commit 027ae0bef8
8 changed files with 80 additions and 1 deletions

View File

@@ -24,6 +24,9 @@
darktable darktable
openscad openscad
shutter shutter
hledger
hledger-ui
hledger-iadd
]; ];
gnome.profilePicture = ../assets/profile-pictures/jokke.png; gnome.profilePicture = ../assets/profile-pictures/jokke.png;

View File

@@ -41,5 +41,9 @@
file = ../../secrets/hastebin-tokens.age; file = ../../secrets/hastebin-tokens.age;
owner = if (config.services.hastebin.enable) then config.users.users.hastebin.name else "root"; owner = if (config.services.hastebin.enable) then config.users.users.hastebin.name else "root";
}; };
hledger-basic-auth = {
file = ../../secrets/hledger-basic-auth.age;
owner = if (config.services.hledger-web.enable) then "nginx" else "root";
};
}; };
} }

View File

@@ -375,5 +375,17 @@ in
enable = true; enable = true;
subdomain = "irc"; subdomain = "irc";
}; };
hledger-web = {
enable = true;
subdomain = "ledger";
stateDir = "${syncthingDataDir}/ledger";
basicAuthFile = secrets.hledger-basic-auth.path;
user = config.systemd.services.syncthing.serviceConfig.User;
group = config.systemd.services.syncthing.serviceConfig.Group;
journalFiles = [
"main.ldg"
];
};
}; };
} }

View File

@@ -24,5 +24,6 @@
./mosquitto.nix ./mosquitto.nix
./home-assistant.nix ./home-assistant.nix
./weechat.nix ./weechat.nix
./hledger-web.nix
]; ];
} }

View 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;
};
};
}

View File

@@ -13,6 +13,10 @@ let
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;
}; };
basicAuthFile = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
};
extraConfig = lib.mkOption { extraConfig = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = ""; default = "";
@@ -91,9 +95,10 @@ in
proxyPort, proxyPort,
extraConfig, extraConfig,
root, root,
basicAuthFile,
}: }:
lib.mergeAttrsList [ lib.mergeAttrsList [
{ inherit extraConfig root; } { inherit extraConfig root basicAuthFile; }
( (
if (lib.isInt proxyPort) then if (lib.isInt proxyPort) then
{ {

View File

@@ -0,0 +1,10 @@
age-encryption.org/v1
-> ssh-ed25519 osOCZA gReLtbgzdbsykLo/OWs/S0CWvvUJr0B/660n5NtQO3Q
lxP6i2EA0ZvM9ShkM7012TLs47fP+sKzOAJehgvZEoU
-> ssh-ed25519 DFiohQ OPP2MdPUYqMuViWTiNavSyXqxfxIRMx+tMKip094ohM
lLxrJF672ZkbY3ynX7Wrx3srJvg1gfFeynZMeIYL4II
-> ssh-ed25519 PT7ffg v0j5GfBvjmf4qNiyVr/foSp2Zw8sJOmjikWa68yoNnI
WwhUOPXdrrs2ezKfYaUdT0EV/b7U3267E5bpy+RGyxU
--- v/hWe76x98rBQgOhANw5wsaE3hlCaFKYSl+x8KjnRNQ
:bl
‰~E¡3ã®éåN<C3A5>"]Œ`´Âª¨ c#Ç;¯vt½=A<>ƒ)ÍÕa¦/<®áŠl#ˆÖUïgfí£„¦ò½RÉ;<<3C>­%á†:!ã$)!Sž¯È<C2AF>

View File

@@ -37,4 +37,5 @@ in
"gitlab-runner/default.age".publicKeys = users ++ [ freun-dev ]; "gitlab-runner/default.age".publicKeys = users ++ [ freun-dev ];
"gitlab-runner/docker.age".publicKeys = users ++ [ freun-dev ]; "gitlab-runner/docker.age".publicKeys = users ++ [ freun-dev ];
"hetzner.age".publicKeys = users ++ [ apu ]; "hetzner.age".publicKeys = users ++ [ apu ];
"hledger-basic-auth.age".publicKeys = users ++ [ freun-dev ];
} }