nixpkgs/pkgs/by-name/ze/zenstates/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

54 lines
1.5 KiB
Nix

# 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" ];
# };
{ lib, stdenv, fetchFromGitHub, python3 }:
stdenv.mkDerivation rec {
pname = "zenstates";
version = "0.0.1";
src = fetchFromGitHub {
owner = "r4m0n";
repo = "ZenStates-Linux";
rev = "0bc27f4740e382f2a2896dc1dabfec1d0ac96818";
sha256 = "1h1h2n50d2cwcyw3zp4lamfvrdjy1gjghffvl3qrp6arfsfa615y";
};
buildInputs = [ python3 ];
installPhase = ''
mkdir -p $out/bin
cp $src/zenstates.py $out/bin/zenstates
chmod +x $out/bin/zenstates
patchShebangs --build $out/bin/zenstates
'';
meta = with lib; {
description = "Linux utility for Ryzen processors and motherboards";
mainProgram = "zenstates";
homepage = "https://github.com/r4m0n/ZenStates-Linux";
license = licenses.mit;
maintainers = with maintainers; [ savannidgerinel ];
platforms = platforms.linux;
};
}