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"
}
},
"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": {
"inputs": {
"flake-compat": [
@ -437,7 +457,8 @@
"nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",
"openconnect-sso": "openconnect-sso"
"openconnect-sso": "openconnect-sso",
"pp-to-amd-epp": "pp-to-amd-epp"
}
},
"rust-overlay": {

View File

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

View File

@ -4,6 +4,9 @@
# Enable power-profiles-daemon
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
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"