about summary refs log tree commit diff
path: root/third_party/josh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/josh')
-rw-r--r--third_party/josh/default.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/third_party/josh/default.nix b/third_party/josh/default.nix
new file mode 100644
index 000000000000..f2a8d7a50f6a
--- /dev/null
+++ b/third_party/josh/default.nix
@@ -0,0 +1,51 @@
+# 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;
+  };
+  version = "git-${builtins.substring 0 8 rev}";
+in
+naersk.buildPackage {
+  pname = "josh";
+  inherit src version;
+  JOSH_VERSION = version;
+
+  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"
+    '';
+  };
+}