Last active
April 13, 2023 10:45
-
-
Save shikanime/1077f8b811f1294de2b643a676c14755 to your computer and use it in GitHub Desktop.
WSL2 + Tensorflow (https://www.tensorflow.org/install/gpu) + Nix (https://nixos.wiki/wiki/Tensorflow) + Nvidia CUDA (https://docs.nvidia.com/cuda/wsl-user-guide/index.html)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If we are a computer with nix available, then use that to setup | |
# the build environment with exactly what we need. | |
if has nix; then | |
use flake | |
fi | |
# Automatically setup a virtualenv | |
layout python | |
# Add well known WSL CUDA library | |
export LD_LIBRARY_PATH="/usr/lib/wsl/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" | |
# Add well known 64bits OpenGL library | |
export LD_LIBRARY_PATH="/run/opengl-drivers/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" | |
# Add well known 32bits OpenGL library | |
export LD_LIBRARY_PATH="/run/opengl-drivers-32/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/release-22.11"; | |
devenv = { | |
url = "github:cachix/devenv"; | |
inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
pre-commit-hooks = { | |
url = "github:cachix/pre-commit-hooks.nix"; | |
inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
}; | |
outputs = { nixpkgs, devenv, ... }@inputs: { | |
devShells = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.unix (system: | |
let | |
pkgs = import nixpkgs { | |
inherit system; | |
config.allowUnfree = true; | |
}; | |
in | |
{ | |
default = devenv.lib.mkShell { | |
inherit inputs pkgs; | |
modules = [ | |
{ | |
pre-commit.hooks = { | |
markdownlint.enable = true; | |
nixpkgs-fmt.enable = true; | |
statix.enable = true; | |
deadnix.enable = true; | |
}; | |
packages = [ | |
pkgs.stdenv.cc.cc.lib | |
pkgs.cudaPackages.cudnn | |
pkgs.cudaPackages.cudatoolkit.lib | |
]; | |
} | |
]; | |
}; | |
} | |
); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment