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

Commit

Permalink
feat(nu-script): move everything to nushell
Browse files Browse the repository at this point in the history
  • Loading branch information
tulilirockz committed Mar 6, 2024
1 parent eb73e1a commit 203c1a8
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 75 deletions.
14 changes: 14 additions & 0 deletions config/scripts/extra-packages.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env -S nu

use lib/std.nu [ARCH]

const BREW_TARGET = "/usr/libexec/brew-install"

http get "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh" | save -f "$BREW_TARGET"
run-external chmod '+x' "$BREW_TARGET"

let GUM_LATEST = (http get https://api.github.com/repos/charmbracelet/gum/releases/latest | get assets | where {|e| $e.name | str ends-with $"($ARCH).rpm" } | get browser_download_url)

http get $GUM_LATEST | save -f /tmp/gum.rpm
run-external rpm-ostree install /tmp/gum.rpm
rm /tmp/gum.rpm
9 changes: 0 additions & 9 deletions config/scripts/extra-packages.sh

This file was deleted.

11 changes: 11 additions & 0 deletions config/scripts/gnome-vrr.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env -S nu

use lib/std.nu [FEDORA_MAJOR_VERSION]

const REPO_PATH = "/etc/yum.repos.d/_copr_kylegospo-gnome-vrr.repo"

http get $"https://copr.fedorainfracloud.org/coprs/kylegospo/gnome-vrr/repo/fedora-($FEDORA_MAJOR_VERSION)/kylegospo-gnome-vrr-fedora-($FEDORA_MAJOR_VERSION).repo" | save -f $REPO_PATH

run-external rpm-ostree override replace '--experimental' '--from' repo=copr:copr.fedorainfracloud.org:kylegospo:gnome-vrr mutter mutter-common gnome-control-center gnome-control-center-filesystem

rm -f $REPO_PATH
12 changes: 0 additions & 12 deletions config/scripts/gnome-vrr.sh

This file was deleted.

2 changes: 2 additions & 0 deletions config/scripts/lib/std.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export let FEDORA_MAJOR_VERSION = (run-external --redirect-combine rpm '-E' '%fedora' | complete).stdout
export const ARCH = "x86_64"
19 changes: 19 additions & 0 deletions config/scripts/nvidia-explicit-sync.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

use lib/std.nu [FEDORA_MAJOR_VERSION, ARCH]

const COPR_FILE = "/etc/yum.repos.d/_copr_gloriouseggroll-nvidia-explicit-sync.repo"

http get $"https://copr.fedorainfracloud.org/coprs/gloriouseggroll/nvidia-explicit-sync/repo/fedora-($FEDORA_MAJOR_VERSION)/gloriouseggroll-nvidia-explicit-sync-fedora-($FEDORA_MAJOR_VERSION).repo?arch=($ARCH)" | save -f $COPR_FILE

rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:gloriouseggroll:nvidia-explicit-sync \
xorg-x11-server-Xwayland

rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:gloriouseggroll:nvidia-explicit-sync \
egl-wayland

rm $COPR_FILE
18 changes: 0 additions & 18 deletions config/scripts/nvidia-explicit-sync.sh

This file was deleted.

16 changes: 16 additions & 0 deletions config/scripts/ptyxis.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env -S nu

use lib/std.nu [FEDORA_MAJOR_VERSION, ARCH]

const COPR_FILE = "/etc/yum.repos.d/_copr_kylegospo-prompt.repo"

http get "https://copr.fedorainfracloud.org/coprs/kylegospo/prompt/repo/fedora-($FEDORA_MAJOR_VERSION)/kylegospo-prompt-fedora-($FEDORA_MAJOR_VERSION).repo?arch=($ARCH)" | save -f $COPR_FILE

rpm-ostree override replace --experimental --from repo=copr:copr.fedorainfracloud.org:kylegospo:prompt \
vte291 \
vte-profile \
libadwaita

rpm-ostree install ptyxis

rm -f $COPR_FILE
17 changes: 0 additions & 17 deletions config/scripts/ptyxis.sh

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion config/scripts/tuned.sh → config/scripts/tuned.nu
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env -S nu
rpm-ostree override remove power-profiles-daemon || true
rpm-ostree override remove tlp tlp-rdw || true

Expand Down
11 changes: 11 additions & 0 deletions config/scripts/zluda.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env -S nu

let ZLUDA_LATEST = (http get https://api.github.com/repos/vosen/ZLUDA/releases/latest | get assets | where {|e| $e.name | str ends-with $"-linux.tar.gz" } | get browser_download_url).0

http get $ZLUDA_LATEST | save -f /tmp/zluda.tar.gz

mkdir -p /tmp/zluda
tar --strip-components 1 -xvzf /tmp/zluda.tar.gz -C /tmp/zluda
mv /tmp/zluda /usr/lib64/zluda

rm -f /tmp/zluda.tar.gz
9 changes: 0 additions & 9 deletions config/scripts/zluda.sh

This file was deleted.

8 changes: 8 additions & 0 deletions modules/script-nu/nushell-launcher.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env -S nu
def "main" [
yaml_file: string
] {
($yaml_file | from yaml).scripts | each {
| script | { run-external $script | complete }
}
}
11 changes: 2 additions & 9 deletions modules/script-nu/script-nu.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#!/usr/bin/env -S nu
#!/usr/bin/env bash

def "main" [
yaml_file: string
] {
chmod +x "/tmp/config/scripts/*"
($yaml_file | from yaml).scripts | each {
| script | { run-external $script }
}
}
NU_LOG_LEVEL=DEBUG nu --stdin -c ./nushell-launcher.nu "$@"

0 comments on commit 203c1a8

Please sign in to comment.