From fb1b0c0372271f9ba8c732d0cbbcda9002998799 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 13 Jul 2011 17:47:34 +0000 Subject: [PATCH] modules/services/monitoring/smartd.nix: added support for running smart daemon Set "services.smartd.enable = true" to enable the service. svn path=/nixos/trunk/; revision=27767 --- modules/module-list.nix | 3 +- modules/services/monitoring/smartd.nix | 48 ++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 modules/services/monitoring/smartd.nix diff --git a/modules/module-list.nix b/modules/module-list.nix index ffc42eb02782..6bb0c9161890 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -15,7 +15,7 @@ ./hardware/network/intel-2100bg.nix ./hardware/network/intel-2200bg.nix ./hardware/network/intel-3945abg.nix - ./hardware/network/rt73.nix + ./hardware/network/rt73.nix ./hardware/pcmcia.nix ./installer/generations-dir/generations-dir.nix ./installer/grub/grub.nix @@ -83,6 +83,7 @@ ./services/misc/virtualbox.nix ./services/monitoring/monit.nix ./services/monitoring/nagios/default.nix + ./services/monitoring/smartd.nix ./services/monitoring/systemhealth.nix ./services/monitoring/zabbix-agent.nix ./services/monitoring/zabbix-server.nix diff --git a/modules/services/monitoring/smartd.nix b/modules/services/monitoring/smartd.nix new file mode 100644 index 000000000000..bf523d4f3f8c --- /dev/null +++ b/modules/services/monitoring/smartd.nix @@ -0,0 +1,48 @@ +{ config, pkgs, ... }: + +with pkgs.lib; + +let + + cfg = config.services.smartd; + +in + +{ + ###### interface + + options = { + + services.smartd = { + + enable = mkOption { + default = false; + type = types.bool; + example = "true"; + description = '' + Run smartd from the smartmontools package. + ''; + }; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + jobs.smartd = + { description = "S.M.A.R.T. Daemon"; + + startOn = "started syslogd"; + + daemonType = "daemon"; + + exec = "${pkgs.smartmontools}/sbin/smartd"; + }; + + }; + +}