gomod2nix/shell.nix
Jörg Thalheim cf42f710c1 expose flake interface that does not rely on overlays
As creator of small tools, my flakes might often end up in other peoples
projects. Overlays are a performance problem in those use cases because
I would kept re-instantiating nixpkgs instances. Of course I could also
expose my stuff as overlays as well.

In that case I would need to merge downstream dependencies like
go2modnix as well, which would polute their nixpkgs instance with
unrelated stuff and also make it harder for my users to tell what random
attributes came from which place.
2023-09-13 08:24:13 +02:00

23 lines
476 B
Nix

{ pkgs ? (
let
inherit (builtins) fetchTree fromJSON readFile;
in
import (fetchTree (fromJSON (readFile ./flake.lock)).nodes.nixpkgs.locked) {
overlays = [
(import ./overlay.nix)
];
}
)
, gomod2nix ? pkgs.gomod2nix
, mkGoEnv ? pkgs.mkGoEnv
}:
pkgs.mkShell {
NIX_PATH = "nixpkgs=${builtins.toString pkgs.path}";
nativeBuildInputs = [
pkgs.nixpkgs-fmt
pkgs.golangci-lint
gomod2nix
(mkGoEnv { pwd = ./.; })
];
}