Skip to content

Instantly share code, notes, and snippets.

@idleberg
Last active October 25, 2024 12:13
Show Gist options
  • Save idleberg/15333cf8cac9bd3a1e05ddd6de2310c0 to your computer and use it in GitHub Desktop.
Save idleberg/15333cf8cac9bd3a1e05ddd6de2310c0 to your computer and use it in GitHub Desktop.
My Nix Shell configuration for NodeJS development
{
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
'';
}
@idleberg
Copy link
Author

idleberg commented Jun 1, 2024

Some notes:

  • the bun package doesn't work yet
  • Turbopack isn't working either due to some missing TLS-related dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment