Last active
October 25, 2024 12:13
-
-
Save idleberg/15333cf8cac9bd3a1e05ddd6de2310c0 to your computer and use it in GitHub Desktop.
My Nix Shell configuration for NodeJS development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
pkgs ? import <nixpkgs> { | |
config = { | |
allowUnfree = true; | |
}; | |
}, | |
}: | |
pkgs.mkShell { | |
packages = with pkgs; [ | |
# Core Tools | |
corepack_20 | |
curl | |
deno | |
docker | |
docker-compose | |
git | |
git-lfs | |
mkcert | |
nodejs | |
openssh | |
# Code Editors | |
neovim | |
vscodium | |
# Convenience Tools | |
bat | |
cargo | |
direnv | |
eza | |
fzf | |
gawk | |
hyperfine | |
jq | |
lazygit | |
openvpn | |
tealdeer | |
wget | |
zq | |
# shell.nix Dependencies | |
macchina | |
which | |
]; | |
shellHook = '' | |
macchina | |
echo "Setting up environment variables..." | |
export EDITOR=$(which nvim) | |
export VISUAL=$(which codium) | |
echo "Setting up shell aliases..." | |
alias cat=bat | |
alias code=codium | |
alias k='$VISUAL $(fzf --multi --preview="bat --color=always {}")' | |
alias ll="ls -la" | |
alias ls=eza | |
alias vim=nvim | |
if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then | |
echo "Setting up Git aliases..." | |
git config alias.co checkout | |
git config alias.br branch | |
git config alias.ci commit | |
git config alias.st status | |
git config alias.amend "commit --amend -m" | |
git config alias.unstage "restore --staged" | |
git config help.autocorrect 50 | |
else | |
echo "Not a Git repository." | |
fi | |
if [ -f package.json ]; then | |
corepack install | |
pnpm install --frozen-lockfile | |
echo -e "\nCurrent Project: $(jq -r '.name' package.json)\n" | |
pnpm run | |
else | |
echo "Not a NodeJS package." | |
fi | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some notes:
bun
package doesn't work yet