From 6dde6bf3bf129ca6c84a9472c7c210fd86fd7465 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Sun, 2 May 2021 21:52:57 -0600 Subject: [PATCH 1/2] airsonic: force use of jre8 --- nixos/modules/services/misc/airsonic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/airsonic.nix b/nixos/modules/services/misc/airsonic.nix index 5cc2ff7f4bd1..a572f1f6d6f5 100644 --- a/nixos/modules/services/misc/airsonic.nix +++ b/nixos/modules/services/misc/airsonic.nix @@ -118,7 +118,7 @@ in { ''; serviceConfig = { ExecStart = '' - ${pkgs.jre}/bin/java -Xmx${toString cfg.maxMemory}m \ + ${pkgs.jre8}/bin/java -Xmx${toString cfg.maxMemory}m \ -Dairsonic.home=${cfg.home} \ -Dserver.address=${cfg.listenAddress} \ -Dserver.port=${toString cfg.port} \ From 1ce3067c425d7a105ea0bc133de255c9815e495f Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Mon, 3 May 2021 09:38:02 -0600 Subject: [PATCH 2/2] airsonic: add test for module --- nixos/tests/airsonic.nix | 32 ++++++++++++++++++++++++++ nixos/tests/all-tests.nix | 1 + pkgs/servers/misc/airsonic/default.nix | 6 ++++- 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/airsonic.nix diff --git a/nixos/tests/airsonic.nix b/nixos/tests/airsonic.nix new file mode 100644 index 000000000000..59bd84877c61 --- /dev/null +++ b/nixos/tests/airsonic.nix @@ -0,0 +1,32 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "airsonic"; + meta = with pkgs.lib.maintainers; { + maintainers = [ sumnerevans ]; + }; + + machine = + { pkgs, ... }: + { + services.airsonic = { + enable = true; + maxMemory = 800; + }; + + # Airsonic is a Java application, and unfortunately requires a significant + # amount of memory. + virtualisation.memorySize = 1024; + }; + + testScript = '' + def airsonic_is_up(_) -> bool: + return machine.succeed("curl --fail http://localhost:4040/login") + + + machine.start() + machine.wait_for_unit("airsonic.service") + machine.wait_for_open_port(4040) + + with machine.nested("Waiting for UI to work"): + retry(airsonic_is_up) + ''; +}) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 9043ab144abe..e39c525a604a 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -24,6 +24,7 @@ in _3proxy = handleTest ./3proxy.nix {}; acme = handleTest ./acme.nix {}; agda = handleTest ./agda.nix {}; + airsonic = handleTest ./airsonic.nix {}; amazon-init-shell = handleTest ./amazon-init-shell.nix {}; ammonite = handleTest ./ammonite.nix {}; atd = handleTest ./atd.nix {}; diff --git a/pkgs/servers/misc/airsonic/default.nix b/pkgs/servers/misc/airsonic/default.nix index bd8310bc74f7..8fba050ffade 100644 --- a/pkgs/servers/misc/airsonic/default.nix +++ b/pkgs/servers/misc/airsonic/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl }: +{ lib, stdenv, fetchurl, nixosTests }: stdenv.mkDerivation rec { pname = "airsonic"; @@ -14,6 +14,10 @@ stdenv.mkDerivation rec { cp "$src" "$out/webapps/airsonic.war" ''; + passthru.tests = { + airsonic-starts = nixosTests.airsonic; + }; + meta = with lib; { description = "Personal media streamer"; homepage = "https://airsonic.github.io";