dev-templates/go1.18/flake.nix

51 lines
1.2 KiB
Nix
Raw Normal View History

2022-07-11 16:17:54 -07:00
{
description = "Go 1.17 development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
2022-07-16 08:00:05 -07:00
goPkg = pkgs.go_1_18;
2022-07-11 16:17:54 -07:00
in {
2022-07-16 08:00:05 -07:00
apps.default = {
type = "app";
program = "${goPkg}/bin/go";
};
2022-07-11 16:17:54 -07:00
devShells = {
default = pkgs.mkShellNoCC {
buildInputs = with pkgs; [
# go 1.18.3
2022-07-16 08:00:05 -07:00
goPkg
2022-07-11 16:17:54 -07:00
# goimports, godoc, etc.
gotools
# https://github.com/golangci/golangci-lint
golangci-lint
# The Go language server (for IDEs and such)
gopls
# https://pkg.go.dev/github.com/ramya-rao-a/go-outline
go-outline
# https://github.com/uudashr/gopkgs
gopkgs
];
2022-07-16 07:48:23 -07:00
shellHook = ''
echo "Entering Go env"
2022-07-16 08:00:05 -07:00
echo "Running `${goPkg}/bin/go version`"
2022-07-16 07:48:23 -07:00
'';
2022-07-11 16:17:54 -07:00
};
};
}
);
2022-07-16 07:48:23 -07:00
}