lol
1{ lib, stdenv, fetchFromGitHub, pkg-config, util-linux, bash }:
2
3stdenv.mkDerivation rec {
4 pname = "bcache-tools";
5 version = "1.0.8";
6
7 src = fetchFromGitHub {
8 owner = "g2p";
9 repo = "bcache-tools";
10 rev = "v${version}";
11 hash = "sha256-6gy0ymecMgEHXbwp/nXHlrUEeDFnmFXWZZPlzP292g4=";
12 };
13
14 nativeBuildInputs = [ pkg-config ];
15 buildInputs = [ util-linux ];
16
17 # * Remove broken install rules (they ignore $PREFIX) for stuff we don't need
18 # anyway (it's distro specific stuff).
19 # * Fixup absolute path to modprobe.
20 prePatch = ''
21 sed -e "/INSTALL.*initramfs\/hook/d" \
22 -e "/INSTALL.*initcpio\/install/d" \
23 -e "/INSTALL.*dracut\/module-setup.sh/d" \
24 -e "s/pkg-config/$PKG_CONFIG/" \
25 -i Makefile
26 '';
27
28 patches = [
29 ./bcache-udev-modern.patch
30 ./fix-static.patch
31 ];
32
33 makeFlags = [
34 "PREFIX=${placeholder "out"}"
35 "UDEVLIBDIR=${placeholder "out"}/lib/udev/"
36 ];
37
38 preInstall = ''
39 mkdir -p "$out/sbin" "$out/lib/udev/rules.d" "$out/share/man/man8"
40 '';
41
42 meta = with lib; {
43 description = "User-space tools required for bcache (Linux block layer cache)";
44 longDescription = ''
45 Bcache is a Linux kernel block layer cache. It allows one or more fast
46 disk drives such as flash-based solid state drives (SSDs) to act as a
47 cache for one or more slower hard disk drives.
48
49 This package contains the required user-space tools.
50
51 User documentation is in Documentation/bcache.txt in the Linux kernel
52 tree.
53 '';
54 homepage = "https://bcache.evilpiepirate.org/";
55 license = licenses.gpl2Only;
56 platforms = platforms.linux;
57 maintainers = [ maintainers.bjornfor ];
58 };
59}