Skip to content

Commit 4ba4a8d

Browse files
committed
feat: add arch-node-dev.sh
1 parent a899eb9 commit 4ba4a8d

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

arch/arch-node-dev.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
## Works with non-root user installation
6+
7+
## Whats this?
8+
## Script to install an opinionated dev environment, check out: gh:namesmt/linux-stuff
9+
10+
# Update package database, keychain, and trust database
11+
sudo pacman -Sy archlinux-keyring --noconfirm
12+
sudo pacman-key --init --noconfirm
13+
14+
# Install basic packages
15+
sudo pacman -S --noconfirm \
16+
zip unzip jq sudo git less zsh curl wget
17+
18+
# Configures zsh
19+
sh -c "$(wget -qO- https://github.com/deluan/zsh-in-docker/releases/latest/download/zsh-in-docker.sh)" -- \
20+
-x \
21+
-t https://github.com/spaceship-prompt/spaceship-prompt \
22+
-a 'SPACESHIP_USER_SHOW=false' \
23+
-a 'SPACESHIP_DIR_TRUNC_REPO=false' \
24+
-p command-not-found \
25+
-p git \
26+
-p history-substring-search \
27+
-p z \
28+
-p https://github.com/zsh-users/zsh-autosuggestions \
29+
-p https://github.com/zsh-users/zsh-completions \
30+
-p https://github.com/zsh-users/zsh-syntax-highlighting
31+
32+
# set zsh as default shell
33+
sudo sed -i 's/\/bin\/bash/\/bin\/zsh/g' /etc/passwd
34+
zsh
35+
export SHELL=/bin/zsh
36+
37+
# Install fnm and install lts node using fnm
38+
wget https://fnm.vercel.app/install -O- | sh
39+
source ~/.zshrc
40+
fnm install --lts
41+
42+
# Setup the environment path for pnpm
43+
touch /etc/profile.d/pnpmPath.sh && \
44+
echo 'export PNPM_HOME=/root/.local/share/pnpm' >> /etc/profile.d/pnpmPath.sh && \
45+
echo 'export PATH=$PNPM_HOME:$PATH' >> /etc/profile.d/pnpmPath.sh && \
46+
source /etc/profile.d/pnpmPath.sh
47+
48+
# Install pnpm and ni
49+
npm install --global corepack@latest
50+
corepack enable
51+
corepack prepare pnpm --activate
52+
pnpm i -g @antfu/ni && \
53+
touch ~/.nirc && \
54+
echo 'defaultAgent=pnpm' >> ~/.nirc && \
55+
echo 'globalAgent=pnpm' >> ~/.nirc
56+
57+
# Adding a simple command to change git remote connection from/to ssh/https
58+
touch /etc/profile.d/gitRemoteChanger.sh && \
59+
echo alias git-ssh=\'git remote set-url origin \"\$\(git remote get-url origin \| sed -E \'\\\'\'s,\^https://\(\[\^/\]\*\)/\(.\*\)\$,git@\\1:\\2,\'\\\'\'\)\"\' >> /etc/profile.d/gitRemoteChanger.sh && \
60+
echo alias git-https=\'git remote set-url origin \"\$\(git remote get-url origin \| sed -E \'\\\'\'s,\^git@\(\[\^:\]\*\):/\*\(.\*\)\$,https://\\1/\\2,\'\\\'\'\)\"\' >> /etc/profile.d/gitRemoteChanger.sh && \
61+
source /etc/profile.d/gitRemoteChanger.sh

0 commit comments

Comments
 (0)