mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-27 03:26:50 +03:00
Merge pull request #206099 from sweenu/add-goeland-module
nixos/goeland: init
This commit is contained in:
commit
ad161ee67c
5 changed files with 90 additions and 4 deletions
|
@ -530,6 +530,7 @@
|
|||
./services/mail/dovecot.nix
|
||||
./services/mail/dspam.nix
|
||||
./services/mail/exim.nix
|
||||
./services/mail/goeland.nix
|
||||
./services/mail/listmonk.nix
|
||||
./services/mail/maddy.nix
|
||||
./services/mail/mail.nix
|
||||
|
|
74
nixos/modules/services/mail/goeland.nix
Normal file
74
nixos/modules/services/mail/goeland.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{ 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 = 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.";
|
||||
};
|
||||
stateDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/goeland";
|
||||
description = mdDoc ''
|
||||
The data directory for goeland where the database will reside if using the unseen filter.
|
||||
If left as the default value this directory will automatically be created before the goeland
|
||||
server starts, otherwise you are responsible for ensuring the directory exists with
|
||||
appropriate ownership and permissions.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.goeland.settings.database = "${cfg.stateDir}/goeland.db";
|
||||
|
||||
systemd.services.goeland = {
|
||||
serviceConfig = let confFile = tomlFormat.generate "config.toml" cfg.settings; in mkMerge [
|
||||
{
|
||||
ExecStart = "${pkgs.goeland}/bin/goeland run -c ${confFile}";
|
||||
User = "goeland";
|
||||
Group = "goeland";
|
||||
}
|
||||
(mkIf (cfg.stateDir == "/var/lib/goeland") {
|
||||
StateDirectory = "goeland";
|
||||
StateDirectoryMode = "0750";
|
||||
})
|
||||
];
|
||||
startAt = cfg.schedule;
|
||||
};
|
||||
|
||||
users.users.goeland = {
|
||||
description = "goeland user";
|
||||
group = "goeland";
|
||||
isSystemUser = true;
|
||||
};
|
||||
users.groups.goeland = { };
|
||||
|
||||
warnings = optionals (hasAttr "password" cfg.settings.email) [
|
||||
''
|
||||
It is not recommended to set the "services.goeland.settings.email.password"
|
||||
option as it will be in cleartext in the Nix store.
|
||||
Please use "services.goeland.settings.email.password_file" instead.
|
||||
''
|
||||
];
|
||||
};
|
||||
|
||||
meta.maintainers = with maintainers; [ sweenu ];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue