diff --git a/build/ublue-os-just/00-default.just b/build/ublue-os-just/00-default.just new file mode 100644 index 00000000..48db3828 --- /dev/null +++ b/build/ublue-os-just/00-default.just @@ -0,0 +1,20 @@ +# vim: set ft=make : + +set allow-duplicate-recipes +set ignore-comments + +_default: + @just --unstable --list --list-heading $'Available commands:\n' --list-prefix $' - ' + +# Boot into this device's BIOS/UEFI screen +bios: + systemctl reboot --firmware-setup + +# Show the changelog +changelogs: + rpm-ostree db diff --changelogs + +# Enroll Nvidia driver & KMOD signing key for secure boot - Enter password "ublue-os" if prompted +enroll-secure-boot-key: + sudo mokutil --import /etc/pki/akmods/certs/akmods-ublue.der + echo 'Enter password "ublue-os" if prompted' diff --git a/build/ublue-os-just/10-update.just b/build/ublue-os-just/10-update.just new file mode 100644 index 00000000..706b31db --- /dev/null +++ b/build/ublue-os-just/10-update.just @@ -0,0 +1,7 @@ +# vim: set ft=make : + +# Update system, flatpaks, and containers all at once +update: + rpm-ostree update + flatpak update -y + distrobox upgrade -a diff --git a/build/ublue-os-just/20-clean.just b/build/ublue-os-just/20-clean.just new file mode 100644 index 00000000..ccb4d07d --- /dev/null +++ b/build/ublue-os-just/20-clean.just @@ -0,0 +1,12 @@ +# vim: set ft=make : + +# Clean up old containers and flatpaks +clean-system: + #!/usr/bin/env bash + podman system prune -a + flatpak uninstall --unused + rpm-ostree cleanup -bm + if [ -x "$(command -v nix-store)" ]; then + nix-store --gc + nix-store --optimise + fi diff --git a/build/ublue-os-just/main.just b/build/ublue-os-just/30-distrobox.just similarity index 63% rename from build/ublue-os-just/main.just rename to build/ublue-os-just/30-distrobox.just index ba4d8407..471eb9fe 100644 --- a/build/ublue-os-just/main.just +++ b/build/ublue-os-just/30-distrobox.just @@ -1,26 +1,11 @@ -default: - @just --unstable --list - -# Boot into this device's BIOS/UEFI screen -bios: - systemctl reboot --firmware-setup - -# Clean up old containers and flatpaks -clean: - podman system prune -a - flatpak uninstall --unused - rpm-ostree cleanup -bm - -# Show the changelog -changelogs: - rpm-ostree db diff --changelogs +# vim: set ft=make : # Create an Arch container distrobox-arch: echo 'Creating Arch distrobox ...' distrobox create --nvidia --image quay.io/toolbx-images/archlinux-toolbox:latest -n arch -Y -# Create a Bazzite container +# Create a Bazzite-Arch container distrobox-bazzite: #!/usr/bin/env bash echo 'Creating Bazzite distrobox ...' @@ -44,7 +29,7 @@ distrobox-debian: # Create a Fedora container distrobox-fedora: echo 'Creating Fedora distrobox ...' - distrobox create --nvidia --image registry.fedoraproject.org/fedora-toolbox:38 -n fedora -Y + distrobox create --nvidia --image ghcr.io/ublue-os/fedora-distrobox:latest -n fedora -Y # Create an openSUSE container distrobox-opensuse: @@ -56,17 +41,8 @@ distrobox-ubuntu: echo 'Creating Ubuntu distrobox ...' distrobox create --nvidia --image quay.io/toolbx-images/ubuntu-toolbox:22.04 -n ubuntu -Y -# Enroll secure boot key -enroll-secure-boot-key: - sudo mokutil --import /etc/pki/akmods/certs/akmods-ublue.der - -# Update system, flatpaks, and containers all at once -update: - rpm-ostree update - flatpak update -y - distrobox upgrade -a - -# Enable xwaylandvideobridge -fixscreenshare: - cp /usr/share/applications/org.kde.xwaylandvideobridge.desktop $HOME/.config/autostart/ - +# Install obs-studio-portable from wimpysworld, which bundles an extensive collection of 3rd party plugins +install-obs-studio-portable: + echo 'Installing obs-studio-portable...' && \ + distrobox create --nvidia --no-entry --image ghcr.io/ublue-os/obs-studio-portable -n obs-studio-portable -Y && \ + distrobox-enter -n obs-studio-portable -- 'bash -c "distrobox-export --app obs"' \ No newline at end of file diff --git a/build/ublue-os-just/40-nvidia.just b/build/ublue-os-just/40-nvidia.just new file mode 100644 index 00000000..1091bd15 --- /dev/null +++ b/build/ublue-os-just/40-nvidia.just @@ -0,0 +1,46 @@ +# 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 + +# 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 \ + docker.io/mirrorgooglecontainers/cuda-vector-add:v0.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 + +# 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 + 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 diff --git a/build/ublue-os-just/50-akmods.just b/build/ublue-os-just/50-akmods.just new file mode 100644 index 00000000..bb7ac769 --- /dev/null +++ b/build/ublue-os-just/50-akmods.just @@ -0,0 +1,29 @@ +# 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' + +# 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 + +# 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' + +# 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 \ No newline at end of file diff --git a/build/ublue-os-just/60-custom.just b/build/ublue-os-just/60-custom.just new file mode 100644 index 00000000..dc92af59 --- /dev/null +++ b/build/ublue-os-just/60-custom.just @@ -0,0 +1,5 @@ +# vim: set ft=make : + +# Enable xwaylandvideobridge +fixscreenshare: + cp /usr/share/applications/org.kde.xwaylandvideobridge.desktop $HOME/.config/autostart/ diff --git a/build/ublue-os-just/build.sh b/build/ublue-os-just/build.sh index 9e8d8e0f..674db077 100755 --- a/build/ublue-os-just/build.sh +++ b/build/ublue-os-just/build.sh @@ -6,7 +6,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) mkdir -p /tmp/ublue-os/rpmbuild/SOURCES -cp ${SCRIPT_DIR}/{custom,main,nvidia}.just /tmp/ublue-os/rpmbuild/SOURCES +cp ${SCRIPT_DIR}/*.just /tmp/ublue-os/rpmbuild/SOURCES cp ${SCRIPT_DIR}/ublue-os-just.sh /tmp/ublue-os/rpmbuild/SOURCES rpmbuild -ba \ diff --git a/build/ublue-os-just/custom.just b/build/ublue-os-just/custom.just deleted file mode 100644 index e69de29b..00000000 diff --git a/build/ublue-os-just/nvidia.just b/build/ublue-os-just/nvidia.just deleted file mode 100644 index 2e39e942..00000000 --- a/build/ublue-os-just/nvidia.just +++ /dev/null @@ -1,27 +0,0 @@ - -set-kargs-nvidia: - 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 - -test-cuda: - podman run \ - --user 1000:1000 \ - --security-opt=no-new-privileges \ - --cap-drop=ALL \ - --security-opt label=type:nvidia_container_t \ - docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1 - -setup-firefox-flatpak-vaapi-nvidia: - 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 diff --git a/build/ublue-os-just/ublue-os-just.sh b/build/ublue-os-just/ublue-os-just.sh index 9aaddb0a..426e6a1b 100755 --- a/build/ublue-os-just/ublue-os-just.sh +++ b/build/ublue-os-just/ublue-os-just.sh @@ -4,8 +4,16 @@ alias just="just --unstable" if [ ! -z "$HOME" ] && [ -d "$HOME" ] && [ ! -f "${HOME}/.justfile" ]; then cat > "${HOME}/.justfile" << EOF -!include /usr/share/ublue-os/just/main.just -!include /usr/share/ublue-os/just/nvidia.just -!include /usr/share/ublue-os/just/custom.just +!include /usr/share/ublue-os/justfile EOF fi + +if [ -f "${HOME}/.justfile" ]; then + if ! grep -Fxq '!include /usr/share/ublue-os/justfile' "${HOME}/.justfile"; then + # Remove any lines we may have added previously. + sed -i '/!include \/usr\/share\/ublue-os\/just\/.*.just/d' "${HOME}/.justfile" + + # Point to the new main justfile, place it as the first line + sed -i '1s/^/!include \/usr\/share\/ublue-os\/justfile\n/' "${HOME}/.justfile" + fi +fi \ No newline at end of file diff --git a/build/ublue-os-just/ublue-os-just.spec b/build/ublue-os-just/ublue-os-just.spec index 1d4be9d5..cbf35f0e 100644 --- a/build/ublue-os-just/ublue-os-just.spec +++ b/build/ublue-os-just/ublue-os-just.spec @@ -1,7 +1,7 @@ Name: ublue-os-just Packager: ublue-os Vendor: ublue-os -Version: 0.2 +Version: 0.3 Release: 1%{?dist} Summary: ublue-os just integration License: MIT @@ -11,9 +11,13 @@ BuildArch: noarch Supplements: just Source0: ublue-os-just.sh -Source1: custom.just -Source2: main.just -Source3: nvidia.just +Source1: 00-default.just +Source2: 10-update.just +Source3: 20-clean.just +Source4: 30-distrobox.just +Source5: 40-nvidia.just +Source6: 50-akmods.just +Source7: 60-custom.just %global sub_name %{lua:t=string.gsub(rpm.expand("%{NAME}"), "^ublue%-os%-", ""); print(t)} @@ -26,18 +30,29 @@ Adds ublue-os just integration for easier setup %build mkdir -p -m0755 %{buildroot}%{_datadir}/%{VENDOR}/%{sub_name} -cp %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{buildroot}%{_datadir}/%{VENDOR}/%{sub_name} install -Dm755 %{SOURCE0} %{buildroot}%{_sysconfdir}/profile.d/ublue-os-just.sh +install -Dm755 %{SOURCE0} %{buildroot}%{_datarootdir}/fish/vendor_conf.d/ublue-os-just.fish +cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{buildroot}%{_datadir}/%{VENDOR}/%{sub_name} + +# Create justfile which contains all .just files included in this package +for justfile in %{buildroot}%{_datadir}/%{VENDOR}/%{sub_name}/*.just; do + echo "!include %{_datadir}/%{VENDOR}/%{sub_name}/${justfile}" >> "%{buildroot}%{_datadir}/%{VENDOR}/justfile" +done %files %dir %attr(0755,root,root) %{_datadir}/%{VENDOR}/%{sub_name} -%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/custom.just -%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/main.just -%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/nvidia.just -%attr(0755,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/ublue-os-just.sh %attr(0755,root,root) %{_sysconfdir}/profile.d/ublue-os-just.sh +%attr(0755,root,root) %{_datarootdir}/fish/vendor_conf.d/ublue-os-just.fish +%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/*.just +%attr(0644,root,root) %{_datadir}/%{VENDOR}/justfile %changelog +* Thu Sep 21 2023 Kyle Gospodnetich - 0.3 +- Modify just files to be numbered for ordered loading +- Move to using a single master justfile +- Clean up previous installs to point to new file +- Add support for fish shell + * Sat May 13 2023 Benjamin Sherman - 0.2 - Refactor directory structure - Rename justfile to main.just