summaryrefslogtreecommitdiff
path: root/pkgs/papa/package.nix
blob: 61c465ed972fa0b3e64a5743888b3a4ad5c0e389 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  papa,
  installShellFiles,
  nix-update-script,
  testers,
  openssl,
  pkg-config,
}:
rustPlatform.buildRustPackage rec {
  pname = "papa";
  version = "4.1.0-rc.4";

  src = fetchFromGitHub {
    owner = "AnActualEmerald";
    repo = "papa";
    rev = "v${version}";
    hash = "sha256-XAYenoWLKeNzNozFRPz84WDeU0/y2hd/wgr3UeZLFS0=";
  };

  postUnpack = ''
    rmdir source/thermite
    ln -sf ${passthru.libthermite} source/thermite
  '';

  cargoHash = "sha256-t2c/eaQLEKLzJEvyY35Kithon5K5Bes3OWmQgExigzI=";

  nativeBuildInputs = [
    pkg-config
    installShellFiles
  ];
  buildInputs = [ openssl ];

  postInstall = ''
    installShellCompletion --cmd papa \
      --bash <($out/bin/papa complete bash) \
      --fish <($out/bin/papa complete fish) \
      --zsh <($out/bin/papa complete zsh)
  '';

  passthru = {
    tests.version = testers.testVersion { package = papa; };

    updateScript = nix-update-script { };

    libthermite = fetchFromGitHub {
      owner = "AnActualEmerald";
      repo = "thermite";
      rev = "8e6fc6af20e9bd2af4313fee65dfed05cfa1bbd5";
      hash = "sha256-7zkXW2G7cwyobYJO22o1QoJRs2O6sD7/S9frZ/+DNIQ=";
    };
  };

  meta = with lib; {
    description = "Mod manager for Northstar clients and servers";
    homepage = "https://github.com/AnActualEmerald/papa";
    changelog = "https://github.com/AnActualEmerald/papa/releases/tag/v${src.version}";
    mainProgram = "papa";
    license = licenses.mit;
    maintainers = with maintainers; [ getchoo ];
    platforms = platforms.unix;
  };
}