Merge pull request #157438 from sbruder/nitter-package-option

This commit is contained in:
Maciej Krüger 2022-03-07 18:50:27 +01:00 committed by GitHub
commit 75ea3ea9b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,6 +49,13 @@ in
services.nitter = {
enable = mkEnableOption "If enabled, start Nitter.";
package = mkOption {
default = pkgs.nitter;
type = types.package;
defaultText = literalExpression "pkgs.nitter";
description = "The nitter derivation to use.";
};
server = {
address = mkOption {
type = types.str;
@ -78,8 +85,8 @@ in
staticDir = mkOption {
type = types.path;
default = "${pkgs.nitter}/share/nitter/public";
defaultText = literalExpression ''"''${pkgs.nitter}/share/nitter/public"'';
default = "${cfg.package}/share/nitter/public";
defaultText = literalExpression ''"''${config.services.nitter.package}/share/nitter/public"'';
description = "Path to the static files directory.";
};
@ -306,8 +313,8 @@ in
Environment = [ "NITTER_CONF_FILE=/var/lib/nitter/nitter.conf" ];
# Some parts of Nitter expect `public` folder in working directory,
# see https://github.com/zedeus/nitter/issues/414
WorkingDirectory = "${pkgs.nitter}/share/nitter";
ExecStart = "${pkgs.nitter}/bin/nitter";
WorkingDirectory = "${cfg.package}/share/nitter";
ExecStart = "${cfg.package}/bin/nitter";
ExecStartPre = "${preStart}";
AmbientCapabilities = lib.mkIf (cfg.server.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
Restart = "on-failure";