Loading nixos/modules/services/misc/autobrr.nix +23 −5 Original line number Diff line number Diff line Loading @@ -28,13 +28,31 @@ in }; settings = lib.mkOption { type = lib.types.submodule { freeformType = configFormat.type; }; default = { host = "127.0.0.1"; port = 7474; checkForUpdates = true; type = lib.types.submodule { freeformType = configFormat.type; options = { host = lib.mkOption { type = lib.types.str; default = "127.0.0.1"; description = "The host address autobrr listens on."; }; port = lib.mkOption { type = lib.types.port; default = 7474; description = "The port autobrr listens on."; }; checkForUpdates = lib.mkOption { type = lib.types.bool; default = true; description = "Whether autobrr needs to check for updates."; }; }; }; default = { }; example = { port = 7654; logLevel = "DEBUG"; }; description = '' Loading nixos/tests/autobrr.nix +32 −8 Original line number Diff line number Diff line Loading @@ -6,18 +6,42 @@ nodes.machine = { pkgs, ... }: let # We create this secret in the Nix store (making it readable by everyone). # DO NOT DO THIS OUTSIDE OF TESTS!! testSecretFile = pkgs.writeText "session_secret" "not-secret"; in { services.autobrr = { enable = true; # We create this secret in the Nix store (making it readable by everyone). # DO NOT DO THIS OUTSIDE OF TESTS!! secretFile = pkgs.writeText "session_secret" "not-secret"; secretFile = testSecretFile; }; # Use port other than default to test if settings options work. specialisation.settingsPort.configuration = { services.autobrr = { enable = true; secretFile = testSecretFile; settings.port = 7777; }; }; }; testScript = '' testScript = { nodes, ... }: let settingsPort = "${nodes.machine.system.build.toplevel}/specialisation/settingsPort"; in # python '' def test_webui(port): machine.wait_for_unit("autobrr.service") machine.wait_for_open_port(7474) machine.succeed("curl --fail http://localhost:7474/") machine.wait_for_open_port(port) machine.wait_until_succeeds(f"curl --fail http://localhost:{port}") test_webui(7474) machine.succeed("${settingsPort}/bin/switch-to-configuration test") test_webui(7777) ''; } Loading
nixos/modules/services/misc/autobrr.nix +23 −5 Original line number Diff line number Diff line Loading @@ -28,13 +28,31 @@ in }; settings = lib.mkOption { type = lib.types.submodule { freeformType = configFormat.type; }; default = { host = "127.0.0.1"; port = 7474; checkForUpdates = true; type = lib.types.submodule { freeformType = configFormat.type; options = { host = lib.mkOption { type = lib.types.str; default = "127.0.0.1"; description = "The host address autobrr listens on."; }; port = lib.mkOption { type = lib.types.port; default = 7474; description = "The port autobrr listens on."; }; checkForUpdates = lib.mkOption { type = lib.types.bool; default = true; description = "Whether autobrr needs to check for updates."; }; }; }; default = { }; example = { port = 7654; logLevel = "DEBUG"; }; description = '' Loading
nixos/tests/autobrr.nix +32 −8 Original line number Diff line number Diff line Loading @@ -6,18 +6,42 @@ nodes.machine = { pkgs, ... }: let # We create this secret in the Nix store (making it readable by everyone). # DO NOT DO THIS OUTSIDE OF TESTS!! testSecretFile = pkgs.writeText "session_secret" "not-secret"; in { services.autobrr = { enable = true; # We create this secret in the Nix store (making it readable by everyone). # DO NOT DO THIS OUTSIDE OF TESTS!! secretFile = pkgs.writeText "session_secret" "not-secret"; secretFile = testSecretFile; }; # Use port other than default to test if settings options work. specialisation.settingsPort.configuration = { services.autobrr = { enable = true; secretFile = testSecretFile; settings.port = 7777; }; }; }; testScript = '' testScript = { nodes, ... }: let settingsPort = "${nodes.machine.system.build.toplevel}/specialisation/settingsPort"; in # python '' def test_webui(port): machine.wait_for_unit("autobrr.service") machine.wait_for_open_port(7474) machine.succeed("curl --fail http://localhost:7474/") machine.wait_for_open_port(port) machine.wait_until_succeeds(f"curl --fail http://localhost:{port}") test_webui(7474) machine.succeed("${settingsPort}/bin/switch-to-configuration test") test_webui(7777) ''; }