Fava, setup service; enable for Juri
This commit is contained in:
parent
0ce82962bb
commit
641e226f9b
2 changed files with 50 additions and 0 deletions
45
nixosModules/services/fava/service.nix
Normal file
45
nixosModules/services/fava/service.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
options.fava = {
|
||||
enable = lib.mkEnableOption "Enables fava double entry accounting";
|
||||
ledgerFile = lib.mkOption { default = "/var/lib/fava/ledger.beancount"; };
|
||||
port = lib.mkOption { default = "5000"; };
|
||||
host = lib.mkOption { default = "localhost"; };
|
||||
};
|
||||
|
||||
config = lib.mkIf config.fava.enable {
|
||||
systemd.services.fava = {
|
||||
description = "Fava";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.fava}/bin/fava --port ${config.fava.port} --host ${config.fava.host} ${config.fava.ledgerFile}";
|
||||
Type = "simple";
|
||||
User = "fava";
|
||||
Group = "fava";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
PrivateDevices = true;
|
||||
ProtectHome = true;
|
||||
ProtectSystem = "full";
|
||||
ReadWriteDirectories = "/var/lib/fava";
|
||||
};
|
||||
};
|
||||
|
||||
users.users.fava = {
|
||||
home = "/var/lib/fava";
|
||||
createHome = true;
|
||||
isSystemUser = true;
|
||||
group = "fava";
|
||||
};
|
||||
users.groups.fava = {};
|
||||
|
||||
system.extraPkgs = [
|
||||
pkgs.beancount
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue