Expand multiple build capabilities

This commit is contained in:
2023-07-29 15:16:15 -04:00
parent 5723150307
commit e074d5b812
25 changed files with 116 additions and 91 deletions

View File

@@ -1,130 +0,0 @@
#!/bin/bash
# original script here: https://github.com/dnkmmr69420/nix-with-selinux/blob/main/silverblue-installer.sh
# thanks dnkmmr!
sudo sleep 2
echo "Adding SELinux content to /nix"
sudo semanage fcontext -a -t etc_t '/nix/store/[^/]+/etc(/.*)?' ; sudo semanage fcontext -a -t lib_t '/nix/store/[^/]+/lib(/.*)?' ; sudo semanage fcontext -a -t systemd_unit_file_t '/nix/store/[^/]+/lib/systemd/system(/.*)?' ; sudo semanage fcontext -a -t man_t '/nix/store/[^/]+/man(/.*)?' ; sudo semanage fcontext -a -t bin_t '/nix/store/[^/]+/s?bin(/.*)?' ; sudo semanage fcontext -a -t usr_t '/nix/store/[^/]+/share(/.*)?' ; sudo semanage fcontext -a -t var_run_t '/nix/var/nix/daemon-socket(/.*)?' ; sudo semanage fcontext -a -t usr_t '/nix/var/nix/profiles(/per-user/[^/]+)?/[^/]+'
sleep 1
sudo mkdir /var/lib/nix
sleep 1
echo "Adding SELinux content to /var/lib/nix"
sudo semanage fcontext -a -t etc_t '/var/lib/nix/store/[^/]+/etc(/.*)?' ; sudo semanage fcontext -a -t lib_t '/var/lib/nix/store/[^/]+/lib(/.*)?' ; sudo semanage fcontext -a -t systemd_unit_file_t '/var/lib/nix/store/[^/]+/lib/systemd/system(/.*)?' ; sudo semanage fcontext -a -t man_t '/var/lib/nix/store/[^/]+/man(/.*)?' ; sudo semanage fcontext -a -t bin_t '/var/lib/nix/store/[^/]+/s?bin(/.*)?' ; sudo semanage fcontext -a -t usr_t '/var/lib/nix/store/[^/]+/share(/.*)?' ; sudo semanage fcontext -a -t var_run_t '/var/lib/nix/var/nix/daemon-socket(/.*)?' ; sudo semanage fcontext -a -t usr_t '/var/lib/nix/var/nix/profiles(/per-user/[^/]+)?/[^/]+'
echo "Creating service files"
sleep 1
sleep 1
echo "Creating rootfs mkdir service"
sudo tee /etc/systemd/system/mkdir-rootfs@.service <<EOF
[Unit]
Description=Enable mount points in / for ostree
ConditionPathExists=!%f
DefaultDependencies=no
Requires=local-fs-pre.target
After=local-fs-pre.target
[Service]
Type=oneshot
ExecStartPre=chattr -i /
ExecStart=mkdir -p '%f'
ExecStopPost=chattr +i /
EOF
sleep 1
echo "Creating nix.mount"
sudo tee /etc/systemd/system/nix.mount <<EOF
[Unit]
Description=Nix Package Manager
DefaultDependencies=no
After=mkdir-rootfs@nix.service
Wants=mkdir-rootfs@nix.service
Before=sockets.target
After=ostree-remount.service
BindsTo=var.mount
[Mount]
What=/var/lib/nix
Where=/nix
Options=bind
Type=none
EOF
sleep 1
echo "Enabling mount and resetting SELinux context"
sleep 1
sudo systemctl daemon-reload ; sudo systemctl enable nix.mount ; sudo systemctl start nix.mount ; sudo restorecon -RF /nix
sleep 1
echo "Temorarily setting SELinux to Permissive"
sudo setenforce Permissive
sleep 1
echo "Preparing the nix install script"
sleep 2
sh <(curl -L https://nixos.org/nix/install) --daemon
echo "Nix installer has finished running"
sleep 1
echo "Copying service files"
sleep 1
echo "Creating SSL cert file"
sudo mkdir -p /etc/systemd/system/nix-daemon.service.d/
sudo tee /etc/systemd/system/nix-daemon.service.d/override.conf <<EOF
[Service]
Environment="NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt"
EOF
sudo rm -f /etc/systemd/system/nix-daemon.{service,socket} ; sudo cp /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.{service,socket} /etc/systemd/system/ ; sudo restorecon -RF /nix ; sudo systemctl daemon-reload ; sudo systemctl enable --now nix-daemon.socket
sleep 1
echo "Setting SELinux back to Enforcing"
sudo setenforce Enforcing
echo "Modifying /etc/nix/nix.conf"
echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf
sleep 1
echo "Adding /etc/profile.d/nix-app-icons.sh"
sudo rm -f /etc/profile.d/nix-app-icons.sh
sudo tee /etc/profile.d/nix-app-icons.sh <<EOF
XDG_DATA_DIRS="$HOME/.nix-profile/share:/nix/var/nix/profiles/default/share:$XDG_DATA_DIRS"
EOF
sleep 1
echo "Installing nix backup"
sudo mkdir /opt/nixbackup
sudo cp -R /nix /opt/nixbackup
sudo tee /opt/nixbackup/reset-nix <<EOF
#!/bin/bash
sudo echo "Resetting nix..."
sudo rm -rf /nix/*
sudo mkdir -p /nix
sudo cp -R /opt/nixbackup/nix/* /nix/
sudo restorecon -RF /nix
sudo echo "Nix has been reset. Reboot for changes to apply."
EOF
sudo chmod a+x /opt/nixbackup/reset-nix
sudo echo "Finished installing nix backup"
sleep 1
echo "You MUST reboot in order for the installation to finish"
echo "Reboot your system by typing:"
echo "systemctl reboot"

View File

@@ -1,86 +0,0 @@
#!/bin/bash
VERBOSITY="${VERBOSITY:-0}"
SUDO_PROGRAM="${SUDO_PROGRAM:-sudo}"
USER_WARNING="${USER_WARNING:-1}"
[ "$VERBOSITY" = "1" ] && set -x
set -uo pipefail
function log {
LEVEL=$1
shift
echo "[${LEVEL}]" $@ >&2
}
if [ "$EUID" = 0 ] ; then
log WARNING "Do not run this command as root, as it won't delete proper files in your system"
exit
fi
if [ "$USER_WARNING" = 1 ] ; then
cat <<EOF
This is a destructive operation, it will delete the following:
Services:
- nix-daemon.service
- nix-daemon.socket
- nix.mount
- mkdir-rootfs@.service
Files & Directories:
- $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs}
- /etc/profile.d/nix-app-icons.sh
- /etc/profile.d/nix.sh
- /etc/nix
- /etc/tmpfiles.d/nix-daemon.conf
- ~root/.nix-channels
- ~root/.nix-defexpr
- ~root/.nix-profile
Users & Groups:
- nixbld[0-32]
If you are unsure about everything that will be done, make sure to read the source code of this script by running "cat $(realpath $0)" on your terminal.
EOF
read -r -p "Are you sure you want to proceed? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
;;
*)
exit
;;
esac
fi
log TASK 'Removing nix configuration from "\$HOME"'
log TASK 'To finish removing everything, make sure to remove the '. "$HOME/.nix-profile/etc/profile.d/nix.sh"' line in your ~/.profile or ~/.bash_profile'
rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs,.local/state/nix,.cache/nix}
log TASK 'Deleting nix system users'
for i in $(seq 1 32); do
"$SUDO_PROGRAM" userdel "nixbld$i"
done
"$SUDO_PROGRAM" groupdel 'nixbld'
log TASK 'Removing nix systemd services'
"$SUDO_PROGRAM" systemctl disable --now nix-daemon.service nix-daemon.socket nix.mount mkdir-rootfs@.service
"$SUDO_PROGRAM" systemctl daemon-reload
"$SUDO_PROGRAM" rm -rf '/etc/systemd/system/mkdir-rootfs@.service' '/etc/systemd/system/nix.mount' /etc/systemd/system/nix-daemon.{service,socket} '/etc/systemd/system/nix-daemon.service.d/'
log TASK 'Removing remaining nix system configuration'
"$SUDO_PROGRAM" rm -rf '/etc/profile.d/nix-app-icons.sh' '/etc/nix' '/etc/profile.d/nix.sh' '/etc/tmpfiles.d/nix-daemon.conf' ~root/.nix-channels ~root/.nix-defexpr ~root/.nix-profile
"$SUDO_PROGRAM" cp -f '/etc/bashrc.backup-before-nix' '/etc/bashrc'
log TASK 'Removing /var/lib/nix'
"$SUDO_PROGRAM" restorecon -RF '/var/lib/nix'
"$SUDO_PROGRAM" restorecon -RF '/nix'
"$SUDO_PROGRAM" rm -rf '/var/lib/nix'
log INFO 'Make sure to remove residual configurations from the following files:' "/etc/bash.bashrc /etc/bashrc /etc/profile /etc/zsh/zshrc /etc/zshrc $HOME/.bashr $HOME/.bash_profile $HOME/.zshrc $HOME/.profile"
log INFO 'You may now reboot your system to confirm these changes with "systemctl reboot"'

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>steam-local-transfer</short>
<description>Steam local transfer</description>
<port protocol="tcp" port="57343"/>
<port protocol="tcp" port="27040"/>
</service>

View File

@@ -1 +0,0 @@
PCIE_ASPM_ON_BAT=powersupersave

View File

@@ -1,4 +0,0 @@
SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3106", ATTR{manufacturer}=="8BitDo", RUN+="/usr/bin/systemctl start 8bitdo-ultimate-xinput@2dc8:3106"
# This device is connected when the above device disconnects
SUBSYSTEM=="usb", ATTR{idVendor}=="2dc8", ATTR{idProduct}=="3109", ATTR{manufacturer}=="8BitDo", RUN+="/usr/bin/systemctl stop 8bitdo-ultimate-xinput@2dc8:3106"

View File

@@ -1,6 +0,0 @@
[Unit]
Description=8BitDo Ultimate Controller XInput Mode Xbobxdrv Daemon
[Service]
Type=simple
ExecStart=/usr/bin/xboxdrv --mimic-xpad --silent --type xbox360 --device-by-id %I --force-feedback

View File

@@ -1,9 +0,0 @@
[Desktop Entry]
Name=uBlue First Boot Setup
Comment=Sets up the uBlue desktop on first boot.
GenericName=Launcher
Categories=Utility;System;
Exec=/usr/share/ublue-os/firstboot/launcher/autostart.sh
Icon=application-x-executable
Terminal=false
Type=Application

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Simply launches the "yafti" GUI with the uBlue image's configuration.
/usr/bin/yafti /usr/share/ublue-os/firstboot/yafti.yml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -1,15 +0,0 @@
# Only process users with home directories, but skip the "root" user.
if [ "$(id -u)" != "0" ] && [ ! -z "$HOME" ] && [ -d "$HOME" ]; then
# Ensure target file exists and is a symlink (not a regular file or dir).
if [ ! -L "$HOME"/.config/autostart/ublue-firstboot.desktop ]; then
# Remove any leftovers or incorrect (non-link) files with the same name.
rm -rf "$HOME"/.config/autostart/ublue-firstboot.desktop
# Create symlink to uBlue's autostart runner.
# Note that "broken autostart symlinks" are harmless if they remain
# after distro switching, and just cause a minor syslog warning. The
# user can manually delete this file if they migrate away from uBlue.
mkdir -p "$HOME"/.config/autostart
ln -s "/usr/share/ublue-os/firstboot/launcher/autostart.desktop" "$HOME"/.config/autostart/ublue-firstboot.desktop
fi
fi

View File

@@ -1,143 +0,0 @@
title: Welcome to uBlue
properties:
mode: "run-on-change"
screens:
first-screen:
source: yafti.screen.title
values:
title: "Welcome to uBlue (Alpha)"
icon: "/path/to/icon"
description: |
This guided installer will help you get started with your new system.
can-we-modify-your-flatpaks:
source: yafti.screen.consent
values:
title: Welcome, Traveler!
condition:
run: flatpak remotes --columns=name | grep fedora
description: |
We have detected the limited, Fedora-provided Flatpak remote on your system, whose applications are usually missing important codecs and other features. This step will therefore remove all basic Fedora Flatpaks from your system! We will instead switch all core Flatpak applications over to the vastly superior, unfiltered Flathub. If you don't want to do this, simply exit this installer.
actions:
- run: flatpak remote-delete --system --force fedora
- run: flatpak remote-delete --user --force fedora
- run: flatpak remove --system --noninteractive --all
- run: flatpak remote-add --if-not-exists --system flathub https://flathub.org/repo/flathub.flatpakrepo
- run: flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
check-system-flathub:
source: yafti.screen.consent
values:
title: Missing Flathub Repository (System)
condition:
run: flatpak remotes --system --columns=name | grep flathub | wc -l | grep '^0$'
description: |
We have detected that you don't have Flathub's repository on your system. We will now add that repository to your system-wide list.
actions:
- run: flatpak remote-add --if-not-exists --system flathub https://flathub.org/repo/flathub.flatpakrepo
check-user-flathub:
source: yafti.screen.consent
values:
title: Missing Flathub Repository (User)
condition:
run: flatpak remotes --user --columns=name | grep flathub | wc -l | grep '^0$'
description: |
We have detected that you don't have Flathub's repository on your current user account. We will now add that repository to your account.
actions:
- run: flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
applications:
source: yafti.screen.package
values:
title: Application Installer
show_terminal: true
package_manager: yafti.plugin.flatpak
package_manager_defaults:
user: false
system: true
groups:
Core GNOME Apps:
description: Core system applications for the GNOME desktop environment.
default: true
packages:
- Calculator: org.gnome.Calculator
- Calendar: org.gnome.Calendar
- Characters: org.gnome.Characters
- Cheese: org.gnome.Cheese
- Clocks: org.gnome.clocks
- Connections: org.gnome.Connections
- Contacts: org.gnome.Contacts
- Disk Usage Analyzer: org.gnome.baobab
- Document Scanner: org.gnome.SimpleScan
- Document Viewer: org.gnome.Evince
- Extension Manager: com.mattjakeman.ExtensionManager
- Font Viewer: org.gnome.font-viewer
- Image Viewer: org.gnome.eog
- Logs: org.gnome.Logs
- Maps: org.gnome.Maps
- Photos (Organizer): org.gnome.Photos
- Sushi (Nautilus Previewer): org.gnome.NautilusPreviewer
- Text Editor: org.gnome.TextEditor
- Videos (Player): org.gnome.Totem
- Weather: org.gnome.Weather
System Apps:
description: System applications for all desktop environments.
default: true
packages:
- Deja Dup Backups: org.gnome.DejaDup
- Fedora Media Writer: org.fedoraproject.MediaWriter
- Flatseal (Permission Manager): com.github.tchx84.Flatseal
- Font Downloader: org.gustavoperedo.FontDownloader
- Mozilla Firefox: org.mozilla.firefox
Web Browsers:
description: Additional browsers to complement or replace Firefox.
default: false
packages:
- Brave: com.brave.Browser
- Google Chrome: com.google.Chrome
- Microsoft Edge: com.microsoft.Edge
- Opera: com.opera.Opera
Gaming:
description: "Rock and Stone!"
default: false
packages:
- Bottles: com.usebottles.bottles
- Discord: com.discordapp.Discord
- GNOME Games: org.gnome.Games
- Heroic Games Launcher: com.heroicgameslauncher.hgl
- Steam: com.valvesoftware.Steam
- Gamescope (Utility): com.valvesoftware.Steam.Utility.gamescope
- MangoHUD (Utility): org.freedesktop.Platform.VulkanLayer.MangoHud//22.08
- SteamTinkerLaunch (Utility): com.valvesoftware.Steam.Utility.steamtinkerlaunch
- Proton Updater for Steam: net.davidotek.pupgui2
Office:
description: Boost your productivity.
default: false
packages:
- LibreOffice: org.libreoffice.LibreOffice
- OnlyOffice: org.onlyoffice.desktopeditors
- Obsidian: md.obsidian.Obsidian
- Slack: com.slack.Slack
- Standard Notes: org.standardnotes.standardnotes
- Thunderbird Email: org.mozilla.Thunderbird
Streaming:
description: Stream to the Internet.
default: false
packages:
- OBS Studio: com.obsproject.Studio
- VkCapture for OBS: com.obsproject.Studio.OBSVkCapture
- Gstreamer for OBS: com.obsproject.Studio.Plugin.Gstreamer
- Gstreamer VAAPI for OBS: com.obsproject.Studio.Plugin.GStreamerVaapi
- Boatswain for Streamdeck: com.feaneron.Boatswain
final-screen:
source: yafti.screen.title
values:
title: "All done!"
icon: "/path/to/icon"
links:
- "Install More Applications":
run: /usr/bin/gnome-software
- "Website":
run: /usr/bin/xdg-open https://ublue.it
- "Join the Discord Community":
run: /usr/bin/xdg-open https://discord.gg/XjG48C7VHx
description: |
Thanks for trying uBlue, we hope you enjoy it!

View File

@@ -1,32 +0,0 @@
setup-flatpaks:
#!/usr/bin/env bash
echo 'Installing flatpaks from the ublue recipe ...'
flatpaks=$(yq -- '.firstboot.flatpaks[]' "/usr/share/ublue-os/recipe.yml")
for pkg in $flatpaks; do \
echo "Installing: ${pkg}" && \
flatpak install --user --noninteractive flathub $pkg; \
done
setup-gaming:
echo 'Setting up gaming experience ... lock and load.'
flatpak install -y --user \\
com.discordapp.Discord \\
com.feaneron.Boatswain \\
org.freedesktop.Platform.VulkanLayer.MangoHud//22.08 \\
org.freedesktop.Platform.VulkanLayer.OBSVkCapture//22.08 \\
org.freedesktop.Platform.VulkanLayer.vkBasalt//22.08 \\
com.heroicgameslauncher.hgl \\
com.obsproject.Studio \\
com.obsproject.Studio.Plugin.OBSVkCapture \\
com.obsproject.Studio.Plugin.Gstreamer \\
com.usebottles.bottles \\
com.valvesoftware.Steam \\
com.valvesoftware.Steam.Utility.gamescope \\
net.davidotek.pupgui2
flatpak override com.usebottles.bottles --user --filesystem=xdg-data/applications
flatpak override --user --env=MANGOHUD=1 com.valvesoftware.Steam
flatpak override --user --env=MANGOHUD=1 com.heroicgameslauncher.hgl
nix-me-up:
echo 'Setting phasers to kill. Installing nix.'
/usr/bin/ublue-nix-install