Skip to content

Commit

Permalink
[draft] add direnv, nix configs, and uv lock file
Browse files Browse the repository at this point in the history
  • Loading branch information
yvan-sraka committed Jan 22, 2025
1 parent 063291d commit ac9b183
Show file tree
Hide file tree
Showing 3 changed files with 4,047 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
layout python
# use nix
76 changes: 76 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{ pkgs ? import <nixpkgs> { config = { allowUnfree = true; }; } }:

(pkgs.buildFHSEnv {
name = "dottxt-ai";
targetPkgs = pkgs: with pkgs; [
autoconf
binutils
cmake
cudatoolkit
curl
freeglut
gcc13
git
gitRepo
gnumake
gnupg
gperf
libGL
libGLU
linuxPackages.nvidia_x11
m4
ncurses5
procps
python3Packages.numpy
python3Packages.pytorch
python3Packages.pytorch
python3Packages.torch
python3Packages.xformers
stdenv.cc
unzip
util-linux
uv
xorg.libX11
xorg.libXext
xorg.libXi
xorg.libXmu
xorg.libXrandr
xorg.libXv
zlib
];

multiPkgs = pkgs: with pkgs; [ zlib ];

runScript = "bash";

profile = ''
# CUDA paths
export CUDA_HOME=${pkgs.cudatoolkit}
export CUDA_PATH=${pkgs.cudatoolkit}
# Ensure proper binary paths are included
export PATH=${pkgs.gcc13}/bin:${pkgs.cudatoolkit}/bin:$PATH
# Set library paths, including additional directories for CUPTI
export LD_LIBRARY_PATH=${pkgs.cudatoolkit}/lib64:${pkgs.cudatoolkit}/extras/CUPTI/lib64:${pkgs.linuxPackages.nvidia_x11}/lib:$LD_LIBRARY_PATH
# Add static library paths to EXTRA_LDFLAGS for the linker
export EXTRA_LDFLAGS="-L${pkgs.cudatoolkit}/lib64 -L${pkgs.cudatoolkit}/extras/CUPTI/lib64 -L${pkgs.linuxPackages.nvidia_x11}/lib -L${pkgs.cudatoolkit}/libdevice $EXTRA_LDFLAGS"
export EXTRA_CCFLAGS="-I${pkgs.cudatoolkit}/include $EXTRA_CCFLAGS"
# Set CMake paths
export CMAKE_PREFIX_PATH=${pkgs.cudatoolkit}:${pkgs.linuxPackages.nvidia_x11}:$CMAKE_PREFIX_PATH
# C++ and CC flags
export CXXFLAGS="--std=c++17 $EXTRA_CCFLAGS"
export CC=${pkgs.gcc13}/bin/gcc
export CXX=${pkgs.gcc13}/bin/g++
# NVCC flags to use the right compiler
export NVCC_FLAGS="-ccbin ${pkgs.gcc13}/bin/gcc"
'';

structuredAttrs__ = {
stdenv = pkgs.stdenv.overrideCC pkgs.stdenv.cc pkgs.gcc13;
};
}).env
Loading

0 comments on commit ac9b183

Please sign in to comment.