nixpkgs/pkgs/by-name/sy/symfony-cli/package.nix
Pol Dellaiera aecc8aa7b8
symfony-cli: add build date
Inspired from pkgs/applications/graphics/pdfcpu/default.nix
2024-05-13 15:56:52 +02:00

70 lines
1.6 KiB
Nix

{ buildGoModule
, fetchFromGitHub
, lib
, nix-update-script
, testers
, symfony-cli
, nssTools
, makeBinaryWrapper
}:
buildGoModule rec {
pname = "symfony-cli";
version = "5.8.17";
vendorHash = "sha256-ARTKJVHgN1Y3xOUc3P2Ch7e8gN9BZbhBEZ1DiM7nEWs=";
src = fetchFromGitHub {
owner = "symfony-cli";
repo = "symfony-cli";
rev = "v${version}";
hash = "sha256-UmGyIZk5s5A8ModafWMZqeJHdZ4fa+hAHi62pdlfJ8I=";
leaveDotGit = true;
postFetch = ''
git --git-dir $out/.git log -1 --pretty=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ' > $out/SOURCE_DATE
rm -rf $out/.git
'';
};
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
"-X main.channel=stable"
];
preBuild = ''
ldflags+=" -X main.buildDate=$(cat SOURCE_DATE)"
'';
buildInputs = [ makeBinaryWrapper ];
postInstall = ''
mkdir $out/libexec
mv $out/bin/symfony-cli $out/libexec/symfony
makeBinaryWrapper $out/libexec/symfony $out/bin/symfony \
--prefix PATH : ${lib.makeBinPath [ nssTools ]}
'';
# Tests requires network access
doCheck = false;
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
inherit version;
package = symfony-cli;
command = "symfony version --no-ansi";
};
};
meta = {
changelog = "https://github.com/symfony-cli/symfony-cli/releases/tag/v${version}";
description = "Symfony CLI";
homepage = "https://github.com/symfony-cli/symfony-cli";
license = lib.licenses.agpl3Plus;
mainProgram = "symfony";
maintainers = with lib.maintainers; [ drupol ];
};
}