at 25.11-pre 2.4 kB view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7let 8 cfg = config.services.goeland; 9 tomlFormat = pkgs.formats.toml { }; 10in 11{ 12 options.services.goeland = { 13 enable = lib.mkEnableOption "goeland, an alternative to rss2email"; 14 15 settings = lib.mkOption { 16 description = '' 17 Configuration of goeland. 18 See the [example config file](https://github.com/slurdge/goeland/blob/master/cmd/asset/config.default.toml) for the available options. 19 ''; 20 default = { }; 21 type = tomlFormat.type; 22 }; 23 schedule = lib.mkOption { 24 type = lib.types.str; 25 default = "12h"; 26 example = "Mon, 00:00:00"; 27 description = "How often to run goeland, in systemd time format."; 28 }; 29 stateDir = lib.mkOption { 30 type = lib.types.path; 31 default = "/var/lib/goeland"; 32 description = '' 33 The data directory for goeland where the database will reside if using the unseen filter. 34 If left as the default value this directory will automatically be created before the goeland 35 server starts, otherwise you are responsible for ensuring the directory exists with 36 appropriate ownership and permissions. 37 ''; 38 }; 39 }; 40 41 config = lib.mkIf cfg.enable { 42 services.goeland.settings.database = "${cfg.stateDir}/goeland.db"; 43 44 systemd.services.goeland = { 45 serviceConfig = 46 let 47 confFile = tomlFormat.generate "config.toml" cfg.settings; 48 in 49 lib.mkMerge [ 50 { 51 ExecStart = "${pkgs.goeland}/bin/goeland run -c ${confFile}"; 52 User = "goeland"; 53 Group = "goeland"; 54 } 55 (lib.mkIf (cfg.stateDir == "/var/lib/goeland") { 56 StateDirectory = "goeland"; 57 StateDirectoryMode = "0750"; 58 }) 59 ]; 60 startAt = cfg.schedule; 61 }; 62 63 users.users.goeland = { 64 description = "goeland user"; 65 group = "goeland"; 66 isSystemUser = true; 67 }; 68 users.groups.goeland = { }; 69 70 warnings = lib.optionals (lib.hasAttr "password" cfg.settings.email) [ 71 '' 72 It is not recommended to set the "services.goeland.settings.email.password" 73 option as it will be in cleartext in the Nix store. 74 Please use "services.goeland.settings.email.password_file" instead. 75 '' 76 ]; 77 }; 78 79 meta.maintainers = with lib.maintainers; [ sweenu ]; 80}