Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 lz4,
6 lzo,
7 which,
8 xz,
9 zlib,
10 zstd,
11 bigEndian ? false,
12}:
13
14let
15 drv = stdenv.mkDerivation (finalAttrs: {
16 pname = "sasquatch";
17 version = "4.5.1-5";
18
19 src = fetchFromGitHub {
20 owner = "onekey-sec";
21 repo = "sasquatch";
22 rev = "sasquatch-v${finalAttrs.version}";
23 hash = "sha256-4Mltt0yFt4oh9hsrHL8/ch5n7nZYiXIJ1UgLktPvlKQ=";
24 };
25
26 patches = lib.optional stdenv.hostPlatform.isDarwin ./darwin.patch;
27
28 strictDeps = true;
29 nativeBuildInputs = [ which ];
30 buildInputs = [
31 zlib
32 xz
33 zstd
34 lz4
35 lzo
36 ];
37
38 preBuild = ''
39 cd squashfs-tools
40 '';
41
42 installFlags = [
43 "INSTALL_DIR=${placeholder "out"}/bin"
44 "INSTALL_MANPAGES_DIR=${placeholder "out"}/share/man/man1"
45 ];
46
47 makeFlags = [
48 "GZIP_SUPPORT=1"
49 "LZ4_SUPPORT=1"
50 "LZMA_SUPPORT=1"
51 "LZO_SUPPORT=1"
52 "XZ_SUPPORT=1"
53 "ZSTD_SUPPORT=1"
54 "AR:=$(AR)"
55 ];
56
57 env.NIX_CFLAGS_COMPILE = lib.optionalString bigEndian "-DFIX_BE";
58
59 postInstall = lib.optionalString bigEndian ''
60 mv $out/bin/sasquatch{,-v4be}
61 '';
62
63 meta = {
64 homepage = "https://github.com/onekey-sec/sasquatch";
65 description = "Set of patches to the standard unsquashfs utility (part of squashfs-tools) that attempts to add support for as many hacked-up vendor-specific SquashFS implementations as possible";
66 license = lib.licenses.gpl2Plus;
67 maintainers = with lib.maintainers; [ vlaci ];
68 platforms = lib.platforms.unix;
69 mainProgram = if bigEndian then "sasquatch-v4be" else "sasquatch";
70 };
71 });
72in
73drv