diff --git a/Containerfile b/Containerfile index d312377..3cd6f64 100644 --- a/Containerfile +++ b/Containerfile @@ -59,6 +59,7 @@ ADD files/etc/nvidia-container-runtime/config-rootless.toml \ /tmp/ublue-os-nvidia-addons/rpmbuild/SOURCES/config-rootless.toml ADD https://raw.githubusercontent.com/NVIDIA/dgx-selinux/master/bin/RHEL9/nvidia-container.pp \ /tmp/ublue-os-nvidia-addons/rpmbuild/SOURCES/nvidia-container.pp +ADD files/etc/sway/environment /tmp/ublue-os-nvidia-addons/rpmbuild/SOURCES/environment RUN install -D /etc/pki/akmods/certs/public_key.der /tmp/ublue-os-nvidia-addons/rpmbuild/SOURCES/public_key.der @@ -75,6 +76,8 @@ RUN rpm -q "xorg-x11-drv-$(cat /tmp/nvidia-package-name.txt)" \ FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} +ARG IMAGE_NAME="${IMAGE_NAME}" + COPY --from=builder /var/cache/akmods /tmp/akmods COPY --from=builder /tmp/ublue-os-nvidia-addons /tmp/ublue-os-nvidia-addons @@ -126,6 +129,10 @@ RUN KERNEL_VERSION="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH} && \ ln -s /usr/bin/ld.bfd /etc/alternatives/ld && \ ln -s /etc/alternatives/ld /usr/bin/ld \ + && \ + ([[ "${IMAGE_NAME}" == "sericea" ]] && \ + mv /etc/sway/environment{,.orig} && \ + install -Dm644 /usr/share/ublue-os/etc/sway/environment /etc/sway/environment) ||: \ && \ rm -rf \ /tmp/* \ diff --git a/README.md b/README.md index f321e70..997c956 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,9 @@ Note: This project is a work-in-progress. You should at a minimum be familiar wi ``` [Sericea (Sway, unofficial as of Fedora 38):](https://github.com/ublue-os/nvidia/pkgs/container/sericea-nvidia) + + Note: [The Sway session has some custom configuration options set to improve stability on Nvidia GPUs](https://github.com/ublue-os/nvidia/blob/main/files/etc/sway/environment) + ``` rpm-ostree rebase ostree-unverified-registry:ghcr.io/ublue-os/sericea-nvidia:38 ``` diff --git a/files/etc/sway/environment b/files/etc/sway/environment new file mode 100644 index 0000000..7c596ac --- /dev/null +++ b/files/etc/sway/environment @@ -0,0 +1,27 @@ +# This file is a part of Fedora configuration for Sway and will be sourced +# from /usr/bin/start-sway script for all users of the system. +# User-specific variables should be placed in $XDG_CONFIG_HOME/sway/environment +# +# vim: set ft=sh: + +## Pass extra arguments to the /usr/bin/sway executable + +#SWAY_EXTRA_ARGS="$SWAY_EXTRA_ARGS --unsupported-gpu" +SWAY_EXTRA_ARGS="$SWAY_EXTRA_ARGS --unsupported-gpu -D noscanout" +#SWAY_EXTRA_ARGS="$SWAY_EXTRA_ARGS --debug" + +## Set environment variables + +# Useful variables for wlroots: +# https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/docs/env_vars.md +# +#WLR_NO_HARDWARE_CURSORS=1 +WLR_NO_HARDWARE_CURSORS=1 +# Setting renderer to Vulkan may fix flickering but needs the following extensions: +# - VK_EXT_image_drm_format_modifier +# - VK_EXT_physical_device_drm +# +# Source: https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/8e346922508aa3eaccd6e12f2917f6574f349843 +#WLR_RENDERER=vulkan + +# Application compatibility diff --git a/ublue-os-nvidia-addons.spec b/ublue-os-nvidia-addons.spec index bf1174f..e13dfa7 100644 --- a/ublue-os-nvidia-addons.spec +++ b/ublue-os-nvidia-addons.spec @@ -1,5 +1,5 @@ Name: ublue-os-nvidia-addons -Version: 0.2 +Version: 0.3 Release: 1%{?dist} Summary: Additional files for nvidia driver support @@ -13,6 +13,7 @@ Source0: public_key.der Source1: nvidia-container-runtime.repo Source2: config-rootless.toml Source3: nvidia-container.pp +Source4: environment %description Adds various runtime files for nvidia support. These include a key for importing with mokutil to enable secure boot for nvidia kernel modules @@ -21,22 +22,37 @@ Adds various runtime files for nvidia support. These include a key for importing %setup -q -c -T -%install +%build # Have different name for *.der in case kmodgenca is needed for creating more keys -install -Dm0644 %{SOURCE0} %{buildroot}%{_sysconfdir}/pki/akmods/certs/akmods-nvidia.der -install -Dm0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo -install -Dm0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/nvidia-container-runtime/config-rootless.toml -install -Dm0644 %{SOURCE3} %{buildroot}%{_datadir}/selinux/packages/nvidia-container.pp +install -Dm0644 %{SOURCE0} %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/pki/akmods/certs/akmods-nvidia.der +install -Dm0644 %{SOURCE1} %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo +install -Dm0644 %{SOURCE2} %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/nvidia-container-runtime/config-rootless.toml +install -Dm0644 %{SOURCE3} %{buildroot}%{_datadir}/ublue-os/%{_datadir}/selinux/packages/nvidia-container.pp +install -Dm0644 %{SOURCE4} %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/sway/environment -sed -i 's@enabled=1@enabled=0@g' %{buildroot}%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo +sed -i 's@enabled=1@enabled=0@g' %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo + +install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/pki/akmods/certs/akmods-nvidia.der %{buildroot}%{_sysconfdir}/pki/akmods/certs/akmods-nvidia.der +install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo %{buildroot}%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo +install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_sysconfdir}/nvidia-container-runtime/config-rootless.toml %{buildroot}%{_sysconfdir}/nvidia-container-runtime/config-rootless.toml +install -Dm0644 %{buildroot}%{_datadir}/ublue-os/%{_datadir}/selinux/packages/nvidia-container.pp %{buildroot}%{_datadir}/selinux/packages/nvidia-container.pp %files +%attr(0644,root,root) %{_datadir}/ublue-os/%{_sysconfdir}/pki/akmods/certs/akmods-nvidia.der +%attr(0644,root,root) %{_datadir}/ublue-os/%{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo +%attr(0644,root,root) %{_datadir}/ublue-os/%{_sysconfdir}/nvidia-container-runtime/config-rootless.toml +%attr(0644,root,root) %{_datadir}/ublue-os/%{_datadir}/selinux/packages/nvidia-container.pp +%attr(0644,root,root) %{_datadir}/ublue-os/%{_sysconfdir}/sway/environment %attr(0644,root,root) %{_sysconfdir}/pki/akmods/certs/akmods-nvidia.der %attr(0644,root,root) %{_sysconfdir}/yum.repos.d/nvidia-container-runtime.repo %attr(0644,root,root) %{_sysconfdir}/nvidia-container-runtime/config-rootless.toml %attr(0644,root,root) %{_datadir}/selinux/packages/nvidia-container.pp %changelog +* Fri Feb 24 2023 Joshua Stone - 0.3 +- Add sway environment file +- Put ublue-os modifications into a separate data directory + * Thu Feb 16 2023 Joshua Stone - 0.2 - Add nvidia-container-runtime repo - Add nvidia-container-runtime selinux policy file