From 11e921446423582836fb5b290e053fc7c6643efe Mon Sep 17 00:00:00 2001 From: Wolfgang Date: Sat, 3 Jan 2026 10:20:31 +0100 Subject: [PATCH 1/2] Modify README --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cbf4c9a..7a49220 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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"; }; - # ... } ``` From 43ef51ecbd1feb34c3cacb1183f1b29a7d096f57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20R=C3=BCberg?= Date: Thu, 7 Aug 2025 16:11:58 +0200 Subject: [PATCH 2/2] Switch to shutil which implementation --- pkgs/autoaspm.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/autoaspm.py b/pkgs/autoaspm.py index d461dec..1a05ead 100644 --- a/pkgs/autoaspm.py +++ b/pkgs/autoaspm.py @@ -9,6 +9,7 @@ import os import platform from enum import Enum +from shutil import which class ASPM(Enum): DISABLED = 0b00 @@ -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")