Add a nix flake - #26
pcasaretto wants to merge 3 commits into
Conversation
Build the disktree binary with buildRustPackage from the existing Cargo.lock. Linux gets a RUNPATH for the GPU libraries GPUI dlopens at runtime plus a desktop entry and icon; darwin needs only the bindgen hook. Tests outside the sandbox skip the three host-reading cases.
A Nix-built vulkan-loader looks for its ICD manifests under
/run/opengl-driver/share/vulkan/icd.d, a path that only NixOS creates, so
on any other distribution the loader found no drivers at all, wgpu came up
with no enabled backend, and the app died in create_surface with "Failed to
create surface for any enabled backend: {}" before a window was shown. The
host's own Mesa cannot fill the gap — its ICD names the vendor library
relatively and Nix's glibc does not read /etc/ld.so.cache, while forcing
the issue with LD_LIBRARY_PATH shadows glibc itself and breaks the process
— so the driver has to come from the closure.
- postFixup now runs addDriverRunpath on the binary, keeping NixOS and
proprietary-NVIDIA hosts working through /run/opengl-driver/lib
- postFixup wraps the binary so this closure's Mesa is offered as an
additional driver source: VK_ADD_DRIVER_FILES for Vulkan,
__EGL_VENDOR_LIBRARY_DIRS and LIBGL_DRIVERS_PATH for GL, all suffixed so
a driver the loader discovers for itself still wins
- addDriverRunpath and makeWrapper join nativeBuildInputs under the
existing isLinux guard
- the comment above postFixup explains driver discovery, not just the
dlopened loaders, and records that NVIDIA's proprietary stack still
needs nixGL
…gl-driver Find a GPU driver on hosts without /run/opengl-driver
|
Nice flake — the fileset scoping, version-from-
nixpkgs-unstable dropped
The branch is stale and carries a merge commit. It evaluates to Nothing guards the flake against nixpkgs drift. A small path-filtered The Linux build is untested (per the PR body). The dep set looks right Minor: Verified locally: |
disktree (https://github.com/tobi/disktree) is not in nixpkgs yet. Package it locally in nixpkgs style, adapted from the flake proposed upstream in tobi/disktree#26, so it can be dropped or upstreamed later. It builds from the unstable set because upstream requires rust >= 1.97 and nixos-25.11 ships 1.91. pkgs/default.nix took a bare pkgs argument while flake.nix passes {pkgs, inputs}, which only worked because the file was empty. Take {pkgs, ...} and have the additions overlay pass the same shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Add
flake.nixandflake.lockso Nix can build and run disktree without manual setup of Rust or native dependencies.disktreepackages foraarch64-darwin,aarch64-linux, andx86_64-linux.flake.lockand use the existingCargo.lockfor Rust dependencies.Usage
From the checkout:
The build produces
result/bin/disktree.Testing
nix flake check --no-build --all-systems: evaluation passes for all three systems.nix build .#disktree: build and core tests pass onaarch64-darwin../result/bin/disktree --help: prints usage.The Nix check phase excludes two macOS tests that depend on the host environment and the app test suite. Linux checks cover evaluation only, not builds or runtime behavior.