2025-08-17 10:37:51 -04:00

55 lines
1.5 KiB
Nix

# unpackPhase
# patchPhase
# configurePhase
# buildPhase
# checkPhase
# installPhase
# fixupPhase
# installCheckPhase
# distPhase
{
stdenv,
pkgs,
sqlite,
makeWrapper,
lib,
python3,
...
}:
stdenv.mkDerivation {
name = "amd_s2idle";
src = pkgs.fetchgit {
url = "https://gitlab.freedesktop.org/drm/amd.git";
rev = "0f486d26c05044cebe2c61143bfd56899eef716f";
sha256 = "sha256-Q1QTaxuvtVKEizO7OHudhcZzxrgcYRgGJOvLDQPMGZ0=";
};
buildInputs = [ ];
nativeBuildInputs = [ makeWrapper ];
phases = [
"installPhase"
# "fixupPhase"
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp $src/scripts/amd_s2idle.py $out/bin/amd_s2idle
runHook postInstall
'';
postInstall = ''
sed -i 's@#!/usr/bin/python3@#!/usr/bin/env python3@g' $out/bin/amd_s2idle
wrapProgram $out/bin/amd_s2idle --prefix PATH : ${
lib.makeBinPath [
(python3.withPackages (python-pkgs: [
python-pkgs.distro # For https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py
python-pkgs.pyudev # For https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py
python-pkgs.systemd # For https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py
python-pkgs.packaging # For https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py
]))
]
}
'';
# fixupPhase = ''
# patchShebangs $out/bin/.amd_s2idle-wrapped
# '';
}