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 12:28:29 +01:00
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
2023-03-06 12:28:29 +01: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 23:42:34 +02:00
devShells.default = pkgs.mkShellNoCC {
2023-02-15 01:20:41 +01:00
packages = with pkgs; [
2022-10-12 23:42:34 +02: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
'';
};
});
}