A minimal Go project template with Nix devShell and direnv integration, featuring automated initialization.
- 🚀 Go 1.25.1 ready
- ❄️ Nix flakes for reproducible development environment
- 🔧 direnv for automatic environment loading
- 📦 Pre-configured with essential Go tools (gopls, gotools, goreleaser)
- 🤖 Automated initialization script for quick project setup
- Nix with flakes enabled
- direnv
- GitHub CLI (
gh) for automated repository creation
Add to ~/.config/nix/nix.conf (or /etc/nix/nix.conf):
experimental-features = nix-command flakesClick the "Use this template" button on GitHub or clone this repository:
git clone {yourRepoUrl}
cd {yourProjectName}
bash scripts/init.sh {yourModuleName}go list.
├── .envrc # direnv configuration
├── .gitignore # Git ignore rules
├── flake.nix # Nix flake for development environment
├── flake.lock # Locked dependencies
├── go.mod # Go module file
├── go.sum # Go dependencies checksums
├── main.go # Main application file
└── pkgs/ # Additional packages directory
The Nix development shell includes:
go- Go compiler and toolchaingopls- Go language servergotools- Additional Go toolsgoreleaser- Release automation tool
go build -o bin/app .go run main.gogo test ./...The development environment sets:
GOROOT- Points to the Nix-managed Go installationGOPATH- Set to.goin the project directoryGOBIN- Set to.go/binfor installed binariesPATH- Updated to include$GOPATH/bin
Edit flake.nix to add or remove packages in the buildInputs section:
buildInputs = with pkgs; [
go
gopls
gotools
goreleaser
# Add more packages here
];This template is ready for GitHub Actions or other CI/CD pipelines. The Nix flake ensures consistent builds across different environments.
Specify your license here.