Skip to content

Commit

Permalink
chore: use nix-direnv
Browse files Browse the repository at this point in the history
  • Loading branch information
litsynp committed May 11, 2024
1 parent baa72a3 commit ac26de2
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ firebase-credentials.json

## Binaries ##
bin

## Environment ##
.direnv
.envrc
27 changes: 27 additions & 0 deletions flake.lock

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

37 changes: 37 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
description = "PND backend dev environment";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

outputs = { self, nixpkgs }:
let
goVersion = 21; # 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_21

# 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
];
};
});
};
}

0 comments on commit ac26de2

Please sign in to comment.