From 1547ceaf6ba5559e4fff563634e4e5fd6af9efe9 Mon Sep 17 00:00:00 2001 From: Ricky Lopez <31072564+rickyelopez@users.noreply.github.com> Date: Fri, 5 Sep 2025 08:23:51 -0700 Subject: [PATCH] dell-bios-fan-control: init module --- doc/release-notes/rl-2605.section.md | 2 + nixos/modules/module-list.nix | 1 + .../hardware/dell-bios-fan-control.nix | 49 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 nixos/modules/services/hardware/dell-bios-fan-control.nix diff --git a/doc/release-notes/rl-2605.section.md b/doc/release-notes/rl-2605.section.md index 9db267c03daf..e057adfcc8f3 100644 --- a/doc/release-notes/rl-2605.section.md +++ b/doc/release-notes/rl-2605.section.md @@ -31,6 +31,8 @@ If your SQLite database is corrupted, the migration might fail and require [manual intervention](https://github.com/louislam/uptime-kuma/issues/5281). See the [migration guide](https://github.com/louislam/uptime-kuma/wiki/Migration-From-v1-To-v2) for more information. +- Added `dell-bios-fan-control` package and service. + - We now use the upstream wrapper script for Gradle, supporting both the `JAVA_HOME` and `GRADLE_OPTS` environment variables. ## Nixpkgs Library {#sec-nixpkgs-release-26.05-lib} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 7d79b5132253..14bb0789762e 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -651,6 +651,7 @@ ./services/hardware/buffyboard.nix ./services/hardware/ddccontrol.nix ./services/hardware/deepcool-digital-linux.nix + ./services/hardware/dell-bios-fan-control.nix ./services/hardware/display.nix ./services/hardware/fancontrol.nix ./services/hardware/freefall.nix diff --git a/nixos/modules/services/hardware/dell-bios-fan-control.nix b/nixos/modules/services/hardware/dell-bios-fan-control.nix new file mode 100644 index 000000000000..66a02714b9e0 --- /dev/null +++ b/nixos/modules/services/hardware/dell-bios-fan-control.nix @@ -0,0 +1,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"; + }; + }; + }; +}