Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[Unit]
Description=Sync NVIDIA system drivers with Flatpak runtime
After=network-online.target flatpak-system-helper.service
Wants=network-online.target
ConditionPathExists=/sys/module/nvidia/version
# To not run on live ISO
ConditionPathExists=/run/ostree-booted

[Service]
Type=oneshot
ExecCondition=/usr/libexec/ublue-nvidia-flatpak-runtime-sync check
ExecStart=/usr/libexec/ublue-nvidia-flatpak-runtime-sync sync
RemainAfterExit=yes
Restart=on-failure
RestartSec=30
TimeoutStartSec=600

Comment thread
ledif marked this conversation as resolved.
[Install]
WantedBy=multi-user.target
31 changes: 31 additions & 0 deletions system_files/nvidia/usr/libexec/ublue-nvidia-flatpak-runtime-sync
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/bash

# Workaround for: https://github.com/flatpak/flatpak/issues/3907
set -euo pipefail
Comment thread
ledif marked this conversation as resolved.

SYSTEM_NVIDIA_VERSION=$(cat /sys/module/nvidia/version)
FLATPAK_NVIDIA_VERSION=$(echo "${SYSTEM_NVIDIA_VERSION}" | tr '.' '-')

case "${1}" in
check)
# Exit 0 if sync is needed (versions mismatch), exit 1 if already in sync
if flatpak info --system org.freedesktop.Platform.GL.nvidia-"${FLATPAK_NVIDIA_VERSION}" >/dev/null 2>&1 && \
flatpak info --system org.freedesktop.Platform.GL32.nvidia-"${FLATPAK_NVIDIA_VERSION}" >/dev/null 2>&1; then
echo "NVIDIA Flatpak runtime ${SYSTEM_NVIDIA_VERSION} already installed"
exit 1
fi
echo "NVIDIA Flatpak runtime ${SYSTEM_NVIDIA_VERSION} needs to be installed"
exit 0
;;
sync)
echo "Installing NVIDIA Flatpak runtime version ${SYSTEM_NVIDIA_VERSION}"
flatpak remote-add --system --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --system --noninteractive -y flathub \
org.freedesktop.Platform.GL.nvidia-"${FLATPAK_NVIDIA_VERSION}" \
org.freedesktop.Platform.GL32.nvidia-"${FLATPAK_NVIDIA_VERSION}"
;;
*)
echo "Usage: $0 {check|sync}"
exit 1
;;
esac
Loading