1{
2 lib,
3 kernel,
4 kernelModuleMakeFlags,
5 stdenv,
6 fetchFromGitea,
7 libgcrypt,
8 lvm2,
9}:
10stdenv.mkDerivation (finalAttrs: {
11 name = "shufflecake";
12 version = "0.5.2";
13 src = fetchFromGitea {
14 domain = "codeberg.org";
15 owner = "shufflecake";
16 repo = "shufflecake-c";
17 rev = "v${finalAttrs.version}";
18 hash = "sha256-EF9VKaqcNJt3hd/CUT+QeW17tc5ByStDanGGwi4uL4s=";
19 };
20
21 nativeBuildInputs = kernel.moduleBuildDependencies;
22 buildInputs = [
23 libgcrypt
24 lvm2
25 ];
26 makeFlags = kernelModuleMakeFlags ++ [
27 "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
28 ];
29
30 # GCC 14 makes this an error by default, remove when fixed upstream
31 env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
32
33 outputs = [
34 "out"
35 "bin"
36 ];
37
38 installPhase = ''
39 install -Dm444 dm-sflc.ko $out/lib/modules/${kernel.modDirVersion}/drivers/md/dm-sflc.ko
40 install -Dm555 shufflecake $bin/shufflecake
41 '';
42
43 meta = with lib; {
44 description = "Plausible deniability (hidden storage) layer for Linux";
45 homepage = "https://shufflecake.net";
46 license = licenses.gpl2Only;
47 maintainers = with maintainers; [ oluceps ];
48 outputsToInstall = [ "bin" ];
49 platforms = platforms.linux;
50 broken = kernel.kernelOlder "6.1" || kernel.meta.name == "linux-lqx-6.12.1";
51 };
52})