2022-09-02 04:09:30 +00:00
|
|
|
{ stdenv
|
|
|
|
, callPackage
|
|
|
|
, lib
|
|
|
|
, makeWrapper
|
|
|
|
, installShellFiles
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildGoApplication
|
|
|
|
, mkGoEnv
|
2022-09-02 08:10:43 +00:00
|
|
|
, which
|
2022-09-02 04:09:30 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoApplication {
|
|
|
|
pname = "gomod2nix";
|
|
|
|
version = "dev";
|
|
|
|
|
2022-09-02 08:10:43 +00:00
|
|
|
pwd = ./.;
|
|
|
|
|
2022-09-02 04:09:30 +00:00
|
|
|
modules = ./gomod2nix.toml;
|
|
|
|
|
2021-01-12 16:55:00 +00:00
|
|
|
src = lib.cleanSourceWith {
|
2022-05-30 11:09:22 +00:00
|
|
|
filter = name: type: builtins.foldl' (v: s: v && ! lib.hasSuffix s name) true [
|
|
|
|
"tests"
|
|
|
|
"builder"
|
|
|
|
"templates"
|
|
|
|
];
|
2021-01-12 16:55:00 +00:00
|
|
|
src = lib.cleanSource ./.;
|
|
|
|
};
|
2022-09-02 04:09:30 +00:00
|
|
|
|
|
|
|
allowGoReference = true;
|
|
|
|
|
|
|
|
subPackages = [ "." ];
|
|
|
|
|
2022-09-02 08:10:43 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles which ];
|
2022-09-02 04:09:30 +00:00
|
|
|
|
|
|
|
passthru = {
|
|
|
|
inherit buildGoApplication mkGoEnv;
|
|
|
|
};
|
|
|
|
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform == stdenv.targetPlatform) ''
|
|
|
|
installShellCompletion --cmd gomod2nix \
|
|
|
|
--bash <($out/bin/gomod2nix completion bash) \
|
|
|
|
--fish <($out/bin/gomod2nix completion fish) \
|
|
|
|
--zsh <($out/bin/gomod2nix completion zsh)
|
|
|
|
'' + ''
|
2022-09-02 09:11:21 +00:00
|
|
|
wrapProgram $out/bin/gomod2nix --suffix PATH : $(dirname $(which go))
|
2022-09-02 04:09:30 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Convert applications using Go modules -> Nix";
|
|
|
|
homepage = "https://github.com/nix-community/gomod2nix";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.adisbladis ];
|
|
|
|
};
|
|
|
|
}
|