mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
nixos/jackett: add configurable port
This commit is contained in:
parent
9962bb4f68
commit
a0906cbd16
@ -11,6 +11,14 @@ in
|
||||
services.jackett = {
|
||||
enable = mkEnableOption "Jackett, API support for your favorite torrent trackers";
|
||||
|
||||
port = mkOption {
|
||||
default = 9117;
|
||||
type = types.port;
|
||||
description = ''
|
||||
Port serving the web interface
|
||||
'';
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/lib/jackett/.config/Jackett";
|
||||
@ -53,13 +61,13 @@ in
|
||||
Type = "simple";
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
ExecStart = "${cfg.package}/bin/Jackett --NoUpdates --DataFolder '${cfg.dataDir}'";
|
||||
ExecStart = "${cfg.package}/bin/Jackett --NoUpdates --Port ${toString cfg.port} --DataFolder '${cfg.dataDir}'";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [ 9117 ];
|
||||
allowedTCPPorts = [ cfg.port ];
|
||||
};
|
||||
|
||||
users.users = mkIf (cfg.user == "jackett") {
|
||||
|
@ -1,17 +1,21 @@
|
||||
import ./make-test-python.nix ({ lib, ... }:
|
||||
|
||||
{
|
||||
let
|
||||
jackettPort = 9117;
|
||||
in {
|
||||
name = "jackett";
|
||||
meta.maintainers = with lib.maintainers; [ etu ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{ services.jackett.enable = true; };
|
||||
{ pkgs, ... }: {
|
||||
services.jackett.enable = true;
|
||||
services.jackett.port = jackettPort;
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.start()
|
||||
machine.wait_for_unit("jackett.service")
|
||||
machine.wait_for_open_port(9117)
|
||||
machine.succeed("curl --fail http://localhost:9117/")
|
||||
machine.wait_for_open_port(${toString jackettPort})
|
||||
machine.succeed("curl --fail http://localhost:${toString jackettPort}/")
|
||||
'';
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user