flake: use subPackages instead of buildPhase and installPhase

This commit is contained in:
Tigor Hutasuhut 2024-08-08 12:35:49 +07:00
parent cc75353de1
commit 0e8affc4d4

View file

@ -16,41 +16,19 @@
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-J0PS4ZxGtOa+0QOOSjfg0WeVYGyf757WuTnpQTWIV1w="; sha256 = "sha256-J0PS4ZxGtOa+0QOOSjfg0WeVYGyf757WuTnpQTWIV1w=";
}; };
nativeBuildInputs = [ pkgs.go ]; subPackages = [ "cmd/goverter" ];
buildPhase = ''
runHook preBuild
go build -o goverter ./cmd/goverter
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp goverter $out/bin
runHook postInstall
'';
vendorHash = "sha256-uQ1qKZLRwsgXKqSAERSqf+1cYKp6MTeVbfGs+qcdakE="; vendorHash = "sha256-uQ1qKZLRwsgXKqSAERSqf+1cYKp6MTeVbfGs+qcdakE=";
}; };
bobgen-sqlite = pkgs.buildGoModule rec { bobgen-sqlite = pkgs.buildGoModule rec {
name = "bobgen-sqlite"; name = "bobgen-sqlite";
version = "0.28.1"; version = "0.28.1";
subPackages = [ "gen/bobgen-sqlite" ];
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "stephenafamo"; owner = "stephenafamo";
repo = "bob"; repo = "bob";
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-iLcSY5BBmjuICsIC9u6wyrp7elDt4yY8Ji7UWmsJ688="; sha256 = "sha256-iLcSY5BBmjuICsIC9u6wyrp7elDt4yY8Ji7UWmsJ688=";
}; };
nativeBuildInputs = [ pkgs.go ];
buildPhase = ''
runHook preBuild
go build -o bobgen-sqlite ./gen/bobgen-sqlite
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp bobgen-sqlite $out/bin
runHook postInstall
'';
vendorHash = "sha256-9vLcyCAhW/Dq0zV8FhM0T3Ofn/8XsUhV5KlphNidGDw="; vendorHash = "sha256-9vLcyCAhW/Dq0zV8FhM0T3Ofn/8XsUhV5KlphNidGDw=";
}; };
in in