mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-08 14:03:29 +00:00
60 lines
1.6 KiB
Nix
60 lines
1.6 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.goeland;
|
|
tomlFormat = pkgs.formats.toml { };
|
|
in
|
|
{
|
|
options.services.goeland = {
|
|
enable = mkEnableOption (mdDoc "goeland");
|
|
|
|
settings = mkOption {
|
|
description = mdDoc ''
|
|
Configuration of goeland.
|
|
See the [example config file](https://github.com/slurdge/goeland/blob/master/cmd/asset/config.default.toml) for the available options.
|
|
'';
|
|
default = { };
|
|
type = types.submodule {
|
|
freeformType = tomlFormat.type;
|
|
};
|
|
};
|
|
schedule = mkOption {
|
|
type = types.str;
|
|
default = "12h";
|
|
example = "Mon, 00:00:00";
|
|
description = mdDoc "How often to run goeland, in systemd time format";
|
|
};
|
|
databaseDirectory = mkOption {
|
|
type = types.path;
|
|
default = "/var/lib/goeland";
|
|
description = mdDoc "Directory where the goeland database will reside if using the `unseen` filter";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
services.goeland.settings.database = "${cfg.databaseDirectory}/goeland.db";
|
|
|
|
systemd.services.goeland = {
|
|
serviceConfig = let confFile = tomlFormat.generate "config.toml" cfg.settings; in {
|
|
ExecStart = "${pkgs.goeland}/bin/goeland run -c ${confFile}";
|
|
User = "goeland";
|
|
Group = "goeland";
|
|
StateDirectory = "goeland";
|
|
StateDirectoryMode = "0750";
|
|
};
|
|
startAt = cfg.schedule;
|
|
};
|
|
|
|
users.users.goeland = {
|
|
description = "goeland user";
|
|
group = "goeland";
|
|
isSystemUser = true;
|
|
};
|
|
users.groups.goeland = { };
|
|
};
|
|
|
|
meta.maintainers = with maintainers; [ sweenu ];
|
|
}
|