diff --git a/Containerfile b/Containerfile index 013e4b5..b2273c0 100644 --- a/Containerfile +++ b/Containerfile @@ -46,7 +46,7 @@ RUN --mount=type=cache,dst=/var/cache/rpm-ostree \ --mount=type=bind,from=akmods_nvidia,src=/rpms,dst=/tmp/akmods-rpms \ mkdir -p /var/lib/alternatives && \ IMAGE_FLAVOR=nvidia /ctx/image-info.sh && \ - /ctx/nvidia-install.sh && \ + NVIDIA_FLAVOR=nvidia /ctx/nvidia-install.sh && \ /ctx/build-initramfs.sh && \ mv /var/lib/alternatives /staged-alternatives && \ /ctx/cleanup.sh && \ diff --git a/nvidia-install.sh b/nvidia-install.sh index ca274b1..4e2a916 100755 --- a/nvidia-install.sh +++ b/nvidia-install.sh @@ -48,6 +48,14 @@ rpm-ostree install \ # disables nvidia repos provided by ublue-os-nvidia-addons sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/{eyecantcu-supergfxctl,negativo17-fedora-nvidia,nvidia-container-toolkit}.repo +# ensure kernel.conf matches NVIDIA_FLAVOR (which must be nvidia or nvidia-open) +# kmod-nvidia-common defaults the value to 'nvidia-open' but this will match on $NVIDIA_FLAVOR +KERNEL_MODULE_TYPE="kernel" +if [[ "${NVIDIA_FLAVOR}" == "nvidia-open" ]]; then + KERNEL_MODULE_TYPE="kernel-open" +fi +sed -i "s/^MODULE_VARIANT=.*/MODULE_VARIANT=$KERNEL_MODULE_TYPE/" /etc/nvidia/kernel.conf + systemctl enable nvidia-persistenced.service systemctl enable ublue-nvctk-cdi.service