From 87f35f3bb375a43e31f357a019b3d0281473369c Mon Sep 17 00:00:00 2001 From: coolneng Date: Wed, 26 May 2021 11:53:07 +0200 Subject: [PATCH] Spin down the HDDs when not in use --- configuration.nix | 6 +++++- modules/periodic.nix | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 modules/periodic.nix diff --git a/configuration.nix b/configuration.nix index 2d9b4a6..5a0b3af 100644 --- a/configuration.nix +++ b/configuration.nix @@ -97,6 +97,10 @@ services.journald.extraConfig = "SystemMaxFiles=7"; # Import other configuration modules - imports = [ ./modules/hardware-configuration.nix ./modules/networking.nix ]; + imports = [ + ./modules/hardware-configuration.nix + ./modules/networking.nix + ./modules/periodic.nix + ]; } diff --git a/modules/periodic.nix b/modules/periodic.nix new file mode 100644 index 0000000..8348a34 --- /dev/null +++ b/modules/periodic.nix @@ -0,0 +1,13 @@ +{ config, lib, pkgs, ... }: + +{ + # Idle HDDs when not used + systemd.services.hd-idle = { + description = "Idle HDDs when not in use"; + wantedBy = [ "default.target" ]; + path = with pkgs; [ hd-idle ]; + script = "${pkgs.hd-idle}/bin/hd-idle"; + serviceConfig.Type = "simple"; + after = [ "shield-unit.mount" ]; + }; +}