Skip to content

Instantly share code, notes, and snippets.

@netlooker
Last active April 27, 2024 08:54
Show Gist options
  • Save netlooker/2c1981872337d97fbded302d850d21b0 to your computer and use it in GitHub Desktop.
Save netlooker/2c1981872337d97fbded302d850d21b0 to your computer and use it in GitHub Desktop.
Flake for go development
{
description = "A Nix flake for Go and Templ projects with npm packages";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, systems, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [];
};
in {
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.templ
pkgs.go
pkgs.golangci-lint
pkgs.gopls
pkgs.gotools
pkgs.go-tools
pkgs.tailwindcss
pkgs.nodejs
pkgs.nodePackages.node2nix
];
shellHook = ''
if [ ! -d "node_modules" ]; then
echo "Installing npm packages..."
npm install daisyui
fi
'';
};
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment