Compare commits
13
Commits
a7dfb72557
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99422bc415 | ||
|
|
596b5873e6 | ||
|
|
90e2952211 | ||
|
|
ae773438a3 | ||
|
|
ca68c85c72 | ||
|
|
72c90d699e | ||
|
|
492cb7efb2 | ||
|
|
d8cb355284 | ||
|
|
de0d7c44fd | ||
|
|
6a8e824941 | ||
|
|
07b3bfefad | ||
|
|
083f8dd16c | ||
|
|
09437f0c08 |
+2
-2
@@ -1,5 +1,5 @@
|
||||
README.md
|
||||
|
||||
# ignore the cosmic templates for now
|
||||
cosmic-theme-dark.ron.tmpl
|
||||
cosmic-theme-light.ron.tmpl
|
||||
cosmic-theme-dark.ron
|
||||
cosmic-theme-light.ron
|
||||
|
||||
@@ -17,6 +17,9 @@ set -gx SSH_AUTH_SOCK /home/user/.var/app/com.bitwarden.desktop/data/.bitwarden-
|
||||
|
||||
# alias
|
||||
alias vi='vim'
|
||||
alias zed='flatpak run dev.zed.Zed'
|
||||
alias bw='flatpak run --command=bw com.bitwarden.desktop'
|
||||
alias config="zed ~/.local/share/chezmoi/"
|
||||
|
||||
# zoxide init
|
||||
zoxide init fish | source
|
||||
@@ -25,4 +28,6 @@ zoxide init fish | source
|
||||
starship init fish | source
|
||||
|
||||
# proper home dir for atomic desktop
|
||||
cd ~
|
||||
if test "$PWD" = "/var/home/$USER"
|
||||
cd "$HOME"
|
||||
end
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
function dev-remove
|
||||
distrobox rm --force dev
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
function dev
|
||||
set -l name dev
|
||||
set -l image fedora:44
|
||||
|
||||
set -l packages \
|
||||
git \
|
||||
gcc \
|
||||
gcc-c++ \
|
||||
make \
|
||||
pkg-config \
|
||||
openssl-devel \
|
||||
clang \
|
||||
llvm \
|
||||
cmake \
|
||||
lld \
|
||||
gdb \
|
||||
strace \
|
||||
curl \
|
||||
which \
|
||||
file \
|
||||
jq \
|
||||
zoxide \
|
||||
fzf \
|
||||
eza \
|
||||
ripgrep \
|
||||
du-dust \
|
||||
tldr \
|
||||
cheat \
|
||||
pv \
|
||||
age \
|
||||
libcxx-devel \
|
||||
ninja-build \
|
||||
unzip \
|
||||
libX11-devel \
|
||||
libXcursor-devel \
|
||||
libXi-devel \
|
||||
libXrandr-devel \
|
||||
mesa-libGL-devel \
|
||||
fontconfig-devel \
|
||||
alsa-lib-devel \
|
||||
systemd-devel \
|
||||
libxkbcommon \
|
||||
libxkbcommon-devel \
|
||||
libappindicator-gtk3-devel \
|
||||
librsvg2-devel \
|
||||
libxdo-devel \
|
||||
nodejs24
|
||||
|
||||
if distrobox list --no-color | string match -q "*| $name *"
|
||||
distrobox enter $name
|
||||
return
|
||||
end
|
||||
|
||||
echo "Creating Distrobox container '$name'..."
|
||||
|
||||
distrobox create \
|
||||
--name $name \
|
||||
--image $image --yes \
|
||||
--additional-packages (string join ' ' $packages) \
|
||||
--init-hooks 'bash "$HOME/.scripts/distrobox-dev-init.sh"'
|
||||
|
||||
if test $status -ne 0
|
||||
echo "Failed to create container '$name'." >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
distrobox enter $name --verbose
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
[user]
|
||||
name = fe5hua
|
||||
email = git@fe5hua.de
|
||||
[init]
|
||||
defaultBranch = main
|
||||
@@ -0,0 +1,205 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "Initializing development environment..."
|
||||
|
||||
export DEV_HOME="$HOME"
|
||||
export DEV_USER="$(basename "$DEV_HOME")"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Software directories
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
mkdir -p /opt/rustup /opt/cargo /opt/aseprite /opt/dx /opt/npm-global
|
||||
chown -R "$DEV_USER:$DEV_USER" /opt/rustup /opt/cargo /opt/aseprite /opt/dx /opt/npm-global
|
||||
# TODO basically all commamd from here on need to run as $DEV_USER, but scrpt runs as root
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Fish configuration
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
mkdir -p /etc/fish/conf.d
|
||||
mkdir -p /etc/fish/completions
|
||||
|
||||
tee /etc/fish/conf.d/rust.fish >/dev/null <<'EOF'
|
||||
set -gx RUSTUP_HOME /opt/rustup
|
||||
set -gx CARGO_HOME /opt/cargo
|
||||
fish_add_path $CARGO_HOME/bin
|
||||
EOF
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Rustup
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
export RUSTUP_HOME=/opt/rustup
|
||||
export CARGO_HOME=/opt/cargo
|
||||
|
||||
if [[ ! -x /opt/cargo/bin/rustup ]]; then
|
||||
echo "Installing rustup..."
|
||||
|
||||
curl \
|
||||
--proto '=https' \
|
||||
--tlsv1.2 \
|
||||
-sSf \
|
||||
https://sh.rustup.rs \
|
||||
| sh -s -- -y --no-modify-path
|
||||
else
|
||||
echo "rustup is already installed."
|
||||
fi
|
||||
|
||||
# Rust toolchain
|
||||
echo "Installing stable Rust toolchain..."
|
||||
|
||||
/opt/cargo/bin/rustup default nightly
|
||||
|
||||
# Fish completions
|
||||
echo "Installing rustup Fish completion..."
|
||||
|
||||
/opt/cargo/bin/rustup completions fish \
|
||||
| tee /etc/fish/completions/rustup.fish >/dev/null
|
||||
|
||||
|
||||
# Dioxus CLI
|
||||
export DX_INSTALL=/opt/dx
|
||||
|
||||
if [[ ! -x /opt/cargo/bin/dx ]]; then
|
||||
echo "Installing dioxus cli..."
|
||||
|
||||
# TODO needs to run as user, not root
|
||||
curl -sSL https://dioxus.dev/install.sh | bash
|
||||
else
|
||||
echo "dioxus cli is already installed."
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# NodeJS and NPM
|
||||
# -----------------------------------------------------------------------------
|
||||
npm config set prefix '/opt/npm-global'
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Aseprite
|
||||
# -----------------------------------------------------------------------------
|
||||
if [[ -f /opt/aseprite/aseprite.desktop ]]; then
|
||||
echo "Aseprite desktop entry already exists; skipping installation."
|
||||
else
|
||||
if [[ ! -d /opt/aseprite ]]; then
|
||||
echo "Cloning Aseprite..."
|
||||
git clone --recursive https://github.com/aseprite/aseprite.git /opt/aseprite
|
||||
else
|
||||
echo "Aseprite source already exists."
|
||||
fi
|
||||
|
||||
cd /opt/aseprite
|
||||
if [[ ! -x /opt/aseprite/build/bin/aseprite ]]; then
|
||||
git submodule update --init --recursive
|
||||
echo "Building Aseprite..."
|
||||
./build.sh --auto --norun
|
||||
else
|
||||
echo "Aseprite is already built."
|
||||
fi
|
||||
|
||||
echo "Creating Aseprite desktop entry..."
|
||||
cat > /opt/aseprite/aseprite.desktop <<'EOF'
|
||||
[Desktop Entry]
|
||||
Name=Aseprite
|
||||
Comment=Animated sprite editor
|
||||
Exec=/opt/aseprite/build/bin/aseprite %F
|
||||
Icon=/opt/aseprite/build/bin/data/icons/ase.ico
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Graphics;2DGraphics;
|
||||
EOF
|
||||
fi
|
||||
|
||||
if sudo -u "$DEV_USER" env HOME="$DEV_HOME" distrobox-export --list-apps 2>/dev/null |
|
||||
grep -Fq "aseprite"
|
||||
then
|
||||
echo "Aseprite desktop entry is already exported."
|
||||
else
|
||||
echo "Exporting Aseprite desktop entry..."
|
||||
sudo -u "$DEV_USER" env HOME="$DEV_HOME" distrobox-export --app /opt/aseprite/aseprite.desktop
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Export development tools to the host
|
||||
# -----------------------------------------------------------------------------
|
||||
export PATH="/opt/cargo/bin:$PATH"
|
||||
echo "Exporting development tools..."
|
||||
|
||||
export_bin() {
|
||||
local binary="$1"
|
||||
|
||||
if ! command -v "$binary" >/dev/null 2>&1; then
|
||||
echo " warning: $binary not found"
|
||||
elif sudo -u "$DEV_USER" env HOME="$DEV_HOME" \
|
||||
distrobox-export \
|
||||
--list-binaries \
|
||||
--export-path "$DEV_HOME/.local/bin" 2>/dev/null |
|
||||
awk -F'|' -v binary="$binary" '
|
||||
{
|
||||
name = $1
|
||||
gsub(/^[[:space:]]+|[[:space:]]+$/, "", name)
|
||||
if (name == binary) {
|
||||
found = 1
|
||||
}
|
||||
}
|
||||
END { exit !found }
|
||||
'
|
||||
then
|
||||
echo " $binary is already exported."
|
||||
else
|
||||
echo " exporting $binary"
|
||||
sudo -u "$DEV_USER" \
|
||||
env HOME="$DEV_HOME" \
|
||||
distrobox-export \
|
||||
--bin "$(command -v "$binary")" \
|
||||
--export-path "$DEV_HOME/.local/bin"
|
||||
fi
|
||||
}
|
||||
|
||||
# Rust
|
||||
for binary in \
|
||||
cargo \
|
||||
cargo-clippy \
|
||||
cargo-fmt \
|
||||
cargo-miri \
|
||||
clippy-driver \
|
||||
rls \
|
||||
rust-analyzer \
|
||||
rustc \
|
||||
rustdoc \
|
||||
rustfmt \
|
||||
rust-gdb \
|
||||
rust-gdbgui \
|
||||
rust-lldb \
|
||||
rustup \
|
||||
dx \
|
||||
npm \
|
||||
node
|
||||
do
|
||||
export_bin "$binary"
|
||||
done
|
||||
|
||||
# Native toolchain
|
||||
export_bin clang
|
||||
export_bin clang++
|
||||
export_bin cmake
|
||||
export_bin pkg-config
|
||||
export_bin ninja
|
||||
export_bin lld
|
||||
export_bin ld.lld
|
||||
export_bin gdb
|
||||
export_bin strace
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Done
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
echo
|
||||
echo "Development environment initialized successfully."
|
||||
echo
|
||||
echo "Rust:"
|
||||
/opt/cargo/bin/rustc --version
|
||||
/opt/cargo/bin/cargo --version
|
||||
/opt/cargo/bin/rustup --version
|
||||
Reference in New Issue
Block a user