summary refs log tree commit diff
path: root/pkgs/tools/filesystems/squashfs/default.nix
blob: 2fd3d52bdf67ff23baeacbd486a7c6879eab9f17 (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
{ stdenv, fetchFromGitHub, zlib, xz
, lz4 ? null
, lz4Support ? false
, zstd
}:

assert lz4Support -> (lz4 != null);

stdenv.mkDerivation rec {
  name = "squashfs-${version}";
  version = "4.4dev_20180612";

  src = fetchFromGitHub {
    owner = "plougher";
    repo = "squashfs-tools";
    sha256 = "1y53z8dkph3khdyhkmkmy0sg9p1n8czv3vj4l324nj8kxyih3l2c";
    rev = "6e242dc95485ada8d1d0b3dd9346c5243d4a517f";
  };

  patches = [
    # These patches ensures that mksquashfs output is reproducible.
    # See also https://reproducible-builds.org/docs/system-images/
    # and https://github.com/NixOS/nixpkgs/issues/40144.
    ./0001-If-SOURCE_DATE_EPOCH-is-set-override-timestamps-with.patch
    ./0002-If-SOURCE_DATE_EPOCH-is-set-also-clamp-content-times.patch
    ./0003-remove-frag-deflator-thread.patch

    # This patch adds an option to pad filesystems (increasing size) in
    # exchange for better chunking / binary diff calculation.
    ./squashfs-tools-4.3-4k-align.patch
  ] ++ stdenv.lib.optional stdenv.isDarwin ./darwin.patch;

  buildInputs = [ zlib xz zstd ]
    ++ stdenv.lib.optional lz4Support lz4;

  preBuild = "cd squashfs-tools";

  installFlags = "INSTALL_DIR=\${out}/bin";

  makeFlags = [ "XZ_SUPPORT=1" "ZSTD_SUPPORT=1" ]
    ++ stdenv.lib.optional lz4Support "LZ4_SUPPORT=1";

  meta = {
    homepage = http://squashfs.sourceforge.net/;
    description = "Tool for creating and unpacking squashfs filesystems";
    platforms = stdenv.lib.platforms.unix;
    license = stdenv.lib.licenses.gpl2Plus;
    maintainers = with stdenv.lib.maintainers; [ ruuda ];
  };
}