Couple power-profiles-daemon and AMD P-State EPP

This commit is contained in:
coolneng 2024-01-09 13:55:49 +01:00
parent 93f2da8b1f
commit 470a70148a
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
3 changed files with 35 additions and 7 deletions

View File

@ -397,6 +397,26 @@
"type": "github" "type": "github"
} }
}, },
"pp-to-amd-epp": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1700307756,
"narHash": "sha256-PlinfzkBIWJMO9y2kb1b/1CArG6pMJZ6wyolNMdKSJM=",
"owner": "marcinx64",
"repo": "pp-to-amd-epp",
"rev": "0fbac782cd32313864b4e5a0ff975673d6ceda6e",
"type": "github"
},
"original": {
"owner": "marcinx64",
"repo": "pp-to-amd-epp",
"type": "github"
}
},
"pre-commit-hooks-nix": { "pre-commit-hooks-nix": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -437,7 +457,8 @@
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"openconnect-sso": "openconnect-sso" "openconnect-sso": "openconnect-sso",
"pp-to-amd-epp": "pp-to-amd-epp"
} }
}, },
"rust-overlay": { "rust-overlay": {

View File

@ -32,14 +32,17 @@
url = "github:nix-community/lanzaboote/v0.3.0"; url = "github:nix-community/lanzaboote/v0.3.0";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
pp-to-amd-epp = {
url = "github:marcinx64/pp-to-amd-epp";
inputs.nixpkgs.follows = "nixpkgs";
};
local-bitwig = { local-bitwig = {
url = "path:/home/coolneng/Projects/panacea/assets/bitwig"; url = "path:/home/coolneng/Projects/panacea/assets/bitwig";
flake = false; flake = false;
}; };
}; };
outputs = { self, nixpkgs, nixos-hardware, agenix, nix-index-database outputs = { self, nixpkgs, ... }@inputs:
, lanzaboote, ... }@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
@ -62,10 +65,11 @@
inherit system; inherit system;
modules = [ modules = [
(import ./configuration.nix) (import ./configuration.nix)
nixos-hardware.nixosModules.lenovo-thinkpad-e14-amd inputs.nixos-hardware.nixosModules.lenovo-thinkpad-e14-amd
agenix.nixosModules.age inputs.agenix.nixosModules.age
nix-index-database.nixosModules.nix-index inputs.nix-index-database.nixosModules.nix-index
lanzaboote.nixosModules.lanzaboote inputs.lanzaboote.nixosModules.lanzaboote
inputs.pp-to-amd-epp.nixosModules.pp-to-amd-epp
]; ];
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;

View File

@ -4,6 +4,9 @@
# Enable power-profiles-daemon # Enable power-profiles-daemon
services.power-profiles-daemon.enable = true; services.power-profiles-daemon.enable = true;
# Integration of AMD P-State EPP with power-profiles-daemon
services.pp-to-amd-epp.enable = true;
# Suspend when the battery is critical and autosuspend USB and PCI # Suspend when the battery is critical and autosuspend USB and PCI
services.udev.extraRules = '' services.udev.extraRules = ''
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{model_name}=="01AV405", ATTR{capacity}=="[0-5]", RUN+="${config.systemd.package}/bin/systemctl suspend -i" SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{model_name}=="01AV405", ATTR{capacity}=="[0-5]", RUN+="${config.systemd.package}/bin/systemctl suspend -i"