Skip to content
This repository was archived by the owner on Dec 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ a device (e.g. L0s, L0sL1 or L1).
### NixOS - Run once

```bash
sudo nix run github:notthebee/AutoASPM
sudo nix run git+https://git.notthebe.ee/notthebee/AutoASPM
```

### NixOS - Install permanently
Expand All @@ -26,11 +26,10 @@ sudo nix run github:notthebee/AutoASPM
```nix
{
inputs.autoaspm = {
url = "github:notthebee/AutoASPM?shallow=true";
url = "git+https://git.notthebe.ee/notthebee/AutoASPM";
# NOTE: optionally your flake's `nixpkgs`
# inputs.nixpkgs.follows = "nixpkgs";
};

# ...
}
```
Expand Down
7 changes: 3 additions & 4 deletions pkgs/autoaspm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import os
import platform
from enum import Enum
from shutil import which

class ASPM(Enum):
DISABLED = 0b00
Expand All @@ -22,11 +23,9 @@ def run_prerequisites():
raise OSError("This script only runs on Linux-based systems")
if not os.environ.get("SUDO_UID") and os.geteuid() != 0:
raise PermissionError("This script needs root privileges to run")
lspci_detected = subprocess.run(["which", "lspci"], stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL)
if lspci_detected.returncode > 0:
if which("lspci") is None:
raise Exception("lspci not detected. Please install pciutils")
lspci_detected = subprocess.run(["which", "setpci"], stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL)
if lspci_detected.returncode > 0:
if which("setpci") is None:
raise Exception("setpci not detected. Please install pciutils")


Expand Down