dev-templates/go1.17/flake.nix

40 lines
921 B
Nix
Raw Normal View History

2022-07-11 16:17:54 -07:00
{
2022-07-28 14:20:46 -07:00
description = "A Nix-flake-based Go 1.17 development environment";
2022-07-11 16:17:54 -07:00
2022-07-31 04:02:06 -07:00
inputs = { dev.url = "github:the-nix-way/dev-templates"; };
2022-07-11 16:17:54 -07:00
2022-07-31 03:57:49 -07:00
outputs = { self, dev }:
2022-07-31 04:02:06 -07:00
let inherit (dev.lib) flake-utils nixpkgs;
2022-07-31 03:57:49 -07:00
in flake-utils.lib.eachDefaultSystem (system:
2022-07-11 16:17:54 -07:00
let
pkgs = import nixpkgs { inherit system; };
2022-07-16 08:00:05 -07:00
goPkg = pkgs.go_1_17;
2022-07-28 14:20:46 -07:00
inherit (pkgs) mkShellNoCC;
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 = {
2022-07-28 14:20:46 -07:00
default = mkShellNoCC {
2022-07-11 16:17:54 -07:00
buildInputs = with pkgs; [
# go 1.17.1
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
];
2022-07-16 07:48:23 -07:00
shellHook = ''
2022-07-28 14:20:46 -07:00
${goPkg}/bin/go version
2022-07-16 07:48:23 -07:00
'';
2022-07-11 16:17:54 -07:00
};
};
2022-07-28 15:11:05 -07:00
});
2022-07-16 07:48:23 -07:00
}