nixos/nitter: add package option

This commit is contained in:
Simon Bruder 2022-01-30 20:31:54 +01:00
parent 97b97c102e
commit be636c6c96
No known key found for this signature in database
GPG Key ID: 8D3C82F9F309F8EC

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";