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:
adisbladis 2022-09-02 16:09:30 +12:00
parent a02a4ea0b2
commit 8525f7f0e5
4 changed files with 48 additions and 52 deletions

View file

@ -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 ];
};
}

View file

@ -29,7 +29,7 @@
};
in
{
packages.default = pkgs.callPackage (pkgs.callPackage ./default.nix { }) { };
packages.default = pkgs.callPackage ./. { };
devShells.default = import ./shell.nix { inherit pkgs; };
})
);

View file

@ -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 ];
};
}

View file

@ -6,5 +6,5 @@ let
in
{
inherit (callPackage ./builder { }) buildGoApplication mkGoEnv;
gomod2nix = callPackage (callPackage ./default.nix { }) { };
gomod2nix = callPackage ./default.nix { };
}