mirror of
https://github.com/Ahwxorg/nixos-config.git
synced 2025-12-04 06:50:14 +01:00
feat: create and enable hd-idle module
This commit is contained in:
parent
3b00c85ad1
commit
5ca085b6da
2 changed files with 23 additions and 1 deletions
|
|
@ -5,5 +5,6 @@
|
|||
++ [ (import ./immich.nix) ]
|
||||
++ [ (import ./nextcloud.nix) ]
|
||||
++ [ (import ./home-assistant.nix) ]
|
||||
++ [ (import ./smart-monitoring.nix) ];
|
||||
++ [ (import ./smart-monitoring.nix) ]
|
||||
++ [ (import ./hd-idle.nix) ];
|
||||
}
|
||||
|
|
|
|||
21
modules/services/hd-idle.nix
Normal file
21
modules/services/hd-idle.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
hdparm
|
||||
];
|
||||
|
||||
services.udev.extraRules =
|
||||
let
|
||||
mkRule = as: lib.concatStringsSep ", " as;
|
||||
mkRules = rs: lib.concatStringsSep "\n" rs;
|
||||
in
|
||||
mkRules ([
|
||||
(mkRule [
|
||||
''ACTION=="add|change"''
|
||||
''SUBSYSTEM=="block"''
|
||||
''KERNEL=="sd[a-z]"''
|
||||
''ATTR{queue/rotational}=="1"''
|
||||
''RUN+="${pkgs.hdparm}/bin/hdparm -B 90 -S 41 /dev/%k"''
|
||||
])
|
||||
]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue