A GPU task manager for Windows, Linux, and WSL: per-process VRAM, GPU activity, and LLM model/KV-cache insights (Windows AMD and NVIDIA).
Python
Add a Nix flake for NixOS
jihoo5de426b61f82
diff --git a/.gitignore b/.gitignoreindex ecaad54..cbd503e 100644--- a/.gitignore+++ b/.gitignore@@ -24,4 +24,6 @@ wheels/htmlcov/.pytest_cache/.ruff_cache/+result+result-*captures/diff --git a/README.md b/README.mdindex d80f2a6..e254948 100644--- a/README.md+++ b/README.md@@ -266,6 +266,39 @@ That is one machine and driver, not a guarantee. A process that started long befthe GPU can break the start-order guess, and processes started in the same refresh are ordered byguess unless their sizes match.+### NixOS++With flakes enabled, run directly from this checkout:++```bash+nix run path:.+nix run path:. -- --list-gpus+nix run path:. -- --once+nix run path:. -- --json+```++Build both `gputaskman` and its `gtm` alias with `nix build path:.` (executables are in+`result/bin/`). The flake provides packages for `x86_64-linux` and `aarch64-linux`; `flake.lock`+pins nixpkgs. Dependencies come from nixpkgs, independently of `uv.lock`. No pip installation,+virtual environment, CUDA Toolkit, or ROCm installation is needed. GPU drivers remain supplied by+the host, never bundled with the package. NVIDIA's nixpkgs Python binding finds NVML through+`/run/opengl-driver/lib`; AMD uses kernel sysfs and DRM fdinfo interfaces directly.++For source development and tests:++```bash+nix develop path:.+python -m gputaskman --once+python -m unittest discover -s tests -q+```++`nix flake check path:.` builds the package and runs the same hardware-independent tests.+For a flake-based NixOS configuration, add this repository as a `gputaskman` input, then include+`inputs.gputaskman.packages.${pkgs.stdenv.hostPlatform.system}.default` in+`environment.systemPackages`. Enable your GPU's normal NixOS driver configuration first.+The flake was contributed and checked on x86_64 NixOS 26.05; CI does not build it, and ARM64 has+not been validated.+## macOS (Apple Silicon)Run from a clone (`uv run gputaskman`); there is no portable macOS download yet. Apple GPUs sharediff --git a/flake.lock b/flake.locknew file mode 100644index 0000000..a884b2d--- /dev/null+++ b/flake.lock@@ -0,0 +1,27 @@+{+ "nodes": {+ "nixpkgs": {+ "locked": {+ "lastModified": 1793726008,+ "narHash": "sha256-jQp1wKvbwWdLBASTXkSi/VYmDJ5AbBi1WvcMt9HWJC8=",+ "owner": "NixOS",+ "repo": "nixpkgs",+ "rev": "1d060086d60cb76a40cf37109f979d88a5bd6396",+ "type": "github"+ },+ "original": {+ "owner": "NixOS",+ "ref": "nixos-unstable",+ "repo": "nixpkgs",+ "type": "github"+ }+ },+ "root": {+ "inputs": {+ "nixpkgs": "nixpkgs"+ }+ }+ },+ "root": "root",+ "version": 7+}diff --git a/flake.nix b/flake.nixnew file mode 100644index 0000000..44e9aa3--- /dev/null+++ b/flake.nix@@ -0,0 +1,80 @@+{+ description = "GPU Task Manager for Linux";++ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";++ outputs = { self, nixpkgs }:+ let+ systems = [ "x86_64-linux" "aarch64-linux" ];+ forAllSystems = nixpkgs.lib.genAttrs systems;+ in {+ packages = forAllSystems (system:+ let+ pkgs = nixpkgs.legacyPackages.${system};+ project = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).project;+ pythonSource = path: pkgs.lib.fileset.fileFilter+ (file: !(pkgs.lib.hasSuffix ".pyc" file.name || pkgs.lib.hasSuffix ".pyo" file.name)) path;+ in {+ default = self.packages.${system}.gputaskman;+ gputaskman = pkgs.python3Packages.buildPythonApplication {+ pname = project.name;+ version = project.version;+ pyproject = true;+ src = pkgs.lib.fileset.toSource {+ root = ./.;+ fileset = pkgs.lib.fileset.unions [+ ./pyproject.toml ./README.md ./LICENSE+ (pythonSource ./src) (pythonSource ./tests) (pythonSource ./tools)+ ];+ };+ build-system = [ pkgs.python3Packages.uv-build ];+ # Nixpkgs supplies the backend; accept its newer release only in+ # this build. The resulting wheel and the full test suite are checked.+ postPatch = ''+ substituteInPlace pyproject.toml \+ --replace-fail 'uv_build>=0.9.26,<0.10.0' 'uv_build>=0.9.26,<0.13.0'+ '';+ dependencies = with pkgs.python3Packages; [ nvidia-ml-py psutil textual ];+ checkPhase = ''+ runHook preCheck+ python -m unittest discover -s tests -q+ runHook postCheck+ '';+ pythonImportsCheck = [ "gputaskman.cli" "gputaskman.app" ];+ meta = {+ inherit (project) description;+ homepage = project.urls.Repository;+ license = pkgs.lib.licenses.mit;+ mainProgram = "gputaskman";+ platforms = systems;+ };+ };+ });++ apps = forAllSystems (system: {+ default = {+ type = "app";+ program = "${self.packages.${system}.gputaskman}/bin/gputaskman";+ meta.description = "GPU Task Manager";+ };+ });++ devShells = forAllSystems (system:+ let pkgs = nixpkgs.legacyPackages.${system};+ in {+ default = pkgs.mkShell {+ packages = [+ (pkgs.python3.withPackages (ps: with ps; [ nvidia-ml-py psutil textual uv-build ]))+ pkgs.uv+ ];+ shellHook = ''+ export PYTHONPATH="$PWD/src''${PYTHONPATH:+:$PYTHONPATH}"+ '';+ };+ });++ checks = forAllSystems (system: {+ gputaskman = self.packages.${system}.gputaskman;+ });+ };+}