Add amd_s2idle script for debugging s2idle.

This commit is contained in:
Tom Alexander 2025-08-17 09:37:06 -04:00
parent 748584c78e
commit b224a78b89
No known key found for this signature in database
GPG Key ID: D3A179C9A53C0EDE
5 changed files with 116 additions and 0 deletions

View File

@ -9,6 +9,7 @@
imports = [ imports = [
./roles/2ship2harkinian ./roles/2ship2harkinian
./roles/alacritty ./roles/alacritty
./roles/amd_s2idle
./roles/ansible ./roles/ansible
./roles/ares ./roles/ares
./roles/bluetooth ./roles/bluetooth

View File

@ -59,6 +59,7 @@
# services.fstrim.enable = lib.mkDefault true; # services.fstrim.enable = lib.mkDefault true;
me.alacritty.enable = true; me.alacritty.enable = true;
me.amd_s2idle.enable = true;
me.ansible.enable = true; me.ansible.enable = true;
me.ares.enable = true; me.ares.enable = true;
me.bluetooth.enable = true; me.bluetooth.enable = true;

View File

@ -54,6 +54,7 @@
me.rpcs3.config.Core."Use LLVM CPU" = "znver4"; me.rpcs3.config.Core."Use LLVM CPU" = "znver4";
me.alacritty.enable = true; me.alacritty.enable = true;
me.amd_s2idle.enable = true;
me.ansible.enable = true; me.ansible.enable = true;
me.ares.enable = true; me.ares.enable = true;
me.bluetooth.enable = true; me.bluetooth.enable = true;

View File

@ -0,0 +1,59 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [ ];
options.me = {
amd_s2idle.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Whether we want to install amd_s2idle.";
};
};
config = lib.mkIf config.me.amd_s2idle.enable (
lib.mkMerge [
{
environment.systemPackages = with pkgs; [
amd_s2idle
];
nixpkgs.overlays = [
(
final: prev:
let
innerPackage = (final.callPackage ./package.nix { });
in
{
amd_s2idle = innerPackage;
# amd_s2idle = final.buildEnv {
# name = innerPackage.name;
# paths = [
# innerPackage
# ];
# nativeBuildInputs = [ final.makeWrapper ];
# postBuild = ''
# wrapProgram $out/bin/amd_s2idle --prefix PATH : ${
# lib.makeBinPath [
# (final.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
# ]))
# ]
# }
# '';
# };
}
)
];
}
]
);
}

View File

@ -0,0 +1,54 @@
# 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
# '';
}