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