okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
e8b455117
main
1{ 2description = "Nix environment for Strata" ; 3 4inputs = { 5nixpkgs . url = "github:nixos/nixpkgs/nixos-unstable" ; 6}; 7 8outputs = { self , nixpkgs , ...} : 9let 10system = "x86_64-linux" ; 11pkgs = import nixpkgs { 12inherit system ; 13# Allow NVIDIA's CUDA toolkit (nvcc, cudart, cuBLAS, ...). 14config . allowUnfree = true ; 15config . cudaSupport = true ; 16}; 17 18# setup.py wants CUDA 13.0: the ready-made engine is built with 13.0.88, and 13.2.0/13.2.1 miscompile for sm_120. 19cudaPackages = pkgs . cudaPackages_13_0 ; 20# One merged toolkit root (bin/nvcc, include/, lib/ with cudart and cuBLAS) for CUDA_HOME / CUDAToolkit_ROOT. 21cuda = cudaPackages . cudatoolkit ; 22# The gcc that this nvcc supports as its host compiler. 23stdenv = cudaPackages . backendStdenv ; 24 25in 26{ 27devShells . " ${ system } " = { 28default = ( pkgs . mkShell . override { inherit stdenv ; }) { 29packages = with pkgs ; [ 30# ./setup.sh: makes .venv and runs setup.py 31python3 32 33# setup.py's engine build. cmake/ninja from PATH: the pip wheels' binaries do not run on NixOS. 34cuda 35cmake 36ninja 37]; 38 39shellHook = '' 40export CUDA_HOME = ${ cuda } 41export CUDA_PATH = ${ cuda } 42export CUDAHOSTCXX = ${ stdenv . cc } /bin/c++ 43# The pip wheels in .venv (numpy, pillow, ...) need libstdc++ and zlib; the engine needs the driver's libcuda. 44export LD_LIBRARY_PATH =/run/opengl-driver/lib: ${ pkgs . lib . makeLibraryPath [ stdenv . cc . cc . lib pkgs . zlib ]} '' $ { LD_LIBRARY_PATH:+: $ LD_LIBRARY_PATH } 45'' ; 46}; 47}; 48}; 49}