1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 installShellFiles,
6 php,
7 nix-update-script,
8 testers,
9}:
10
11php.buildComposerProject (finalAttrs: {
12 pname = "castor";
13 version = "0.14.0";
14
15 src = fetchFromGitHub {
16 owner = "jolicode";
17 repo = "castor";
18 rev = "v${finalAttrs.version}";
19 hash = "sha256-sSIkXNW6RR1mx15dKouQLMaHBr5FEkTTc/0QIkWV8sg=";
20 };
21
22 patches = [
23 # Upstream lock is invalid. https://github.com/jolicode/castor/issues/319
24 (fetchpatch {
25 name = "fix-invalid-lock.patch";
26 url = "https://github.com/jolicode/castor/commit/5ff0c3ecbdddad20146adbc2f055b83f5aadba0f.patch";
27 hash = "sha256-1a3Dpk/UXp92Ugw9zSoLPsbWOJEuP2FBWc/pQ/EKwaM=";
28 })
29 ];
30
31 vendorHash = "sha256-HfEjwlkozeuT4LDnYwiCu7T0spcf4GLhkd7Kc1VRnro=";
32
33 nativeBuildInputs = [ installShellFiles ];
34
35 # install shell completions
36 postInstall = ''
37 installShellCompletion --cmd castor \
38 --bash <($out/bin/castor completion bash) \
39 --fish <($out/bin/castor completion fish) \
40 --zsh <($out/bin/castor completion zsh)
41 '';
42
43 passthru = {
44 updateScript = nix-update-script { };
45 tests.version = testers.testVersion {
46 command = "castor --version";
47 package = php.packages.castor;
48 version = "v${finalAttrs.version}";
49 };
50 };
51
52 meta = {
53 changelog = "https://github.com/jolicode/castor/blob/v${finalAttrs.version}/CHANGELOG.md";
54 description = "DX oriented task runner and command launcher built with PHP";
55 homepage = "https://github.com/jolicode/castor";
56 license = lib.licenses.mit;
57 maintainers = with lib.maintainers; [ gaelreyrol ];
58 mainProgram = "castor";
59 };
60})