New hdapsd module

This commit is contained in:
Emery 2016-02-24 21:43:38 +01:00
parent 838805f5c8
commit b16dc8dcc5
4 changed files with 34 additions and 2 deletions

View File

@ -257,6 +257,7 @@
./services/monitoring/dd-agent.nix
./services/monitoring/grafana.nix
./services/monitoring/graphite.nix
./services/monitoring/hdaps.nix
./services/monitoring/heapster.nix
./services/monitoring/longview.nix
./services/monitoring/monit.nix

View File

@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.hdapsd;
hdapsd = [ pkgs.hdapsd ];
in
{
options = {
services.hdapsd.enable = mkEnableOption
''
Hard Drive Active Protection System Daemon,
devices are detected and managed automatically by udev and systemd
'';
};
config = mkIf cfg.enable {
services.udev.packages = hdapsd;
systemd.packages = hdapsd;
};
}

View File

@ -2,13 +2,15 @@
let version = "20141203"; in
stdenv.mkDerivation rec {
name = "ldapsd-"+version;
name = "hdapsd-"+version;
src = fetchurl {
url = "https://github.com/evgeni/hdapsd/releases/download/${version}/hdapsd-${version}.tar.gz";
sha256 = "0ppgrfabd0ivx9hyny3c3rv4rphjyxcdsd5svx5pgfai49mxnl36";
};
postInstall = builtins.readFile ./postInstall.sh;
meta = with stdenv.lib;
{ description = "Hard Drive Active Protection System Daemon";
hompage = "http://hdaps.sf.net/";
@ -16,4 +18,4 @@ stdenv.mkDerivation rec {
platforms = platforms.linux;
maintainers = [ maintainers.ehmry ];
};
}
}

View File

@ -0,0 +1,7 @@
mkdir -p $out/lib/udev/rules.d $out/lib/systemd/system
cp misc/hdapsd.rules $out/lib/udev/rules.d
SBIN_REWRITE="s|@sbindir@|$out/bin|g"
for i in misc/*.service.in
do sed $SBIN_REWRITE "$i" > "$out/lib/systemd/system/$(basename ${i%.in})"
done