feat(nasp): fix nvidia for docker
This commit is contained in:
parent
3d70d0cec5
commit
a40aaa9233
|
@ -138,7 +138,7 @@ in
|
|||
nixpkgs.config.nvidia.acceptLicense = true;
|
||||
hardware.nvidia = {
|
||||
package = config.boot.kernelPackages.nvidiaPackages.legacy_470;
|
||||
modesetting.enable = true;
|
||||
modesetting.enable = false;
|
||||
powerManagement.enable = false;
|
||||
powerManagement.finegrained = false;
|
||||
open = false;
|
||||
|
@ -149,13 +149,20 @@ in
|
|||
driSupport = true;
|
||||
driSupport32Bit = true;
|
||||
};
|
||||
virtualisation.docker.enableNvidia = true;
|
||||
hardware.nvidia-container-toolkit.enable = true;
|
||||
systemd.services.nvidia-container-toolkit-cdi-generator = {
|
||||
path = [ pkgs.jq pkgs.moreutils ];
|
||||
postStart = ''
|
||||
jq '."containerEdits"."mounts" |= map(select(."containerPath" != "/usr/bin/nvidia-powerd"))' /run/cdi/nvidia-container-toolkit.json | sponge /run/cdi/nvidia-container-toolkit.json
|
||||
'';
|
||||
};
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
})
|
||||
# docker
|
||||
(lib.mkIf (dockerCfg.enable) {
|
||||
virtualisation.docker = {
|
||||
enable = true;
|
||||
package = pkgs.docker_25;
|
||||
daemon.settings = {
|
||||
ipv6 = true;
|
||||
fixed-cidr-v6 = "fddd:d0c1:1::/64";
|
||||
|
|
|
@ -44,7 +44,7 @@ fi
|
|||
ret=$(ask_for_yN "Use GPU?")
|
||||
if [[ "$ret" == "1" ]]; then
|
||||
base_command="$base_command \\
|
||||
--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all"
|
||||
--device nvidia.com/gpu=all"
|
||||
fi
|
||||
ret=$(ask_for_yN "Use RDMA?")
|
||||
if [[ "$ret" == "1" ]]; then
|
||||
|
@ -52,21 +52,11 @@ if [[ "$ret" == "1" ]]; then
|
|||
--device=/dev/infiniband/uverbs0"
|
||||
fi
|
||||
|
||||
read -p "Image name (default: git.nasp.fit/nasp/nasp-ubuntu): "
|
||||
if [[ -z "$REPLY" ]]; then
|
||||
image_name="git.nasp.fit/nasp/nasp-ubuntu"
|
||||
else
|
||||
image_name="$REPLY"
|
||||
fi
|
||||
base_command="$base_command \\
|
||||
-it $image_name"
|
||||
|
||||
read -p "Start up command (default: /etc/startup.sh): "
|
||||
if [[ -z "$REPLY" ]]; then
|
||||
cmd="/etc/startup.sh"
|
||||
else
|
||||
cmd="$REPLY"
|
||||
fi
|
||||
base_command="$base_command $cmd"
|
||||
|
||||
echo "Will run:"
|
||||
|
|
Loading…
Reference in New Issue
Block a user