From be039ecbd1b44db32808bd404c93c749cc07f1e8 Mon Sep 17 00:00:00 2001 From: Job79 Date: Sun, 1 Nov 2026 12:01:02 +0100 Subject: [PATCH] refactor: switch to bun --- devc.sh => bin/devc | 8 ++++---- containers/base/Containerfile | 4 +++- containers/base/config/bashrc | 2 +- containers/go/Containerfile | 7 +++---- 4 files changed, 11 insertions(+), 10 deletions(-) rename devc.sh => bin/devc (88%) diff --git a/devc.sh b/bin/devc similarity index 88% rename from devc.sh rename to bin/devc index f3b8a99..b5e2eca 100755 --- a/devc.sh +++ b/bin/devc @@ -23,10 +23,10 @@ default_args() { # Desktop integration (Wayland, SSH). [[ -e "/run/user/$UID/wayland-0" ]] && run_opts+=("-v" "/run/user/$UID/wayland-0:/run/user/1000/wayland-0") - [[ -e "${SSH_AUTH_SOCK:-}" ]] && run_opts+=("-v" "$SSH_AUTH_SOCK:/run/user/1000/ssh-auth-sock") + [[ -e "${SSH_AUTH_SOCK:-}" ]] && run_opts+=("-v" "$SSH_AUTH_SOCK:/run/user/1000/ssh-auth-sock" "-e" "SSH_AUTH_SOCK=/run/user/1000/ssh-auth-sock") # Load custom container config. - local config_file="${BASH_SOURCE[0]%/*}/containers/$name/config.sh" + local config_file="$(dirname "${BASH_SOURCE[0]}")/containers/$name/config.sh" [[ -f "$config_file" ]] && source "$config_file" || true } @@ -38,7 +38,7 @@ param_args() { -host-spawn) run_opts+=("-v" "/run/user/$UID/bus:/tmp/bus" "-e" "HOST_HOME=$HOME") ;; -container-sock) run_opts+=("-v" "$XDG_RUNTIME_DIR/podman/podman.sock:/var/run/docker.sock") ;; -x11) run_opts+=("-v" "/tmp/.X11-unix:/tmp/.X11-unix" "-v" "$XAUTHORITY:/run/user/1000/.Xauthority:ro" "-e" "DISPLAY=$DISPLAY" "-e" "XAUTHORITY=/run/user/1000/.Xauthority") ;; - -mnt) shift && run_opts+=("-w" "/mnt/" "-v" "$1:/mnt/$([[ -d "$1" ]] || echo "file")") ;; + -mnt) shift && run_opts+=("-w" "/mnt/" "-v" "$(realpath "$1"):/mnt/$([[ -d "$1" ]] || echo "file")") ;; *) run_opts+=("$1") ;; esac shift @@ -53,7 +53,7 @@ main() { if [[ $image && $image != -* ]]; then shift [[ $image != *:* ]] && image+=":main" - echo "$image" >"$state_file" + mkdir -p "${state_file%/*}" && echo "$image" >"$state_file" elif [[ -f $state_file ]]; then image=$(<$state_file) else diff --git a/containers/base/Containerfile b/containers/base/Containerfile index e9af05c..7b7130f 100644 --- a/containers/base/Containerfile +++ b/containers/base/Containerfile @@ -10,7 +10,9 @@ RUN --mount=type=cache,id=dnf-cache,target=/var/cache/libdnf5 \ RUN LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | jq -r .tag_name | sed 's/^v//') && \ curl -sL "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_linux_x86_64.tar.gz" | tar xz -C /usr/local/bin lazygit && \ curl -sL "https://github.com/jorgerojas26/lazysql/releases/latest/download/lazysql_Linux_x86_64.tar.gz" | tar xz -C /usr/local/bin lazysql && \ - curl -sL "https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz" | tar xz -C /usr/local --strip-components=1 + curl -sL "https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz" | tar xz -C /usr/local --strip-components=1 && \ + curl -fsSL https://bun.sh/install | BUN_INSTALL="/usr/local" bash && \ + bun install -g pi COPY ./bin /usr/local/bin diff --git a/containers/base/config/bashrc b/containers/base/config/bashrc index f51d9bd..18e74db 100644 --- a/containers/base/config/bashrc +++ b/containers/base/config/bashrc @@ -11,6 +11,6 @@ export PS1="\[\e[30;46m\] \h | \w \[\e[0;36m\]\[\e[m\] " \ # === aliases and functions === alias vi=nvim post() { curl -sF "content=<-" "https://paste.plabble.org/$2?lang=$1" && echo; } -genpass() { tr -dc "${2:-A-Za-z0-9!@#$%^&*}" < /dev/urandom | head -c "${1:-16}"; echo; } +random() { tr -dc "${2:-A-Za-z0-9!@#$%^&*}" < /dev/urandom | head -c "${1:-32}"; echo; } eval "$(fzf --bash)" diff --git a/containers/go/Containerfile b/containers/go/Containerfile index 8e564b0..bd1922b 100644 --- a/containers/go/Containerfile +++ b/containers/go/Containerfile @@ -9,9 +9,8 @@ RUN GO_VERSION=$(curl -sL "https://go.dev/VERSION?m=text" | head -n 1 | tr -d '\ GOBIN=/usr/local/bin /usr/local/go/bin/go install golang.org/x/tools/gopls@latest && \ GOBIN=/usr/local/bin /usr/local/go/bin/go install mvdan.cc/gofumpt@latest && \ GOBIN=/usr/local/bin /usr/local/go/bin/go install golang.org/x/tools/cmd/goimports@latest && \ - GOBIN=/usr/local/bin /usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest - -RUN dnf -y --setopt=keepcache=1 --setopt=install_weak_deps=False install nodejs npm && \ - npm install -g typescript typescript-language-server @tailwindcss/language-server svelte-language-server @biomejs/biome + GOBIN=/usr/local/bin /usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest && \ + ln -sf /usr/local/bin/bun /usr/local/bin/node && \ + bun install -g typescript typescript-language-server @tailwindcss/language-server svelte-language-server @biomejs/biome USER user