Personal Nix setup
at main 688 B view raw
1{ lib, config, pkgs, helpers, ... }: 2 3with lib; 4let 5 cfgRoot = config.modules.server; 6 cfg = config.modules.server.hd-idle; 7in helpers.linuxAttrs { 8 options.modules.server.hd-idle = { 9 enable = mkOption { 10 default = false; 11 example = true; 12 description = "Whether to enable hard-drive idling."; 13 type = types.bool; 14 }; 15 }; 16 17 config = mkIf (cfg.enable && cfgRoot.enable) { 18 systemd.services.hd-idle = { 19 description = "External HD spin down daemon"; 20 wantedBy = [ "multi-user.target" ]; 21 serviceConfig = { 22 Type = "simple"; 23 Restart = "always"; 24 ExecStart = "${pkgs.hd-idle}/bin/hd-idle -i 600"; 25 }; 26 }; 27 }; 28}