From 074898e0dbd033a4f88977f866c54c5b7205a3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Wed, 17 Jul 2013 01:53:30 +0200 Subject: [PATCH] apcupsd: new package apcupsd is a daemon for controlling APC UPSes. --- pkgs/servers/apcupsd/default.nix | 54 ++++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 56 insertions(+) create mode 100644 pkgs/servers/apcupsd/default.nix diff --git a/pkgs/servers/apcupsd/default.nix b/pkgs/servers/apcupsd/default.nix new file mode 100644 index 000000000000..45688ee7fd9f --- /dev/null +++ b/pkgs/servers/apcupsd/default.nix @@ -0,0 +1,54 @@ +{ stdenv, fetchurl, pkgconfig, systemd, utillinux, coreutils, nettools, man +, enableCgiScripts ? true, gd +}: + +stdenv.mkDerivation rec { + pname = "apcupsd"; + name = "${pname}-3.14.10"; + + src = fetchurl { + url = "https://sourceforge/${pname}/${name}.tar.gz"; + sha256 = "0ci0xyg1hzj8lnmm3vxfsvgpb3wdgh1ii3gb8jgdxyqnk7nba1q7"; + }; + + buildInputs = [ pkgconfig utillinux man ] ++ stdenv.lib.optional enableCgiScripts gd; + + # ./configure ignores --prefix, so we must specify some paths manually + # There is no real reason for a bin/sbin split, so just use bin. + preConfigure = '' + export ac_cv_path_SHUTDOWN=${systemd}/sbin/shutdown + export ac_cv_path_WALL=${utillinux}/bin/wall + sed -i 's|/bin/cat|${coreutils}/bin/cat|' configure + export configureFlags="\ + --bindir=$out/bin \ + --sbindir=$out/bin \ + --sysconfdir=$out/etc/apcupsd \ + --mandir=$out/share/man \ + --with-halpolicydir=$out/share/halpolicy \ + --localstatedir=/var/ \ + --with-nologin=/etc \ + --with-log-dir=/var/log/apcupsd \ + --with-pwrfail-dir=/run/apcupsd \ + --with-lock-dir=/run/lock \ + --with-pid-dir=/run \ + --enable-usb \ + ${stdenv.lib.optionalString enableCgiScripts "--enable-cgi --with-cgi-bin=$out/libexec/cgi-bin"} + " + ''; + + postInstall = '' + for file in "$out"/etc/apcupsd/*; do + sed -i -e 's|^WALL=.*|WALL="${utillinux}/bin/wall"|g' \ + -e 's|^HOSTNAME=.*|HOSTNAME="${nettools}/bin/hostname"|g' \ + "$file" + done + ''; + + meta = with stdenv.lib; { + description = "A daemon for controlling APC UPSes"; + homepage = http://www.apcupsd.com/; + license = licenses.gpl2; + platforms = platforms.linux; + maintainers = [ maintainers.bjornfor ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a8b2370d1f53..2237430ce7de 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5822,6 +5822,8 @@ let sslSupport = true; }); + apcupsd = callPackage ../servers/apcupsd { }; + sabnzbd = callPackage ../servers/sabnzbd { }; bind = callPackage ../servers/dns/bind { };