1{
2 buildGoModule,
3 fetchFromGitHub,
4 lib,
5 nix-update-script,
6 testers,
7 symfony-cli,
8 nssTools,
9 makeBinaryWrapper,
10}:
11
12buildGoModule (finalAttrs: {
13 pname = "symfony-cli";
14 version = "5.12.0";
15 vendorHash = "sha256-b0BdqqO6257KZ6O+AJ+XQVo+q1X9Msta4dmIfWKasyI=";
16
17 src = fetchFromGitHub {
18 owner = "symfony-cli";
19 repo = "symfony-cli";
20 rev = "v${finalAttrs.version}";
21 hash = "sha256-xl8pKfAgaeEjtITMpp6urwPndIBXxSyYEcX0PpVK8nc=";
22 leaveDotGit = true;
23 postFetch = ''
24 git --git-dir $out/.git log -1 --pretty=%cd --date=format:'%Y-%m-%dT%H:%M:%SZ' > $out/SOURCE_DATE
25 rm -rf $out/.git
26 '';
27 };
28
29 ldflags = [
30 "-s"
31 "-w"
32 "-X main.version=${finalAttrs.version}"
33 "-X main.channel=stable"
34 ];
35
36 preBuild = ''
37 ldflags+=" -X main.buildDate=$(cat SOURCE_DATE)"
38 '';
39
40 buildInputs = [ makeBinaryWrapper ];
41
42 postInstall = ''
43 mkdir $out/libexec
44 mv $out/bin/symfony-cli $out/libexec/symfony
45
46 makeBinaryWrapper $out/libexec/symfony $out/bin/symfony \
47 --prefix PATH : ${lib.makeBinPath [ nssTools ]}
48 '';
49
50 # Tests requires network access
51 doCheck = false;
52
53 passthru = {
54 updateScript = nix-update-script { };
55 tests.version = testers.testVersion {
56 inherit (finalAttrs) version;
57 package = symfony-cli;
58 command = "symfony version --no-ansi";
59 };
60 };
61
62 meta = {
63 changelog = "https://github.com/symfony-cli/symfony-cli/releases/tag/v${finalAttrs.version}";
64 description = "Symfony CLI";
65 homepage = "https://github.com/symfony-cli/symfony-cli";
66 license = lib.licenses.agpl3Plus;
67 mainProgram = "symfony";
68 maintainers = with lib.maintainers; [ drupol ];
69 };
70})