nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 kernel,
7 kernelModuleMakeFlags,
8 nixosTests,
9}:
10
11let
12 sourceAttrs = (import ./source.nix) { inherit fetchFromGitHub; };
13in
14
15stdenv.mkDerivation (finalAttrs: {
16 name = "${finalAttrs.pname}-${finalAttrs.version}-${kernel.version}";
17 pname = "jool";
18 inherit (sourceAttrs) version;
19
20 src = sourceAttrs.src;
21
22 patches = lib.optionals (lib.versionAtLeast kernel.version "6.18.0") [
23 (fetchpatch {
24 url = "https://gitlab.alpinelinux.org/alpine/aports/-/raw/3.23-stable/community/jool-modules-lts/kernel-6.18.patch";
25 hash = "sha256-EtV95YaOzPU3e/8NQvUtAH/RWiV16djeKrnvSgYybCQ=";
26 })
27 ];
28
29 nativeBuildInputs = kernel.moduleBuildDependencies;
30 hardeningDisable = [ "pic" ];
31
32 prePatch = ''
33 sed -e 's@/lib/modules/\$(.*)@${kernel.dev}/lib/modules/${kernel.modDirVersion}@' -i src/mod/*/Makefile
34 '';
35
36 makeFlags = kernelModuleMakeFlags ++ [
37 "-C src/mod"
38 "INSTALL_MOD_PATH=${placeholder "out"}"
39 ];
40
41 installTargets = "modules_install";
42
43 passthru.tests = {
44 inherit (nixosTests) jool;
45 };
46
47 meta = {
48 homepage = "https://www.jool.mx/";
49 description = "Fairly compliant SIIT and Stateful NAT64 for Linux - kernel modules";
50 platforms = lib.platforms.linux;
51 license = lib.licenses.gpl2Only;
52 maintainers = with lib.maintainers; [ fpletz ];
53 };
54})