2022-06-13 15:31:18 +00:00
|
|
|
{ stdenv, buildGoApplication, go, nix, lib, makeWrapper, installShellFiles }:
|
2020-07-23 09:34:26 +00:00
|
|
|
|
2020-12-03 15:00:17 +00:00
|
|
|
buildGoApplication {
|
2022-05-28 13:50:18 +00:00
|
|
|
inherit go;
|
2020-07-23 09:34:26 +00:00
|
|
|
pname = "gomod2nix";
|
|
|
|
version = "0.1";
|
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 ./.;
|
|
|
|
};
|
2020-07-23 09:34:26 +00:00
|
|
|
modules = ./gomod2nix.toml;
|
2020-07-24 09:37:14 +00:00
|
|
|
|
2022-05-28 13:50:18 +00:00
|
|
|
allowGoReference = true;
|
|
|
|
|
2020-12-03 15:00:17 +00:00
|
|
|
subPackages = [ "." ];
|
|
|
|
|
2022-06-13 15:31:18 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
2020-07-24 09:37:14 +00:00
|
|
|
|
2022-06-13 21:26:36 +00:00
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform == stdenv.targetPlatform) ''
|
2022-06-13 15:31:18 +00:00
|
|
|
$out/bin/gomod2nix completion bash > gomod2nix.bash
|
|
|
|
$out/bin/gomod2nix completion fish > gomod2nix.fish
|
|
|
|
$out/bin/gomod2nix completion zsh > _gomod2nix
|
|
|
|
installShellCompletion gomod2nix.{bash,fish} _gomod2nix
|
|
|
|
'' + ''
|
2022-05-28 13:50:18 +00:00
|
|
|
wrapProgram $out/bin/gomod2nix --prefix PATH : ${lib.makeBinPath [ go ]}
|
2020-07-24 09:37:14 +00:00
|
|
|
'';
|
2022-06-13 15:31:18 +00:00
|
|
|
|
2022-06-13 15:33:08 +00:00
|
|
|
meta = {
|
|
|
|
description = "Convert applications using Go modules -> Nix";
|
|
|
|
homepage = "https://github.com/tweag/gomod2nix";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = [ lib.maintainers.adisbladis ];
|
|
|
|
};
|
2020-07-23 09:34:26 +00:00
|
|
|
}
|