dev-templates/go/flake.nix

40 lines
860 B
Nix
Raw Normal View History

{
description = "A Nix-flake-based Go 1.17 development environment";
inputs = {
2023-03-06 03:28:29 -08:00
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
2023-03-06 03:28:29 -08:00
, flake-utils
}:
flake-utils.lib.eachDefaultSystem (system:
let
goVersion = 19;
overlays = [ (self: super: { go = super."go_1_${toString goVersion}"; }) ];
pkgs = import nixpkgs { inherit overlays system; };
in
{
2022-10-12 14:42:34 -07:00
devShells.default = pkgs.mkShellNoCC {
2023-02-14 16:20:41 -08:00
packages = with pkgs; [
2022-10-12 14:42:34 -07:00
# 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
'';
};
});
}