40 lines
842 B
Nix
40 lines
842 B
Nix
{
|
|
description = "A Nix-flake-based Go 1.17 development environment";
|
|
|
|
inputs = {
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
};
|
|
|
|
outputs =
|
|
{ self
|
|
, flake-utils
|
|
, nixpkgs
|
|
}:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
goVersion = 19;
|
|
overlays = [ (self: super: { go = super."go_1_${toString goVersion}"; }) ];
|
|
pkgs = import nixpkgs { inherit overlays system; };
|
|
in
|
|
{
|
|
devShell = pkgs.mkShellNoCC {
|
|
buildInputs = with pkgs; [
|
|
# go 1.17.1 (specified by overlay)
|
|
go
|
|
|
|
# goimports, godoc, etc.
|
|
gotools
|
|
|
|
# https://github.com/golangci/golangci-lint
|
|
golangci-lint
|
|
];
|
|
|
|
shellHook = ''
|
|
${pkgs.go}/bin/go version
|
|
'';
|
|
};
|
|
});
|
|
}
|