Skip to content
This repository has been archived by the owner on Dec 25, 2024. It is now read-only.

Commit

Permalink
fix: fixes for studio cli UX and yafti crashing on run
Browse files Browse the repository at this point in the history
  • Loading branch information
tulilirockz committed Mar 18, 2024
1 parent 6b416fa commit d019837
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 89 deletions.
8 changes: 0 additions & 8 deletions config/files/shared/libexec/atomic-studio-cli/davinci.nu

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export def nix_installer [] {
export def brew_installer [] {
mut executable_installer = "/usr/lib/brew-install"

if not ( $executable_installer | path exists) {
if not ($executable_installer | path exists) {
$executable_installer = /tmp/brew-install
http get "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh" | save -f $executable_installer
chmod +x $executable_installer
}
let installer = $executable_installer

return { yes | run-external $installer }
return { yes | run-external pkexec $installer }
}

export def distrobox_installer [] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export def brew_install [yes: bool, packages: list<string>] {

export def nix_install [yes: bool, packages: list<string>] {
if (which nix | length) != 0 {
run-external nix profile install ($packages | each {|value| $"nixpkgs#($value) "} | str join)
run-external nix profile install ($packages | each {|value| $"nixpkgs#($value)"} | str join)
exit 0
}

Expand Down
5 changes: 3 additions & 2 deletions config/files/shared/libexec/atomic-studio-cli/manager.nu
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env -S nu

use lib/user_interaction.nu [user_prompt]
use lib/distrobox.nu [DISTROBOXES_META]
use lib/distrobox.nu [DISTROBOXES_META, gen_export_string]
use lib/manager_installers.nu [brew_install, nix_install, distrobox_install, pipx_install, brew_uninstall, nix_uninstall, distrobox_uninstall, pipx_uninstall]

# Available package managers: ["apt", "brew", "nix", "dnf", "yum", "paru", "pacman", "pipx"]
Expand All @@ -23,7 +23,8 @@ export def "main manager export" [
mkdir $export_Path

let selected_box = ($DISTROBOXES_META | select aliases name | where { |e| ($e.name == $box_or_subsystem) or ($e.aliases == $box_or_subsystem) } | get name | str join)
let packages_export_cmd: string = (gen_export_string $packages $export_Path)
let packages_export_cmd = gen_export_string $packages $export_Path

distrobox-enter $selected_box -- sh -c $"($packages_export_cmd) 2> /dev/null" err> /dev/null
}

Expand Down
10 changes: 5 additions & 5 deletions config/files/shared/libexec/atomic-studio-cli/motd.nu
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def replace_format [
# Turn MOTD off
export def "main motd off" [] {
let MOTD_DISABLED_FILE = $"($env.HOME)/.config/atomic-studio/motd_disabled"
if not ($MOTD_DISABLED_FILE | path exists) {
if ($MOTD_DISABLED_FILE | path exists) {
echo "MOTD is already disabled"
exit 0
}
Expand Down Expand Up @@ -79,9 +79,9 @@ export def "main motd" [
}

let CURRENT_TIP_FILE = (ls $MOTD_PATH | where { |e| ($e.type == "file") and ($e.name | str ends-with md) } | shuffle | get 0.name)
let IMAGE_INFO = (open $IMAGE_INFO_PATH | from json)
let IMAGE_NAME = ($IMAGE_INFO).image-ref | sed -e 's|ostree-image-signed:docker://ghcr.io/.*/||' -e 's|ostree-unverified-registry:ghcr.io/.*/||' )
mut TIP = "󰋼 (open ($CURRENT_TIP_FILE) | lines | shuffle | get 0)"
let IMAGE_INFO = (open $IMAGE_INFO_PATH)
let IMAGE_NAME = (($IMAGE_INFO).image-ref | sed -e 's|ostree-image-signed:docker://ghcr.io/.*/||' -e 's|ostree-unverified-registry:ghcr.io/.*/||' )
mut TIP = "󰋼 (open $CURRENT_TIP_FILE | lines | shuffle | get 0 | str join)"

let IMAGE_DATE = (rpm-ostree status --booted | sed -n 's/.*Timestamp: \(.*\)/\1/p')
let IMAGE_DATE_SECONDS = (run-external date '-d' "$IMAGE_DATE" +%s --redirect-combine | capture).stdout
Expand All @@ -93,7 +93,7 @@ export def "main motd" [
$TIP = '#  Your current image is over 1 month old, run `studio-update`'
}

if $no_tip {
if $no_tip != null {
$TIP = ""
}

Expand Down
21 changes: 12 additions & 9 deletions config/files/shared/libexec/atomic-studio-cli/pw.nu
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ def default_reset_message [message: string] {
return $"($message) should be reset now."
}

# Reset the entire custom pipewire configuration
export def "main pw reset config" [] {
let pipewire_config_path = $"($env.HOME)/.config/pipewire"
rm -f $pipewire_config_path
systemctl restart --user pipewire.service
echo (default_reset_message "Pipewire user config")
}

# Resets PIPEWIRE_QUANTUM variable back to its default
# Reset PIPEWIRE_QUANTUM variable back to its default
export def "main pw reset quantum-buffersize" [] {
rm -f $TARGET_CONFIG_PATH
pw-metadata -n settings 0 clock.force-quantum 0
Expand All @@ -41,7 +42,7 @@ export def "main pw set quantum-buffersize" [buffersize: int] {
$iter = $iter + 1
}

if not is_valid_thing {
if not $is_valid_thing {
echo "Invalid Value"
exit 2
}
Expand All @@ -61,8 +62,7 @@ export def "main pw set config" [

mkdir $pipewire_config_path

mut target_fpath = ""
$target_fpath = $pipewire_sys_path
mut target_fpath = $pipewire_sys_path
if $user != null {
$target_fpath = $pipewire_config_path
}
Expand All @@ -81,23 +81,26 @@ export def "main pw set config" [

# Enables realtime in linux kernel arguments
export def "main pw enable realtime" [] {
rpm-ostree kargs --append-if-missing="preempt=full"
rpm-ostree kargs --append-if-missing="threadirqs"

for $group in $REALTIME_GROUPS {
pkexec usermod -a -G $group $env.USER
}

rpm-ostree kargs --append-if-missing="preempt=full"
rpm-ostree kargs --append-if-missing="threadirqs"

echo "Reboot for changes to take effect."
}

# Disables realtime from linux kernel arguments
export def "main pw disable realtime" [] {
rpm-ostree kargs --delete-if-present="preempt=full"
rpm-ostree kargs --delete-if-present="threadirqs"

for $group in $REALTIME_GROUPS {
pkexec usermod -R $group $env.USER
}

rpm-ostree kargs --delete-if-present="preempt=full"
rpm-ostree kargs --delete-if-present="threadirqs"

echo "Reboot for changes to take effect."
}

Expand Down
5 changes: 3 additions & 2 deletions config/files/shared/libexec/atomic-studio-cli/reporter.nu
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ export def "main reporter" [

$fetch | each { |fetch_arg|
table_commands ...(match $fetch_arg {
audio => { ["pactl info", "pw-dump"] },
audio => { ["pactl info" "pw-dump"] },
packages => { ["rpm -qa" "rpm-ostree status -v"] },
distrobox => { ["podman images" "distrobox ls" "podman ps -a"] },
systemd => { ["systemctl status" "systemctl status --user"] },
env => { ["$env"] },
_ => { ["lscpu" "lsmem" "lsblk" "mount"] }
hw => { ["lscpu" "lsmem" "lsblk" "mount"] },
_ => { echo "Invalid command" ; exit 1 },
})
} | table -e --theme basic | nu --stdin -c $"($method_command)"
}
46 changes: 27 additions & 19 deletions config/files/shared/libexec/atomic-studio-cli/setup.nu
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ export def "main setup" [] {
echo "Usage setup <subcommand>."
}

# This only works for Nvidia!
# Disable Supergfxctl, a GPU switcher for hybrid laptops
export def "main setup remove supergfxctl" [] {
systemctl disable --now supergfxd.service
}

# Uninstall LACT, an overclocking utility for AMD cards
export def "main setup remove amd-lact" [] {
systemctl disable --now lactd
rpm-ostree remove (rpm -qa | grep lact) -y --apply-live
}

# Removes OpenTabletDriver services and the installation from container (does not delete the container itself.)
export def "main setup remove opentabletdriver" [] {
Expand All @@ -30,10 +19,7 @@ export def "main setup remove opentabletdriver" [] {
distrobox enter -n $archbox_entry.name -- 'paru -Rns opentabletdriver --noconfirm'
}

# Removes RTCQS from the host system
export def "main setup remove rtcqs" [] {
pipx uninstall rtcqs
}


# Install OpenTabletDriver in a container
export def "main setup install opentabletdriver" [
Expand Down Expand Up @@ -98,7 +84,7 @@ export def "main setup install amd-lact" [] {
ublue-update --wait
echo 'Installing LACT...'
http get (http get "https://api.github.com/repos/ilya-zlobintsev/LACT/releases/latest" | get assets | where {|e| $e.name | str ends-with "fedora-39.rpm"}).0.browser_download_url | save -f /tmp/lact.rpm
rpm-ostree install --apply-live -y /tmp/lact.rpm
pkexec rpm-ostree install --apply-live -y /tmp/lact.rpm
sleep 2sec
systemctl daemon-reload
systemctl enable --now lactd
Expand Down Expand Up @@ -153,9 +139,10 @@ export def "main setup remove davinci" [
if $box_name == null {
$install_box = $INSTALLATION_BOX
}

try { distrobox ls | grep $install_box } catch {
echo "The selected box ($install_box) is not created yet."

let install_box_static = $install_box
try { distrobox ls | grep $install_box } catch {
echo $"The selected box ($install_box_static) is not created yet."
exit 1
}

Expand All @@ -165,3 +152,24 @@ export def "main setup remove davinci" [
}
}

# Disable Supergfxctl, a GPU switcher for hybrid laptops
export def "main setup remove supergfxctl" [] {
systemctl disable --now supergfxd.service
}

# Removes RTCQS from the host system
export def "main setup remove rtcqs" [] {
pipx uninstall rtcqs
}

# Uninstall LACT, an overclocking utility for AMD cards
export def "main setup remove amd-lact" [--force (-f)] {
try { rpm -qa | grep lact } catch {
echo "Amd LACT doesnt seem to be installed. Use --force if it actually is installed."
if $force == null {
exit 1
}
}
systemctl disable --now lactd
rpm-ostree remove (rpm -qa | grep lact) -y --apply-live
}
6 changes: 4 additions & 2 deletions config/files/shared/libexec/atomic-studio-cli/update.nu
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ export def "main update pin" [

# Rollback an update
export def "main update rollback" [] {
rpm-ostree rollback
pkexec rpm-ostree rollback
}

# Show changelogs for the current system
export def "main update changelog" [] {
rpm-ostree db diff --changelogs
pkexec rpm-ostree db diff --changelogs
}

# Disable automatic updates
export def "main update auto off" [] {
systemctl disable --now ublue-update.timer
}

# Enable automatic updates
export def "main update auto on" [] {
systemctl enable --now ublue-update.timer
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Packages installed in Distrobox can be exported to appear like any other application~[View documentation](https://distrobox.it/usage/distrobox-export/)
*Update break something?* You can roll back and pin the previous release or rebase by build date~[View our guide](https://universal-blue.discourse.group/docs?topic=36)
*This isn't a distro*, this is a custom image built on  Fedora Atomic Desktop technology~[View our mission](https://ublue.it/mission/)
*Looking to dual-boot with  Windows?*~[View dual booting guide](https://universal-blue.discourse.group/docs?topic=129)
**Support the app store!**~[Donate to  Flatpak](https://opencollective.com/flatpak)
**H.264 hardware acceleration is supported out of the box.** No tweaks necessary!
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Use studio add to add packages to your system easier
You can use studio reporter to report information about your system for support
You can check out what updated on your current image by running studio update changelog
It is **always** better to install packages with Distrobox rather than layer them with rpm-ostree. `studio manager` makes it easy! More info in Studio help pages!

This file was deleted.

46 changes: 10 additions & 36 deletions config/files/shared/share/ublue-os/firstboot/yafti.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,48 +30,22 @@ screens:
description: Add certain user groups and kernel arguments for your user in order to use realtime applications properly
default: false
packages:
- Add realtime group: pkexec studio pw enable realtime
- Add realtime group: studio pw enable realtime
OpenTabletDriver:
description: Setup OpenTabletDriver, a FOSS alternative to the proprietary wacom drivers
default: true
packages:
- Setup OTD: studio setup opentabletdriver
Davinci Box:
description: Reproducible and descartable environment for installing Davinci Resolve - Make sure to install Davinci Resolve inside of davincibox with the "studio davinci" command.
default: false
condition:
run: distrobox list | grep -v davincibox
- Setup OTD: studio setup install opentabletdriver
Amd LACT:
description: Setup Amd LACT for GPU overclocking
default: false
packages:
- Setup davincibox: distrobox create -i ghcr.io/zelikos/davincibox:latest -n davincibox
OBS Studio Portable:
description: Portable environment for installing OBS Studio - Use this if the pre-installed OBS flatpak does not work properly for you. (and you want some extra plugins)
default: false
condition:
run: distrobox list | grep -v obs-studio-portable
- Setup OTD: studio setup install amd-lact
GreenWithEnvy:
description: Setup GreenWithEnvy for overclocking and managing your Nvidia GPUs
default: false
packages:
- Setup obs-studio-portable: distrobox create --image ghcr.io/ublue-os/obs-studio-portable:latest --name obs-studio-portable --pull --additional-packages nvidia-driver-535
- Installing obs-portable launcher: sh -c "mkdir -p $HOME/.local/bin && echo distrobox enter --name obs -- /opt/obs-portable/obs-portable | tee $HOME/.local/bin"
amd-additions:
source: yafti.screen.package
values:
title: AMD Additions
condition:
run: grep -qv 'nvidia' <<< $(jq -r '."image-flavor"' < /usr/share/ublue-os/image-info.json)
show_terminal: true
package_manager: yafti.plugin.run
packages:
- LACT (GPU Overclocking): studio setup amd-lact
nvidia-additions:
source: yafti.screen.package
values:
title: Nvidia Additions
condition:
run: grep -q 'nvidia' <<< $(jq -r '."image-flavor"' < /usr/share/ublue-os/image-info.json)
show_terminal: true
package_manager: yafti.plugin.run
packages:
- GreenWithEnvy (GPU Overclocking): flatpak install --user --noninteractive com.leinardi.gwe
- Supergfxctl (Hybrid GPU Switching): studio setup supergfxctl
- Setup GWE: flatpak install --user --noninteractive com.leinardi.gwe
check-user-flathub:
source: yafti.screen.consent
values:
Expand Down

0 comments on commit d019837

Please sign in to comment.