blob: 66a02714b9e0a76126a4951848de463f1a5bd6dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
{
config,
pkgs,
lib,
...
}:
let
cfg = config.services.hardware.dell-bios-fan-control;
in
{
meta.maintainers = with lib.maintainers; [ rickyelopez ];
options.services.hardware.dell-bios-fan-control = {
enable = lib.mkEnableOption "One-shot service to disable dell bios fan control on startup";
package = lib.mkPackageOption pkgs "dell-bios-fan-control" { };
};
config = lib.mkIf cfg.enable {
boot.kernelModules = [ "i8k" ];
environment.systemPackages = [ cfg.package ];
# see ref in aur: https://aur.archlinux.org/cgit/aur.git/tree/dell-bios-fan-control.service?h=dell-bios-fan-control-git
systemd.services.dell-bios-fan-control = {
description = "Disables BIOS control of fans at boot.";
wants = [ "dell-bios-fan-control-resume.service" ];
wantedBy = [ "multi-user.target" ];
before = [ "i8kmon.service" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${lib.getExe cfg.package} 0";
ExecStop = "${lib.getExe cfg.package} 1";
};
};
# see ref in aur: https://aur.archlinux.org/cgit/aur.git/tree/dell-bios-fan-control-resume.service?h=dell-bios-fan-control-git
systemd.services.dell-bios-fan-control-resume = {
description = "Restart dell-bios-fan-control on resume.";
wants = [ "dell-bios-fan-control.service" ];
wantedBy = [ "suspend.target" ];
after = [ "suspend.target" ];
serviceConfig = {
Type = "oneshot";
# re: sleep, see: https://github.com/NixOS/nixpkgs/pull/439978#discussion_r2404279441
ExecStartPre = "${pkgs.coreutils}/bin/sleep 30";
ExecStart = "${config.systemd.package}/bin/systemctl restart dell-bios-fan-control.service";
};
};
};
}
|