From 5c13ac0ff9eb77af0e17e07464ddd7967b6baa56 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Tue, 30 Jun 2026 15:27:53 -0700 Subject: [PATCH] building on nixos --- .envrc | 1 + .gitignore | 1 + shell.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/.gitignore b/.gitignore index 1e2eaf1..b124d42 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__/ *.pyc cache/ .DS_Store +.direnv \ No newline at end of file diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..3cbdbf5 --- /dev/null +++ b/shell.nix @@ -0,0 +1,43 @@ +# Dev shell for building/running test-stand on NixOS. +# +# Provides the system libraries uv's venv can't: libusb (Crazyradio USB +# access via pyusb) and the GL/X11/font libs DearPyGui's bundled GLFW +# binary needs at runtime. Dependency management itself stays with uv — +# run `uv sync` then `uv run test-stand` as usual once inside this shell. +# +# Note: prebuilt-wheel binaries (e.g. dearpygui) won't load on NixOS at +# all unless `programs.nix-ld.enable = true;` is set system-wide, since +# their ELF interpreter expects a dynamic loader at a standard FHS path +# that NixOS doesn't provide by default. +{ pkgs ? import {} }: + +let + libPath = pkgs.lib.makeLibraryPath (with pkgs; [ + libusb1 + libGL + libGLU + vulkan-loader + xorg.libX11 + xorg.libXrandr + xorg.libXinerama + xorg.libXcursor + xorg.libXi + xorg.libXext + xorg.libXxf86vm + fontconfig + freetype + stdenv.cc.cc.lib + ]); +in +pkgs.mkShell { + buildInputs = [ + pkgs.python3 + pkgs.uv + pkgs.libusb1 + ]; + + shellHook = '' + export LD_LIBRARY_PATH="${libPath}:$LD_LIBRARY_PATH" + export NIX_LD_LIBRARY_PATH="${libPath}:$NIX_LD_LIBRARY_PATH" + ''; +}