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

refactor: use standard path for just plus... #42

Merged
merged 3 commits into from
May 14, 2023
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
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
17 changes: 14 additions & 3 deletions build/ublue-os-just/ublue-os-just.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Add justfile to HOME if it's not already installed
# Add uBlue's justfiles to users with home directories which lack 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"
if [ ! -z "$HOME" ] && [ -d "$HOME" ] && [ ! -f "${HOME}/.justfile" ]; then
UBLUE_JUST=/usr/share/ublue-os/just
USER_JUSTFILE="${HOME}/.justfile"
touch "${USER_JUSTFILE}"
if [ -f ${UBLUE_JUST}/main.just ]; then
cat ${UBLUE_JUST}/main.just >> "${USER_JUSTFILE}"
fi
if [ -f ${UBLUE_JUST}/nvidia.just ] && [ rpm -q ublue-os-nvidia-addons ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really good idea, and good reason for it!

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