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;
|
nixpkgs.config.nvidia.acceptLicense = true;
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.legacy_470;
|
package = config.boot.kernelPackages.nvidiaPackages.legacy_470;
|
||||||
modesetting.enable = true;
|
modesetting.enable = false;
|
||||||
powerManagement.enable = false;
|
powerManagement.enable = false;
|
||||||
powerManagement.finegrained = false;
|
powerManagement.finegrained = false;
|
||||||
open = false;
|
open = false;
|
||||||
|
@ -149,13 +149,20 @@ in
|
||||||
driSupport = true;
|
driSupport = true;
|
||||||
driSupport32Bit = 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" ];
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
})
|
})
|
||||||
# docker
|
# docker
|
||||||
(lib.mkIf (dockerCfg.enable) {
|
(lib.mkIf (dockerCfg.enable) {
|
||||||
virtualisation.docker = {
|
virtualisation.docker = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.docker_25;
|
||||||
daemon.settings = {
|
daemon.settings = {
|
||||||
ipv6 = true;
|
ipv6 = true;
|
||||||
fixed-cidr-v6 = "fddd:d0c1:1::/64";
|
fixed-cidr-v6 = "fddd:d0c1:1::/64";
|
||||||
|
|
|
@ -44,7 +44,7 @@ fi
|
||||||
ret=$(ask_for_yN "Use GPU?")
|
ret=$(ask_for_yN "Use GPU?")
|
||||||
if [[ "$ret" == "1" ]]; then
|
if [[ "$ret" == "1" ]]; then
|
||||||
base_command="$base_command \\
|
base_command="$base_command \\
|
||||||
--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all"
|
--device nvidia.com/gpu=all"
|
||||||
fi
|
fi
|
||||||
ret=$(ask_for_yN "Use RDMA?")
|
ret=$(ask_for_yN "Use RDMA?")
|
||||||
if [[ "$ret" == "1" ]]; then
|
if [[ "$ret" == "1" ]]; then
|
||||||
|
@ -52,21 +52,11 @@ if [[ "$ret" == "1" ]]; then
|
||||||
--device=/dev/infiniband/uverbs0"
|
--device=/dev/infiniband/uverbs0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
read -p "Image name (default: git.nasp.fit/nasp/nasp-ubuntu): "
|
|
||||||
if [[ -z "$REPLY" ]]; then
|
|
||||||
image_name="git.nasp.fit/nasp/nasp-ubuntu"
|
image_name="git.nasp.fit/nasp/nasp-ubuntu"
|
||||||
else
|
|
||||||
image_name="$REPLY"
|
|
||||||
fi
|
|
||||||
base_command="$base_command \\
|
base_command="$base_command \\
|
||||||
-it $image_name"
|
-it $image_name"
|
||||||
|
|
||||||
read -p "Start up command (default: /etc/startup.sh): "
|
|
||||||
if [[ -z "$REPLY" ]]; then
|
|
||||||
cmd="/etc/startup.sh"
|
cmd="/etc/startup.sh"
|
||||||
else
|
|
||||||
cmd="$REPLY"
|
|
||||||
fi
|
|
||||||
base_command="$base_command $cmd"
|
base_command="$base_command $cmd"
|
||||||
|
|
||||||
echo "Will run:"
|
echo "Will run:"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user