repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
fan-extras.nixNix30 lines1.4 KiBraw download
# modules/hosts/laptop/fan-extras.nix
#
# The part of the fan fix that `fanfix install` did imperatively on Arch and
# that fan-throttle-guard.nix (imported unchanged) does not carry: the
# "performance" power profile. power-profiles-daemon persists the choice, so
# this oneshot is idempotent; it runs after ppd is up and then re-applies the
# tmpfiles clock floor, because a profile switch rewrites per-policy boost and
# can lift scaling_max_freq (fanfix re-runs tmpfiles for the same reason; the
# stability guard would also catch it within a second).
{ ... }:
{
  flake.nixosModules.laptop-fan-extras =
  { pkgs, lib, ... }:
  {
    systemd.services.fanfix-performance-profile = {
      description = "fanfix: select the performance power profile and re-assert the clock floor";
      after = [ "power-profiles-daemon.service" "systemd-tmpfiles-setup.service" ];
      requires = [ "power-profiles-daemon.service" ];
      # graphical.target, not multi-user: on NixOS power-profiles-daemon is itself
      # ordered After=multi-user.target, so multi-user here is an ordering cycle.
      wantedBy = [ "graphical.target" ];
      serviceConfig = {
        Type = "oneshot";
        ExecStart = "${pkgs.power-profiles-daemon}/bin/powerprofilesctl set performance";
        ExecStartPost = "${pkgs.systemd}/bin/systemd-tmpfiles --create --prefix=/sys/devices/system/cpu";
      };
    };
  }
  ;
}