dev-templates/go/flake.nix
2022-10-12 16:42:34 -05:00

40 lines
849 B
Nix

{
description = "A Nix-flake-based Go 1.17 development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs =
{ self
, flake-utils
, nixpkgs
}:
flake-utils.lib.eachDefaultSystem (system:
let
goVersion = 19;
overlays = [ (self: super: { go = super."go_1_${toString goVersion}"; }) ];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShells.default = pkgs.mkShellNoCC {
buildInputs = with pkgs; [
# go 1.19 (specified by overlay)
go
# goimports, godoc, etc.
gotools
# https://github.com/golangci/golangci-lint
golangci-lint
];
shellHook = ''
${pkgs.go}/bin/go version
'';
};
});
}