all repos — dotfiles @ 11f0020301b3d3446b27b60aeaf948664e96b15f

my *nix dotfiles

bin/cputil.nix (view raw)

 1{ pkgs, ... }:
 2
 3let
 4  name = "cputil";
 5  cpufreqctl = "${pkgs.auto-cpufreq}/bin/cpufreqctl.auto-cpufreq";
 6  asusctl = "${pkgs.asusctl}/bin/asusctl";
 7in
 8pkgs.writeShellScriptBin name
 9  ''
10    mode="$1"
11    case "$mode" in
12      "perf")
13        doas ${cpufreqctl} --governor --set=performance
14        ${asusctl} profile -P performance
15        ;;
16      "save")
17        doas ${cpufreqctl} --governor --set=powersave
18        ${asusctl} profile -P quiet
19        printf "\n"
20    esac
21  ''
22