Skip to content

Commit

Permalink
Merge pull request #51 from planetary-social/flake-dev
Browse files Browse the repository at this point in the history
Add nix flake for local development
  • Loading branch information
cooldracula authored Jan 10, 2024
2 parents 9483406 + b737a3c commit 68ab31b
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.p12
# don't commit firestore certs (which usually follow this pattern)
nos-notification-service-*.json
.direnv
130 changes: 130 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
description = "Flake for developing on nos-notification-service";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
devshell.url = "github:numtide/devshell";
};

outputs = { self, nixpkgs, flake-utils, devshell }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs {
inherit system;
overlays = [
devshell.overlays.default
];
};
in
{
devShells.default =
pkgs.devshell.mkShell {
name = "nos-notification-service";
packages = with pkgs; [
go
gopls
golangci-lint
gotools
go-tools
gosimports
];
commands = [
{
name = ''start'';
help = ''alias for `go run cmd/notification-service/main.go`'';
category = ''dev helpers'';
command = ''
go run cmd/notification-service/main.go
'';
}
{
name = ''lint'';
help = ''check style and formatting'';
category = ''dev helpers'';
command = ''
go vet ./...
golangci-lint run ./...
'';
}

];
};
});
}
3 changes: 3 additions & 0 deletions service/ports/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func (s *Server) createMux(ctx context.Context) *http.ServeMux {
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
s.serveWs(ctx, w, r)
})
mux.HandleFunc("/_health", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "ok\n")
})
return mux
}

Expand Down

0 comments on commit 68ab31b

Please sign in to comment.