generated from ublue-os/udev-rules
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(just): combine several just commands into toggles or choices (#181)
* chore: merge install/remove-distrobox-git * chore: merge enable/disable-updates * chore: correct wording in description of distrobox-git * chore(just): merge ublue/stock-gamepads and enable/disable-broadcom-wl * chore(just): combine and merge all the nix recipes * chore(just): remove empty lines that were used for readability while writing the just recipes * chore(just): remove leftover spaces from before reorg * chore(just): improve description wording for setup-distrobox-git and change brew-remove to remove-brew * chore(just): format the message for configure-gamepads to look better * chore(just): change gamepad description to be more clear * chore(just): merge nvidia recipes into configure-nvidia * chore(just): change fixscreenshare to fix-screenshare to conform with naming scheme * chore(just): add some bold text for title or install state * feat(just): add quick options for use in yafti * chore(just): fix formating for just * chore(just): add missing quick options for setup-nix * chore(just): add aliases for recipes * chore(just): add empty line between alias and recipe description * chore(just): added missing empty line for upgrade alias * chore: Always use #!/usr/bin/bash * chore(just): fix conditions to be lowercase for enable/disable and install/remove * chore(just): standardize choice recipe ARG as ACTION * feat(just): add toggle-nvk, addresses #182 * chore(just): Add message about what to do after running enroll-secure-boot-key
- Loading branch information
1 parent
c66d7fd
commit 1399871
Showing
8 changed files
with
328 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,74 @@ | ||
# vim: set ft=make : | ||
|
||
# Set needed kernel arguments for Nvidia GPUs | ||
nvidia-set-kargs: | ||
#!/usr/bin/env bash | ||
if command -v nvidia-smi; then | ||
rpm-ostree kargs \ | ||
--append-if-missing=rd.driver.blacklist=nouveau \ | ||
--append-if-missing=modprobe.blacklist=nouveau \ | ||
--append-if-missing=nvidia-drm.modeset=1 \ | ||
--delete-if-present=nomodeset | ||
else | ||
echo 'You do not appear to be on a Nvidia image, please refer to the README for your uBlue-OS image.' | ||
fi | ||
alias nvidia := configure-nvidia | ||
|
||
# Test CUDA support for Nvidia GPUs | ||
nvidia-test-cuda: | ||
#!/usr/bin/env bash | ||
if lsmod | grep -wq "nvidia"; then | ||
podman run \ | ||
--user 1000:1000 \ | ||
--security-opt=no-new-privileges \ | ||
--cap-drop=ALL \ | ||
--security-opt label=type:nvidia_container_t \ | ||
--device=nvidia.com/gpu=all \ | ||
docker.io/nvidia/samples:vectoradd-cuda11.2.1 | ||
else | ||
echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' | ||
# Configure the Nvidia driver | ||
configure-nvidia ACTION="prompt": | ||
#!/usr/bin/bash | ||
bold=$(tput bold) | ||
normal=$(tput sgr0) | ||
OPTION={{ ACTION }} | ||
if [ "$OPTION" == "prompt" ]; then | ||
echo "${bold}Configuring Nvidia drivers${normal}" | ||
echo 'What would you like to do?' | ||
OPTION=$(ugum choose "Set needed kernel arguments" "Test CUDA support" "Enable Nvidia VAAPI in Firefox Flatpak") | ||
elif [ "$OPTION" == "help" ]; then | ||
echo "Usage: ujust configure-nvidia <option>" | ||
echo " <option>: Specify the quick option - 'kargs', 'test-cuda' or 'firefox-vaapi'" | ||
echo " Use 'kargs' to Set needed kernel arguments" | ||
echo " Use 'test-cuda' to Test CUDA support" | ||
echo " Use 'firefox-vaapi' to Enable Nvidia VAAPI in Firefox Flatpak." | ||
exit 0 | ||
fi | ||
if [ "$OPTION" == "Set needed kernel arguments" ] || [ "${OPTION,,}" == "kargs" ]; then | ||
if command -v nvidia-smi; then | ||
rpm-ostree kargs \ | ||
--append-if-missing=rd.driver.blacklist=nouveau \ | ||
--append-if-missing=modprobe.blacklist=nouveau \ | ||
--append-if-missing=nvidia-drm.modeset=1 \ | ||
--delete-if-present=nomodeset | ||
else | ||
echo 'You do not appear to be on a Nvidia image, please refer to the README for your uBlue-OS image.' | ||
fi | ||
elif [ "$OPTION" == "Test CUDA support" ] || [ "${OPTION,,}" == "test-cuda" ]; then | ||
if lsmod | grep -wq "nvidia"; then | ||
podman run \ | ||
--user 1000:1000 \ | ||
--security-opt=no-new-privileges \ | ||
--cap-drop=ALL \ | ||
--security-opt label=type:nvidia_container_t \ | ||
--device=nvidia.com/gpu=all \ | ||
docker.io/nvidia/samples:vectoradd-cuda11.2.1 | ||
else | ||
echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' | ||
fi | ||
elif [ "$OPTION" == "Enable Nvidia VAAPI in Firefox Flatpak" ] || [ "${OPTION,,}" == "firefox-vaapi" ]; then | ||
if lsmod | grep -wq "nvidia"; then | ||
flatpak override \ | ||
--user \ | ||
--filesystem=host-os \ | ||
--env=LIBVA_DRIVER_NAME=nvidia \ | ||
--env=LIBVA_DRIVERS_PATH=/run/host/usr/lib64/dri \ | ||
--env=LIBVA_MESSAGING_LEVEL=1 \ | ||
--env=MOZ_DISABLE_RDD_SANDBOX=1 \ | ||
--env=NVD_BACKEND=direct \ | ||
--env=MOZ_ENABLE_WAYLAND=1 \ | ||
org.mozilla.firefox | ||
else | ||
echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' | ||
fi | ||
fi | ||
|
||
# Enable VAAPI in Firefox Flatpak for Nvidia GPUs | ||
nvidia-setup-firefox-vaapi: | ||
#!/usr/bin/env bash | ||
if lsmod | grep -wq "nvidia"; then | ||
flatpak override \ | ||
--user \ | ||
--filesystem=host-os \ | ||
--env=LIBVA_DRIVER_NAME=nvidia \ | ||
--env=LIBVA_DRIVERS_PATH=/run/host/usr/lib64/dri \ | ||
--env=LIBVA_MESSAGING_LEVEL=1 \ | ||
--env=MOZ_DISABLE_RDD_SANDBOX=1 \ | ||
--env=NVD_BACKEND=direct \ | ||
--env=MOZ_ENABLE_WAYLAND=1 \ | ||
org.mozilla.firefox | ||
# Switch between Nvidia image and NVK | ||
toggle-nvk: | ||
#!/usr/bin/bash | ||
CURRENT_IMAGE=$(rpm-ostree status -b --json | jq -r '.deployments[0]."container-image-reference"' | sed -E 's/^.+\/(.+:.+)$/\1/') | ||
CURRENT_URI=$(rpm-ostree status -b --json | jq -r '.deployments[0]."container-image-reference"' | sed -E 's/^(.+\/).+:.+$/\1/') | ||
NEW_IMAGE=$CURRENT_IMAGE | ||
if [[ "$CURRENT_IMAGE" =~ "nvidia" ]]; then | ||
NEW_IMAGE=${CURRENT_IMAGE/-nvidia/} | ||
else | ||
echo 'The Nvidia kernel module is not loaded. You may be using secure boot without the needed signing key, lacking the needed kargs, or may not be on a Nvidia image. See "just enroll-secure-boot-key" and "just nvidia-set-kargs".' | ||
NEW_IMAGE=${CURRENT_IMAGE/:/-nvidia:} | ||
fi | ||
echo "Rebasing to ${NEW_IMAGE}" | ||
rpm-ostree rebase ${CURRENT_URI}${NEW_IMAGE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,65 @@ | ||
# vim: set ft=make : | ||
|
||
# Use stock gamepad drivers | ||
use-stock-gamepads: | ||
#!/usr/bin/env bash | ||
sudo bash -c '> /etc/modprobe.d/xone.conf' | ||
sudo bash -c '> /etc/modprobe.d/xpadneo.conf' | ||
sudo bash -c '> /etc/modprobe.d/xpad-noone-blacklist.conf' | ||
sudo bash -c '> /etc/modules-load.d/xpad-noone.conf' | ||
alias gamepads := configure-gamepads | ||
|
||
# Use uBlue gamepad drivers (Default) | ||
use-ublue-gamepads: | ||
#!/usr/bin/env bash | ||
sudo rm -f /etc/modprobe.d/xone.conf | ||
sudo rm -f /etc/modprobe.d/xpadneo.conf | ||
sudo rm -f /etc/modprobe.d/xpad-noone-blacklist.conf | ||
sudo rm -f /etc/modules-load.d/xpad-noone.conf | ||
# Configure gamepad drivers | ||
configure-gamepads ACTION="prompt": | ||
#!/usr/bin/bash | ||
bold=$(tput bold) | ||
normal=$(tput sgr0) | ||
OPTION={{ ACTION }} | ||
if [ "$OPTION" == "prompt" ]; then | ||
echo "${bold}Configuring gamepad drivers${normal}" | ||
echo 'Which drivers do you want to use?' | ||
echo 'Note: Enabling xone and xpadneo can break some 3rd party controllers' | ||
OPTION=$(ugum choose "Default Fedora drivers" "Enable xone and xpadneo") | ||
elif [ "$OPTION" == "help" ]; then | ||
echo "Usage: ujust configure-gamepads <option>" | ||
echo " <option>: Specify the quick option - 'stock' or 'ublue'" | ||
echo " Use 'stock' to select Default Fedora Drivers" | ||
echo " Use 'ublue' to select Enable xone and xpadneo" | ||
exit 0 | ||
fi | ||
if [ "$OPTION" == "Enable xone and xpadneo" ] || [ "$OPTION" == "ublue" ]; then | ||
sudo rm -f /etc/modprobe.d/xone.conf | ||
sudo rm -f /etc/modprobe.d/xpadneo.conf | ||
sudo rm -f /etc/modprobe.d/xpad-noone-blacklist.conf | ||
sudo rm -f /etc/modules-load.d/xpad-noone.conf | ||
echo "${bold}Enabled${normal} xone and xpadneo, please reboot for changes to take effect" | ||
elif [ "$OPTION" == "Default Fedora drivers" ] || [ "$OPTION" == "stock" ]; then | ||
sudo bash -c '> /etc/modprobe.d/xone.conf' | ||
sudo bash -c '> /etc/modprobe.d/xpadneo.conf' | ||
sudo bash -c '> /etc/modprobe.d/xpad-noone-blacklist.conf' | ||
sudo bash -c '> /etc/modules-load.d/xpad-noone.conf' | ||
echo "${bold}Disabled${normal} xone and xpadneo, please reboot for changes to take effect" | ||
fi | ||
|
||
# Disable Broadcom WL driver (Default - WL breaks numerous other Wi-Fi adapters) | ||
disable-broadcom-wl: | ||
#!/usr/bin/env bash | ||
sudo bash -c '> /etc/modules-load.d/broadcom-wl-blacklist.conf' | ||
sudo bash -c 'echo "blacklist wl" > /etc/modules-load.d/default-disable-broadcom-wl.conf' | ||
alias broadcom-wl := configure-broadcom-wl | ||
|
||
# Use Broadcom WL driver | ||
use-broadcom-wl: | ||
#!/usr/bin/env bash | ||
sudo rm -f /etc/modprobe.d/broadcom-wl-blacklist.conf | ||
sudo rm -f /etc/modprobe.d/default-disable-broadcom-wl.conf | ||
# Configure Broadcom WL driver (Enabling WL breaks numerous other Wi-Fi adapters) | ||
configure-broadcom-wl ACTION="prompt": | ||
#!/usr/bin/bash | ||
bold=$(tput bold) | ||
normal=$(tput sgr0) | ||
OPTION={{ ACTION }} | ||
if [ "$OPTION" == "prompt" ]; then | ||
echo "${bold}Configuring Broadcom Wi-Fi${normal}" | ||
echo 'Enabling Broadcom WL driver will break numerous other Wi-Fi adapters.' | ||
echo 'Enable or Disable Broadcom Wl?' | ||
OPTION=$(ugum choose Enable Disable) | ||
elif [ "$OPTION" == "help" ]; then | ||
echo "Usage: ujust configure-broadcom-wl <option>" | ||
echo " <option>: Specify the quick option - 'enable' or 'disable'" | ||
echo " Use 'enable' to select Enable" | ||
echo " Use 'disable' to select Disable" | ||
exit 0 | ||
fi | ||
if [ "${OPTION,,}" == "enable" ]; then | ||
sudo rm -f /etc/modprobe.d/broadcom-wl-blacklist.conf | ||
sudo rm -f /etc/modprobe.d/default-disable-broadcom-wl.conf | ||
echo "${bold}Enabled${normal} Broadcom Wireless, please reboot for changes to take effect" | ||
elif [ "${OPTION,,}" == "disable" ]; then | ||
sudo bash -c '> /etc/modules-load.d/broadcom-wl-blacklist.conf' | ||
sudo bash -c 'echo "blacklist wl" > /etc/modules-load.d/default-disable-broadcom-wl.conf' | ||
echo "${bold}Disabled${normal} Broadcom Wireless, please reboot for changes to take effect" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# vim: set ft=make : | ||
|
||
# Enable xwaylandvideobridge | ||
fixscreenshare: | ||
fix-screenshare: | ||
cp /usr/share/applications/org.kde.xwaylandvideobridge.desktop $HOME/.config/autostart/ |
Oops, something went wrong.