Add CUDA shell example

This commit is contained in:
2026-02-03 18:20:23 +01:00
parent 0775e1ce73
commit 0495bf0dee
6 changed files with 705 additions and 0 deletions

43
cuda/flake.nix Normal file
View File

@@ -0,0 +1,43 @@
{
inputs.jungle.url = "git+https://jungle.bsc.es/git/rarias/jungle";
outputs = { self, jungle }:
let
nixpkgs = jungle.inputs.nixpkgs;
customOverlay = (final: prev: {
# Example overlay, for now empty
});
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [
# Apply jungle overlay to get our BSC custom packages
jungle.outputs.bscOverlay
# And on top apply our local changes to customize for cluster
customOverlay
];
# Needed for CUDA
config.allowUnfree = true;
};
in {
devShells.x86_64-linux.default = pkgs.mkShell {
pname = "cuda-devshell";
# Include these packages in the shell
packages = with pkgs; [
# Cuda packages (more at https://search.nixos.org/packages)
cudatoolkit # Required for nvcc
(lib.getOutput "static" cudaPackages.cuda_cudart) # Required for -lcudart_static
cudaPackages.libcusparse
autoAddDriverRunpath
# ... add more packages from https://search.nixos.org/packages
];
# The dependencies needed to build these packages will be also included
inputsFrom = with pkgs; [
# Empty for now
];
shellHook = ''
export CUDA_PATH=${pkgs.cudatoolkit}
export LD_LIBRARY_PATH=/var/run/opengl-driver/lib
export SMS=50
'';
};
};
}