A script that automatically activates ASPM for all supported devices on Linux
  • Python 61.6%
  • Nix 38.4%
Find a file
2026-01-03 10:20:31 +01:00
modules Merge dev changes (#14) 2025-09-27 17:51:33 +02:00
pkgs Merge dev changes (#14) 2025-09-27 17:51:33 +02:00
.gitignore Package the script properly for NixOS (#12) 2025-09-27 13:35:15 +02:00
flake.lock Package the script properly for NixOS (#12) 2025-09-27 13:35:15 +02:00
flake.nix Merge dev changes (#14) 2025-09-27 17:51:33 +02:00
README.md Modify README 2026-01-03 10:20:31 +01:00

AutoASPM

A Python script that automatically activates ASPM for all supported devices on Linux.

It parses the lspci -vv output to determine which ASPM level is supported by a device (e.g. L0s, L0sL1 or L1).

Dependencies

  • pciutils
  • python3
  • which

Usage

NixOS - Run once

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

NixOS - Install permanently

  1. Add this repository to your flake.nix:
{
  inputs.autoaspm = {
    url = "git+https://git.notthebe.ee/notthebee/AutoASPM";
    # NOTE: optionally your flake's `nixpkgs`
    # inputs.nixpkgs.follows = "nixpkgs";
  };
  # ...
}
  1. Import the AutoASPM Nix module in your nixosConfiguration (assuming access to your flake's inputs as a specialArg):
{ inputs, pkgs, lib, ... }:
{
  imports = [
    inputs.autoaspm.nixosModules.default
  ];

  # ...
}
  1. Enable the AutoASPM service in your configuration:
{
  # ...

  services.autoaspm.enable = true;
}
  1. ???
  2. Profit

Other Linux distributions

  1. Clone this repository

  2. Run sudo ./pkgs/autoaspm.py

Credits