Merge pull request #204474 from peperunas/libreddit

libreddit: Add package option to module
This commit is contained in:
Bobby Rong 2022-12-08 19:49:11 +08:00 committed by GitHub
commit d44e752fba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,6 +15,13 @@ in
services.libreddit = { services.libreddit = {
enable = mkEnableOption (lib.mdDoc "Private front-end for Reddit"); enable = mkEnableOption (lib.mdDoc "Private front-end for Reddit");
package = mkOption {
type = types.package;
default = pkgs.libreddit;
defaultText = literalExpression "pkgs.libreddit";
description = lib.mdDoc "Libreddit package to use.";
};
address = mkOption { address = mkOption {
default = "0.0.0.0"; default = "0.0.0.0";
example = "127.0.0.1"; example = "127.0.0.1";
@ -45,7 +52,7 @@ in
after = [ "network.target" ]; after = [ "network.target" ];
serviceConfig = { serviceConfig = {
DynamicUser = true; DynamicUser = true;
ExecStart = "${pkgs.libreddit}/bin/libreddit ${args}"; ExecStart = "${cfg.package}/bin/libreddit ${args}";
AmbientCapabilities = lib.mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ]; AmbientCapabilities = lib.mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "2s"; RestartSec = "2s";