dev-templates/go1.18/flake.nix

49 lines
1.1 KiB
Nix
Raw Normal View History

2022-07-12 01:17:54 +02:00
{
2022-07-28 23:20:46 +02:00
description = "A Nix-flake-based Go 1.18 development environment";
2022-07-12 01:17:54 +02:00
2022-07-31 13:02:06 +02:00
inputs = { dev.url = "github:the-nix-way/dev-templates"; };
2022-07-12 01:17:54 +02:00
2022-07-31 12:57:49 +02:00
outputs = { self, dev }:
2022-07-31 13:02:06 +02:00
let inherit (dev.lib) flake-utils nixpkgs;
2022-07-31 12:57:49 +02:00
in flake-utils.lib.eachDefaultSystem (system:
2022-07-12 01:17:54 +02:00
let
pkgs = import nixpkgs { inherit system; };
2022-07-16 17:00:05 +02:00
goPkg = pkgs.go_1_18;
2022-07-28 23:20:46 +02:00
inherit (pkgs) mkShellNoCC;
2022-07-12 01:17:54 +02:00
in {
2022-07-16 17:00:05 +02:00
apps.default = {
type = "app";
program = "${goPkg}/bin/go";
};
2022-07-12 01:17:54 +02:00
devShells = {
2022-07-28 23:20:46 +02:00
default = mkShellNoCC {
2022-07-12 01:17:54 +02:00
buildInputs = with pkgs; [
# go 1.18.3
2022-07-16 17:00:05 +02:00
goPkg
2022-07-12 01:17:54 +02: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 16:48:23 +02:00
shellHook = ''
2022-07-28 23:20:46 +02:00
${goPkg}/bin/go version
2022-07-16 16:48:23 +02:00
'';
2022-07-12 01:17:54 +02:00
};
};
2022-07-29 00:11:05 +02:00
});
2022-07-16 16:48:23 +02:00
}