Skip to content

Commit

Permalink
refactor: use standard path for just plus...
Browse files Browse the repository at this point in the history
This changes the ublue-os-just RPM by:
- using /usr/share/ublue-os/just path (no double ublue-os)
- renames "justfile" to "main.just"
- adds "nvidial.just" and "custom.just"
- improves profile script to smartly add appropriate just files

Closes #41
  • Loading branch information
bsherman committed May 13, 2023
1 parent 43f93a9 commit 6e75367
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 12 deletions.
3 changes: 2 additions & 1 deletion build/ublue-os-just/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

mkdir -p /tmp/ublue-os/rpmbuild/SOURCES

cp ${SCRIPT_DIR}/{justfile,ublue-os-just.sh} /tmp/ublue-os/rpmbuild/SOURCES
cp ${SCRIPT_DIR}/{custom,main,nvidia}.just /tmp/ublue-os/rpmbuild/SOURCES
cp ${SCRIPT_DIR}/ublue-os-just.sh /tmp/ublue-os/rpmbuild/SOURCES

rpmbuild -ba \
--define '_topdir /tmp/ublue-os/rpmbuild' \
Expand Down
Empty file added build/ublue-os-just/custom.just
Empty file.
File renamed without changes.
29 changes: 29 additions & 0 deletions build/ublue-os-just/nvidia.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

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

enroll-secure-boot-key:
sudo mokutil --import /etc/pki/akmods/certs/akmods-nvidia.der

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
16 changes: 13 additions & 3 deletions build/ublue-os-just/ublue-os-just.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Add justfile to HOME if it's not already installed
# Add uBlue's justfiles to user HOME if they don't already have a justfile.

if [[ ! -f "${HOME}/.justfile" && -f /usr/share/ublue-os/ublue-os-just/justfile ]]; then
cp /usr/share/ublue-os/ublue-os-just/justfile "${HOME}/.justfile"
UBLUE_JUST=/usr/share/ublue-os/just
USER_JUSTFILE="${HOME}/.justfile"
if [ ! -f "${USER_JUSTFILE}" ]; then
if [ -f ${UBLUE_JUST}/main.just ]; then
cp ${UBLUE_JUST}/main.justfile "${USER_JUSTFILE}"
fi
if [ -f ${UBLUE_JUST}/nvidia.just ] && [ rpm -q xorg-x11-drv-nvidia ]; then
cat ${UBLUE_JUST}/nvidia.just >> "${USER_JUSTFILE}"
fi
if [ -f ${UBLUE_JUST}/custom.just ]; then
cat ${UBLUE_JUST}/custom.just >> "${USER_JUSTFILE}"
fi
fi

28 changes: 20 additions & 8 deletions build/ublue-os-just/ublue-os-just.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Name: ublue-os-just
Packager: ublue-os
Vendor: ublue-os
Version: 0.1
Version: 0.2
Release: 1%{?dist}
Summary: ublue-os just integration
License: MIT
Expand All @@ -10,8 +10,12 @@ URL: https://github.com/ublue-os/config
BuildArch: noarch
Supplements: just

Source0: justfile
Source1: ublue-os-just.sh
Source0: ublue-os-just.sh
Source1: custom.just
Source2: main.just
Source3: nvidia.just

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

%description
Adds ublue-os just integration for easier setup
Expand All @@ -21,16 +25,24 @@ Adds ublue-os just integration for easier setup

%build

mkdir -p -m0755 %{buildroot}%{_datadir}/%{VENDOR}/%{NAME}
cp %{SOURCE0} %{SOURCE1} %{buildroot}%{_datadir}/%{VENDOR}/%{NAME}
mkdir -p -m0755 %{buildroot}%{_datadir}/%{VENDOR}/%{sub_name}
cp %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} %{buildroot}%{_datadir}/%{VENDOR}/%{sub_name}
install -Dm755 %{SOURCE1} %{buildroot}%{_sysconfdir}/profile.d/ublue-os-just.sh

%files
%dir %attr(0755,root,root) %{_datadir}/%{VENDOR}/%{NAME}
%attr(0644,root,root) %{_datadir}/%{VENDOR}/%{NAME}/justfile
%attr(0755,root,root) %{_datadir}/%{VENDOR}/%{NAME}/ublue-os-just.sh
%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

%changelog
* Sun May 13 2023 Benjamin Sherman <benjamin@holyarmy.org> - 0.2
- Refactor directory structure
- Rename justfile to main.just
- Add nvidia.just and custom.just
- Make profile script intelligent about including nvidia.just

* Sun Mar 05 2023 Joshua Stone <joshua.gage.stone@gmail.com> - 0.1
- Add justfile integration

0 comments on commit 6e75367

Please sign in to comment.