summary refs log tree commit diff
path: root/pkgs/os-specific/linux/zenstates
diff options
context:
space:
mode:
authorSavanni D'Gerinel <savanni@luminescent-dreams.com>2020-04-23 22:08:34 -0400
committerSavanni D'Gerinel <savanni@luminescent-dreams.com>2020-04-23 22:08:34 -0400
commitbfe072dc4b29d7ecc687e8e3af29466ec3d81481 (patch)
tree0ae0e7afc1d062b7c7beb01fbdd7c0cec99049f6 /pkgs/os-specific/linux/zenstates
parent5e6adf78e9644e24ca494c3ba64400e5eea5bd1d (diff)
downloadnixpkgs-bfe072dc4b29d7ecc687e8e3af29466ec3d81481.tar
nixpkgs-bfe072dc4b29d7ecc687e8e3af29466ec3d81481.tar.gz
nixpkgs-bfe072dc4b29d7ecc687e8e3af29466ec3d81481.tar.bz2
nixpkgs-bfe072dc4b29d7ecc687e8e3af29466ec3d81481.tar.lz
nixpkgs-bfe072dc4b29d7ecc687e8e3af29466ec3d81481.tar.xz
nixpkgs-bfe072dc4b29d7ecc687e8e3af29466ec3d81481.tar.zst
nixpkgs-bfe072dc4b29d7ecc687e8e3af29466ec3d81481.zip
Add a Zenstates derivation
Diffstat (limited to 'pkgs/os-specific/linux/zenstates')
-rw-r--r--pkgs/os-specific/linux/zenstates/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/zenstates/default.nix b/pkgs/os-specific/linux/zenstates/default.nix
new file mode 100644
index 00000000000..b54ff669266
--- /dev/null
+++ b/pkgs/os-specific/linux/zenstates/default.nix
@@ -0,0 +1,54 @@
+# Zenstates provides access to a variety of CPU tunables no Ryzen processors.
+#
+# In particular, I am adding Zenstates because I need it to disable the C6
+# sleep state to stabilize wake from sleep on my Lenovo x395 system. After
+# installing Zenstates, I need a before-sleep script like so:
+#
+# before-sleep = pkgs.writeScript "before-sleep" ''
+#   #!${pkgs.bash}/bin/bash
+#   ${pkgs.zenstates}/bin/zenstates --c6-disable
+# '';
+#
+# ...
+#
+# systemd.services.before-sleep = {
+#     description = "Jobs to run before going to sleep";
+#     serviceConfig = {
+#       Type = "oneshot";
+#       ExecStart = "${before-sleep}";
+#     };
+#     wantedBy = [ "sleep.target" ];
+#     before = [ "sleep.target" ];
+#   };
+
+{ stdenv, fetchFromGitHub, python3 }:
+stdenv.mkDerivation rec {
+  pname = "zenstates";
+  version = "0.1.0";
+
+  src = fetchFromGitHub {
+    owner = "r4m0n";
+    repo = "ZenStates-Linux";
+    rev = "0bc27f4740e382f2a2896dc1dabfec1d0ac96818";
+    sha256 = "1h1h2n50d2cwcyw3zp4lamfvrdjy1gjghffvl3qrp6arfsfa615y";
+  };
+
+  buildInputs = [ python3 ];
+
+  phases = [ "installPhase" ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp $src/zenstates.py $out/bin/zenstates
+    chmod +x $out/bin/zenstates
+    patchShebangs --build $out/bin/zenstates
+    '';
+
+  meta = with stdenv.lib; {
+    description = "Linux utility for Ryzen processors and motherboards";
+    homepage = "https://github.com/r4m0n/ZenStates-Linux";
+    license = licenses.mit;
+    maintainers = with maintainers; [ savannidgerinel ];
+    platforms = platforms.linux;
+  };
+}