summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Fullmer <danielrf12@gmail.com>2020-04-11 13:28:52 -0400
committerDaniel Fullmer <danielrf12@gmail.com>2020-05-17 14:14:30 -0400
commit4f35b7ec5ffe927f71d0d4dc8c5e37c90fa056dd (patch)
tree50d21a99f1700a47b28813ae1b344b354f89861a
parente958afa0a9a12de3e623a464a922ac7f9455c0d0 (diff)
downloadnixpkgs-4f35b7ec5ffe927f71d0d4dc8c5e37c90fa056dd.tar
nixpkgs-4f35b7ec5ffe927f71d0d4dc8c5e37c90fa056dd.tar.gz
nixpkgs-4f35b7ec5ffe927f71d0d4dc8c5e37c90fa056dd.tar.bz2
nixpkgs-4f35b7ec5ffe927f71d0d4dc8c5e37c90fa056dd.tar.lz
nixpkgs-4f35b7ec5ffe927f71d0d4dc8c5e37c90fa056dd.tar.xz
nixpkgs-4f35b7ec5ffe927f71d0d4dc8c5e37c90fa056dd.tar.zst
nixpkgs-4f35b7ec5ffe927f71d0d4dc8c5e37c90fa056dd.zip
nixos/zoneminder: add minimal test
-rw-r--r--nixos/tests/all-tests.nix3
-rw-r--r--nixos/tests/zoneminder.nix23
-rw-r--r--pkgs/servers/zoneminder/default.nix7
3 files changed, 30 insertions, 3 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 5caf1c958fb..525e97c039e 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -348,6 +348,7 @@ in
   yabar = handleTest ./yabar.nix {};
   yggdrasil = handleTest ./yggdrasil.nix {};
   zfs = handleTest ./zfs.nix {};
-  zsh-history = handleTest ./zsh-history.nix {};
+  zoneminder = handleTest ./zoneminder.nix {};
   zookeeper = handleTest ./zookeeper.nix {};
+  zsh-history = handleTest ./zsh-history.nix {};
 }
diff --git a/nixos/tests/zoneminder.nix b/nixos/tests/zoneminder.nix
new file mode 100644
index 00000000000..a4e1a05ec0e
--- /dev/null
+++ b/nixos/tests/zoneminder.nix
@@ -0,0 +1,23 @@
+import ./make-test-python.nix ({ lib, ...}:
+
+{
+  name = "zoneminder";
+  meta.maintainers = with lib.maintainers; [ danielfullmer ];
+
+  machine = { ... }:
+  {
+    services.zoneminder = {
+      enable = true;
+      database.createLocally = true;
+      database.username = "zoneminder";
+    };
+    time.timeZone = "America/New_York";
+  };
+
+  testScript = ''
+    machine.wait_for_unit("zoneminder.service")
+    machine.wait_for_unit("nginx.service")
+    machine.wait_for_open_port(8095)
+    machine.succeed("curl --fail http://localhost:8095/")
+  '';
+})
diff --git a/pkgs/servers/zoneminder/default.nix b/pkgs/servers/zoneminder/default.nix
index 978893d28ff..8dcbe36850a 100644
--- a/pkgs/servers/zoneminder/default.nix
+++ b/pkgs/servers/zoneminder/default.nix
@@ -1,7 +1,7 @@
 { stdenv, lib, fetchFromGitHub, fetchurl, substituteAll, cmake, makeWrapper, pkgconfig
 , curl, ffmpeg, glib, libjpeg, libselinux, libsepol, mp4v2, libmysqlclient, mysql, pcre, perl, perlPackages
 , polkit, utillinuxMinimal, x264, zlib
-, coreutils, procps, psmisc }:
+, coreutils, procps, psmisc, nixosTests }:
 
 # NOTES:
 #
@@ -172,7 +172,10 @@ in stdenv.mkDerivation rec {
     "-DZM_WEB_GROUP=${user}"
   ];
 
-  passthru = { inherit dirName; };
+  passthru = {
+    inherit dirName;
+    tests = nixosTests.zoneminder;
+  };
 
   postInstall = ''
     PERL5LIB="$PERL5LIB''${PERL5LIB:+:}$out/${perl.libPrefix}"