about summary refs log tree commit diff
path: root/third_party/josh/default.nix
blob: e6cb1ac0e156b967b6ad6e36ff04e3ae0769bf1c (plain) (blame)
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
# https://github.com/josh-project/josh
{ depot, pkgs, ... }:

let
  # TODO(sterni): switch to pkgs.josh as soon as that commit is released
  rev = "c0a170a756dd5e63268673086218c0ce7bf18bdc";
  src = pkgs.fetchFromGitHub {
    owner = "josh-project";
    repo = "josh";
    inherit rev;
    hash = "sha256:0rsf65fq9xm3qj77ig3s4wmmgm50jhvwrknr839hipjj5lj4x1hp";
  };


  rust169 = depot.third_party.nixpkgs.rust-bin.stable."1.69.0".default;
  naersk = pkgs.callPackage depot.third_party.sources.naersk {
    rustc = rust169;
    cargo = rust169;
  };
in
naersk.buildPackage {
  inherit src;
  JOSH_VERSION = "git-${builtins.substring 0 8 rev}";

  buildInputs = with pkgs; [
    libgit2
    openssl
    pkg-config
  ];

  dontStrip = true;
  cargoBuildOptions = x: x ++ [
    "-p"
    "josh-filter"
    "-p"
    "josh-proxy"
  ];

  overrideMain = x: {
    preBuild = x.preBuild or "" + ''
      echo 'debug = true' >> Cargo.toml
    '';

    nativeBuildInputs = (x.nativeBuildInputs or [ ]) ++ [ pkgs.makeWrapper ];
    postInstall = ''
      wrapProgram $out/bin/josh-proxy --prefix PATH : "${pkgs.git}/bin"
    '';
  };
}