Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Split justfiles into multiple numbered files to fix issue with default command on other releases. #118

Merged
merged 14 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
20 changes: 20 additions & 0 deletions build/ublue-os-just/00-default.just
Original file line number Diff line number Diff line change
@@ -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'
7 changes: 7 additions & 0 deletions build/ublue-os-just/10-update.just
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions build/ublue-os-just/20-clean.just
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 ...'
Expand All @@ -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:
Expand All @@ -55,18 +40,3 @@ distrobox-opensuse:
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/

KyleGospo marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# vim: set ft=make :

# Set needed kernel arguments for Nvidia GPUs
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 support for Nvidia GPUs
test-cuda:
podman run \
--user 1000:1000 \
Expand All @@ -14,6 +17,7 @@ test-cuda:
--security-opt label=type:nvidia_container_t \
docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1

# Enable VAAPI in Firefox for Nvidia GPUs
setup-firefox-flatpak-vaapi-nvidia:
flatpak override \
--user \
Expand Down
5 changes: 5 additions & 0 deletions build/ublue-os-just/50-custom.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# vim: set ft=make :

# Enable xwaylandvideobridge
fixscreenshare:
cp /usr/share/applications/org.kde.xwaylandvideobridge.desktop $HOME/.config/autostart/
2 changes: 1 addition & 1 deletion build/ublue-os-just/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
Empty file removed build/ublue-os-just/custom.just
Empty file.
9 changes: 6 additions & 3 deletions build/ublue-os-just/ublue-os-just.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ 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/just/00-default.just
!include /usr/share/ublue-os/just/10-update.just
!include /usr/share/ublue-os/just/20-clean.just
!include /usr/share/ublue-os/just/30-distrobox.just
!include /usr/share/ublue-os/just/40-nvidia.just
!include /usr/share/ublue-os/just/50-custom.just
EOF
fi
16 changes: 8 additions & 8 deletions build/ublue-os-just/ublue-os-just.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ 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-custom.just

%global sub_name %{lua:t=string.gsub(rpm.expand("%{NAME}"), "^ublue%-os%-", ""); print(t)}

Expand All @@ -26,15 +29,12 @@ 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}
cp %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{buildroot}%{_datadir}/%{VENDOR}/%{sub_name}
install -Dm755 %{SOURCE0} %{buildroot}%{_sysconfdir}/profile.d/ublue-os-just.sh

%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(0644,root,root) %{_datadir}/%{VENDOR}/%{sub_name}/*.just
%attr(0755,root,root) %{_sysconfdir}/profile.d/ublue-os-just.sh

%changelog
Expand Down