1{ lib, stdenv, fetchFromGitHub, fetchpatch, kernel }:
2
3let
4 sourceAttrs = (import ./source.nix) { inherit fetchFromGitHub; };
5in
6
7stdenv.mkDerivation {
8 name = "jool-${sourceAttrs.version}-${kernel.version}";
9
10 src = sourceAttrs.src;
11
12 nativeBuildInputs = kernel.moduleBuildDependencies;
13 hardeningDisable = [ "pic" ];
14
15 patches = [
16 (fetchpatch {
17 url = "https://git.launchpad.net/ubuntu/+source/jool/plain/debian/patches/0001-Linux-6.2.patch?id=3708a5b6c492b7d8e9f78596e61ae8f74ec9640f";
18 hash = "sha256-GkyDY6tcJp7Xd28mrDorEJHxsEowZBJP7BRAdPpsyF8=";
19 })
20 ];
21
22 prePatch = ''
23 sed -e 's@/lib/modules/\$(.*)@${kernel.dev}/lib/modules/${kernel.modDirVersion}@' -i src/mod/*/Makefile
24 '';
25
26 makeFlags = kernel.makeFlags ++ [
27 "-C src/mod"
28 "INSTALL_MOD_PATH=${placeholder "out"}"
29 ];
30
31 installTargets = "modules_install";
32
33 meta = with lib; {
34 homepage = "https://www.jool.mx/";
35 description = "Fairly compliant SIIT and Stateful NAT64 for Linux - kernel modules";
36 platforms = platforms.linux;
37 license = licenses.gpl2Only;
38 maintainers = with maintainers; [ fpletz ];
39 };
40}