Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
113 lines
3.3 KiB
Nix
113 lines
3.3 KiB
Nix
{
|
|
description = "Development environment for Go and Next.js (TypeScript)";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config = {
|
|
allowUnfree = true;
|
|
};
|
|
};
|
|
|
|
# Go development tools
|
|
goPackages = with pkgs; [
|
|
go
|
|
gopls
|
|
golangci-lint
|
|
delve
|
|
go-outline
|
|
gotools
|
|
go-mockgen
|
|
gomodifytags
|
|
impl
|
|
gotests
|
|
];
|
|
|
|
# TypeScript/Next.js development tools
|
|
nodePackages = with pkgs; [
|
|
nodejs_20
|
|
nodePackages.typescript
|
|
nodePackages.typescript-language-server
|
|
nodePackages.yarn
|
|
nodePackages.pnpm
|
|
nodePackages.npm
|
|
nodePackages.prettier
|
|
nodePackages.eslint
|
|
nodePackages.next
|
|
];
|
|
|
|
# General development tools
|
|
commonPackages = with pkgs; [
|
|
git
|
|
gh
|
|
nixpkgs-fmt
|
|
pre-commit
|
|
ripgrep
|
|
jq
|
|
curl
|
|
coreutils
|
|
gnumake
|
|
];
|
|
|
|
# VSCode with extensions
|
|
vscodeWithExtensions = pkgs.vscode-with-extensions.override {
|
|
vscodeExtensions = with pkgs.vscode-extensions; [
|
|
golang.go # Go support
|
|
esbenp.prettier-vscode # Prettier
|
|
dbaeumer.vscode-eslint # ESLint
|
|
ms-vscode.vscode-typescript-tslint-plugin # TypeScript
|
|
bradlc.vscode-tailwindcss # Tailwind CSS support
|
|
jnoortheen.nix-ide # Nix support
|
|
] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
|
{
|
|
name = "nextjs";
|
|
publisher = "pulkitgangwar";
|
|
version = "1.0.6";
|
|
sha256 = "sha256-L6ZgqNkM0qzSiTKiGfgQB9m3U0HmwLA3NZ9nrslQjeg=";
|
|
}
|
|
];
|
|
};
|
|
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = goPackages ++ nodePackages ++ commonPackages ++ [ vscodeWithExtensions ];
|
|
|
|
shellHook = ''
|
|
echo "🚀 Welcome to the Go and Next.js (TypeScript) development environment!"
|
|
echo "📦 Available tools:"
|
|
echo " Go: $(go version)"
|
|
echo " Node: $(node --version)"
|
|
echo " TypeScript: $(tsc --version)"
|
|
echo " Next.js: $(npx next --version)"
|
|
echo ""
|
|
echo "🔧 Use 'code .' to open VSCode with the appropriate extensions"
|
|
echo "🔄 Run 'nix flake update' to update dependencies"
|
|
'';
|
|
|
|
# Environment variables
|
|
GOROOT = "${pkgs.go}/share/go";
|
|
GOPATH = "$(pwd)/.go";
|
|
GO111MODULE = "on";
|
|
|
|
# NodeJS setup
|
|
NODE_OPTIONS = "--max-old-space-size=4096";
|
|
};
|
|
|
|
# Optional: Add custom packages if needed
|
|
packages = {
|
|
# Example of a custom package or script if needed
|
|
# my-tool = ...
|
|
};
|
|
|
|
# Default package if someone runs `nix build`
|
|
defaultPackage = self.devShells.${system}.default;
|
|
});
|
|
} |