mirror of
https://github.com/tweag/gomod2nix.git
synced 2024-11-03 09:12:09 +00:00
Remove generic builder expression
This was an attempt to get maximal sharing with Nixpkgs but in hindsight it's better to just have some code duplication.
This commit is contained in:
parent
a02a4ea0b2
commit
8525f7f0e5
4 changed files with 48 additions and 52 deletions
51
default.nix
51
default.nix
|
@ -1,6 +1,20 @@
|
|||
{ lib }:
|
||||
(import ./generic.nix {
|
||||
version = "1.4.0";
|
||||
{ stdenv
|
||||
, callPackage
|
||||
, go
|
||||
, lib
|
||||
, makeWrapper
|
||||
, installShellFiles
|
||||
, fetchFromGitHub
|
||||
, buildGoApplication
|
||||
, mkGoEnv
|
||||
}:
|
||||
|
||||
buildGoApplication {
|
||||
pname = "gomod2nix";
|
||||
version = "dev";
|
||||
|
||||
modules = ./gomod2nix.toml;
|
||||
|
||||
src = lib.cleanSourceWith {
|
||||
filter = name: type: builtins.foldl' (v: s: v && ! lib.hasSuffix s name) true [
|
||||
"tests"
|
||||
|
@ -9,5 +23,32 @@
|
|||
];
|
||||
src = lib.cleanSource ./.;
|
||||
};
|
||||
modules = ./gomod2nix.toml;
|
||||
})
|
||||
|
||||
inherit go;
|
||||
|
||||
allowGoReference = true;
|
||||
|
||||
subPackages = [ "." ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
||||
|
||||
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)
|
||||
'' + ''
|
||||
wrapProgram $out/bin/gomod2nix --prefix PATH : ${lib.makeBinPath [ go ]}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Convert applications using Go modules -> Nix";
|
||||
homepage = "https://github.com/nix-community/gomod2nix";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = [ lib.maintainers.adisbladis ];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
};
|
||||
in
|
||||
{
|
||||
packages.default = pkgs.callPackage (pkgs.callPackage ./default.nix { }) { };
|
||||
packages.default = pkgs.callPackage ./. { };
|
||||
devShells.default = import ./shell.nix { inherit pkgs; };
|
||||
})
|
||||
);
|
||||
|
|
45
generic.nix
45
generic.nix
|
@ -1,45 +0,0 @@
|
|||
{ version
|
||||
, src
|
||||
, modules
|
||||
}:
|
||||
{ stdenv
|
||||
, callPackage
|
||||
, go
|
||||
, lib
|
||||
, makeWrapper
|
||||
, installShellFiles
|
||||
, fetchFromGitHub
|
||||
, buildGoApplication ? (callPackage ./builder { }).buildGoApplication
|
||||
, mkGoEnv ? (callPackage ./builder { }).buildGoApplication
|
||||
}:
|
||||
|
||||
buildGoApplication {
|
||||
pname = "gomod2nix";
|
||||
inherit version modules src go;
|
||||
|
||||
allowGoReference = true;
|
||||
|
||||
subPackages = [ "." ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
||||
|
||||
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)
|
||||
'' + ''
|
||||
wrapProgram $out/bin/gomod2nix --prefix PATH : ${lib.makeBinPath [ go ]}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Convert applications using Go modules -> Nix";
|
||||
homepage = "https://github.com/nix-community/gomod2nix";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = [ lib.maintainers.adisbladis ];
|
||||
};
|
||||
}
|
|
@ -6,5 +6,5 @@ let
|
|||
in
|
||||
{
|
||||
inherit (callPackage ./builder { }) buildGoApplication mkGoEnv;
|
||||
gomod2nix = callPackage (callPackage ./default.nix { }) { };
|
||||
gomod2nix = callPackage ./default.nix { };
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue