about summary refs log tree commit diff
path: root/pkgs/by-name/oo/ooklaserver/package.nix
blob: 0f265470b6fdff48f773b74f11c4eef9eb044f8d (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
50
51
52
53
{ lib
, stdenv
, fetchurl
, unzip
}:
let
  filenameMapping = {
    "x86_64-linux" = "OoklaServer-linux-x86_64-static-musl.zip";
    "aarch64-linux" = "OoklaServer-linux-aarch64-static-musl.zip";
    # Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64]
    "x86_64-darwin" = "OoklaServer-macosx.zip";
    "aarch64-darwin" = "OoklaServer-macosx.zip";
    "x86_64-windows" = "OoklaServer-windows64.zip";
    "i686-windows" = "OoklaServer-windows32.zip";
    # OoklaServer-linux64-deb9.zip
    # OoklaServer-freebsd12_64.zip
    # OoklaServer-freebsd13_64.zip
  };
in
stdenv.mkDerivation rec {
  version = "2.11.1.2";
  pname = "ooklaserver";

  src = fetchurl {
    url = "https://web.archive.org/web/20240703022648/https://install.speedtest.net/ooklaserver/stable/OoklaServer.tgz";
    hash = "sha256-tctLtTGmrVHs+4pI1PRHrqY+a4ISs6TKvLRKlFdWw88=";
  };
  sourceRoot = ".";

  dontConfigure = true;
  dontBuild = true;

  nativeBuildInputs = [ unzip ];

  installPhase = ''
    runHook preInstall
    unzip ${filenameMapping.${stdenv.system}}
    install -Dm555 OoklaServer${stdenv.hostPlatform.extensions.executable} "$out/bin/OoklaServer"
    install -Dm444 OoklaServer.properties.default "$out/etc/OoklaServer.properties.default"
    runHook postInstall
  '';

  meta = {
    description = "Ookla TCP based server daemon that provides standalone testing";
    homepage = "https://www.speedtest.net";
    changelog = "https://support.ookla.com/hc/en-us/articles/234578608-Speedtest-Server-Release-Notes";
    sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
    license = lib.licenses.unfree;
    maintainers = with lib.maintainers; [ neverbehave ];
    platforms = builtins.attrNames filenameMapping;
    mainProgram = "OoklaServer";
  };
}