forked from rarias/devshell
Add CUDA shell example
This commit is contained in:
43
cuda/flake.nix
Normal file
43
cuda/flake.nix
Normal 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
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user