libreddit: Add package option

This commit is contained in:
Giulio De Pasquale 2022-12-04 14:00:17 +01:00 committed by GitHub
parent 45b92369d6
commit 34ddff29a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,13 @@ in
services.libreddit = {
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 {
default = "0.0.0.0";
example = "127.0.0.1";
@ -45,7 +52,7 @@ in
after = [ "network.target" ];
serviceConfig = {
DynamicUser = true;
ExecStart = "${pkgs.libreddit}/bin/libreddit ${args}";
ExecStart = "${cfg.package}/bin/libreddit ${args}";
AmbientCapabilities = lib.mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
Restart = "on-failure";
RestartSec = "2s";