|
| 1 | +{ |
| 2 | + description = "Nix build environment for TypeScript projects"; |
| 3 | + |
| 4 | + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |
| 5 | + |
| 6 | + outputs = inputs: let |
| 7 | + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; |
| 8 | + forEachSupportedSystem = f: |
| 9 | + inputs.nixpkgs.lib.genAttrs supportedSystems (system: |
| 10 | + f { |
| 11 | + pkgs = import inputs.nixpkgs { |
| 12 | + inherit system; |
| 13 | + config.allowUnfree = true; |
| 14 | + }; |
| 15 | + }); |
| 16 | + in { |
| 17 | + devShells = forEachSupportedSystem ({pkgs}: { |
| 18 | + default = pkgs.mkShell { |
| 19 | + packages = with pkgs; [ |
| 20 | + # Development Tools |
| 21 | + corepack |
| 22 | + docker |
| 23 | + git |
| 24 | + git-lfs |
| 25 | + lazygit |
| 26 | + lazydocker |
| 27 | + nodejs |
| 28 | + |
| 29 | + # Code Editors |
| 30 | + neovim |
| 31 | + vscode |
| 32 | + |
| 33 | + # Shell Tools |
| 34 | + act |
| 35 | + atuin |
| 36 | + bat |
| 37 | + cargo |
| 38 | + curl |
| 39 | + eza |
| 40 | + fzf |
| 41 | + gawk |
| 42 | + hyperfine |
| 43 | + jq |
| 44 | + mkcert |
| 45 | + openssh |
| 46 | + openvpn |
| 47 | + tealdeer |
| 48 | + wget |
| 49 | + zq |
| 50 | + |
| 51 | + # Shell Dependencies |
| 52 | + alejandra |
| 53 | + direnv |
| 54 | + gum |
| 55 | + macchina |
| 56 | + which |
| 57 | + ]; |
| 58 | + shellHook = '' |
| 59 | + macchina |
| 60 | +
|
| 61 | + echo "Setting up environment variables..." |
| 62 | + export EDITOR=$(which nvim) |
| 63 | + export VISUAL=$(which code) |
| 64 | +
|
| 65 | + echo "Setting up shell aliases..." |
| 66 | + alias ..="cd .." |
| 67 | + alias cat=bat |
| 68 | + alias ls="eza -lh --group-directories-first --icons=auto" |
| 69 | + alias ll="ls -la" |
| 70 | + alias vim=nvim |
| 71 | +
|
| 72 | + if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then |
| 73 | + echo "Setting up Git..." |
| 74 | + git config alias.co checkout |
| 75 | + git config alias.br branch |
| 76 | + git config alias.ci commit |
| 77 | + git config alias.st status |
| 78 | + git config alias.amend "commit --amend -m" |
| 79 | + git config alias.unstage "restore --staged" |
| 80 | + git config help.autocorrect 50 |
| 81 | + else |
| 82 | + gum log -sl warn "Not inside a Git repository, skipping config setup" |
| 83 | + fi |
| 84 | +
|
| 85 | + if [ -f "package.json" ]; then |
| 86 | + corepack install |
| 87 | + pnpm install --frozen-lockfile |
| 88 | +
|
| 89 | + echo -e "\nCurrent Project: $(jq -r '.name' package.json)" |
| 90 | + else |
| 91 | + gum log -sl warn "No package.json found, skipping installation step" |
| 92 | + fi |
| 93 | + ''; |
| 94 | + }; |
| 95 | + }); |
| 96 | + }; |
| 97 | +} |
0 commit comments