1{ stdenv
2, fetchurl
3, lib
4, autoPatchelfHook
5}:
6
7let
8 # Upstream replaces minor versions, so use cached URLs.
9 srcs = {
10 "i686-linux" = fetchurl {
11 url = "https://web.archive.org/web/20220907001049/https://ftp.perforce.com/perforce/r22.1/bin.linux26x86/helix-core-server.tgz";
12 sha256 = "e9cf27c9dd2fa6432745058a93896d151543aff712fce9f7322152d6ea88a12a";
13 };
14 "x86_64-linux" = fetchurl {
15 url = "https://web.archive.org/web/20220907001202/https://ftp.perforce.com/perforce/r22.1/bin.linux26x86_64/helix-core-server.tgz";
16 sha256 = "9c272b67574264a4f49fe846ccda24fbd4baeb282665af74b6fbccff26a43558";
17 };
18 "x86_64-darwin" = fetchurl {
19 url = "https://web.archive.org/web/20220907001334/https://ftp.perforce.com/perforce/r22.1/bin.macosx1015x86_64/helix-core-server.tgz";
20 sha256 = "2500a23fe482a303bd400f0de460b7624ad3f940fef45246004b9f956e90ea45";
21 };
22 };
23in
24stdenv.mkDerivation {
25 pname = "p4d";
26 version = "2022.1.2305383";
27
28 src =
29 assert lib.assertMsg (builtins.hasAttr stdenv.hostPlatform.system srcs) "p4d is not available for ${stdenv.hostPlatform.system}";
30 srcs.${stdenv.hostPlatform.system};
31
32 sourceRoot = ".";
33
34 nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
35
36 dontBuild = true;
37
38 installPhase = ''
39 install -D -t $out/bin p4broker p4d p4p
40 install -D -t $out/doc/p4d -m 0644 *.txt
41 '';
42
43 meta = with lib; {
44 description = "Perforce Helix Core Server";
45 homepage = "https://www.perforce.com";
46 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
47 license = licenses.unfree;
48 mainProgram = "p4d";
49 platforms = builtins.attrNames srcs;
50 maintainers = with maintainers; [ corngood impl ];
51 };
52}