diff --git a/Makefile b/Makefile index 425e1e26..2f07a497 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,12 @@ format\:install: # gofumpt # https://github.com/mvdan/gofumpt go install mvdan.cc/gofumpt@latest + # golines + # https://github.,com/segmentio/golines + go install github.com/segmentio/golines@latest format: gofumpt -l -w . + golines -w . lint\:install: # golangci-lint @@ -52,9 +56,12 @@ clean: rm -rf ${BUILD_DIR} make docs:clean +compile: + go build -o ${BUILD_DIR}/${SERVER_BINARY_NAME} ./cmd/server + build: make docs - go build -o ${BUILD_DIR}/${SERVER_BINARY_NAME} ./cmd/server + make compile run: go run ./cmd/server diff --git a/flake.nix b/flake.nix index d50e3e6f..e54f89a0 100644 --- a/flake.nix +++ b/flake.nix @@ -3,41 +3,47 @@ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - outputs = { self, nixpkgs }: - let - goVersion = 22; # Change this to update the whole stack - overlays = [ (final: prev: { go = prev."go_1_${toString goVersion}"; }) ]; - supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { inherit overlays system; }; - }); - in - { - devShells = forEachSupportedSystem ({ pkgs }: { - default = pkgs.mkShell { - packages = with pkgs; [ - # go (specified by overlay) - go_1_22 - - # goimports, godoc, etc. - gotools - - # https://github.com/mvdan/gofumpt - gofumpt - - # https://github.com/golangci/golangci-lint - golangci-lint - - # https://github.com/golang-migrate/migrate - go-migrate - - # https://github.com/swaggo/swag - go-swag - - # https://github.com/sqlc-dev/sqlc - sqlc - ]; - }; - }); - }; + outputs = { + self, + nixpkgs, + }: let + goVersion = 22; # Change this to update the whole stack + overlays = [(final: prev: {go = prev."go_1_${toString goVersion}";})]; + supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + forEachSupportedSystem = f: + nixpkgs.lib.genAttrs supportedSystems (system: + f { + pkgs = import nixpkgs {inherit overlays system;}; + }); + in { + devShells = forEachSupportedSystem ({pkgs}: { + default = pkgs.mkShell { + packages = with pkgs; [ + # go (specified by overlay) + go_1_22 + + # goimports, godoc, etc. + gotools + + # https://github.com/mvdan/gofumpt + gofumpt + + # https://github.com/segmentio/golines + golines + + # https://github.com/golangci/golangci-lint + golangci-lint + + # https://github.com/golang-migrate/migrate + go-migrate + + # https://github.com/swaggo/swag + go-swag + + # https://github.com/sqlc-dev/sqlc + sqlc + ]; + }; + }); + }; }