1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 kernel,
6 kernelModuleMakeFlags,
7}:
8stdenv.mkDerivation rec {
9 pname = "nullfs";
10 version = "0.19";
11
12 src = fetchFromGitHub {
13 owner = "abbbi";
14 repo = "nullfsvfs";
15 rev = "v${version}";
16 sha256 = "sha256-nEwLxcELLBd+BN7OHYLJZCpie0rG0a1wj0RCOKpZkRU=";
17 };
18
19 hardeningDisable = [ "pic" ];
20
21 enableParallelBuilding = true;
22
23 nativeBuildInputs = kernel.moduleBuildDependencies;
24
25 makeFlags = kernelModuleMakeFlags ++ [
26 "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
27 ];
28
29 prePatch = ''
30 substituteInPlace "Makefile" \
31 --replace-fail "/lib/modules/\$(shell uname -r)/build" "\$(KSRC)"
32 '';
33
34 installPhase = ''
35 runHook preInstall
36 mkdir -p "$out/lib/modules/${kernel.modDirVersion}/kernel/fs/nullfs/"
37 install -p -m 644 nullfs.ko $out/lib/modules/${kernel.modDirVersion}/kernel/fs/nullfs/
38 runHook postInstall
39 '';
40
41 meta = with lib; {
42 description = "Virtual black hole file system that behaves like /dev/null";
43 homepage = "https://github.com/abbbi/nullfsvfs";
44 license = licenses.gpl3;
45 platforms = platforms.linux;
46 maintainers = with maintainers; [ callumio ];
47 };
48}