nixpkgs/pkgs/os-specific/linux/trelay/default.nix
Jan Malakhovski 591ccfe5b9 treewide: noop: refer to src.name or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5ce left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.

Also, similarly to d8f7f6a5ce some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-11 09:20:44 +00:00

47 lines
1.5 KiB
Nix

{ stdenv, lib, fetchgit, kernel, kmod }:
let
version = "22.03.5";
in
stdenv.mkDerivation (finalAttrs: {
pname = "trelay";
version = "${version}-${kernel.version}";
src = fetchgit {
url = "https://git.openwrt.org/openwrt/openwrt.git";
rev = "v${version}";
hash = "sha256-5f9LvaZUxtfTpTR268QMkEmHUpn/nct+MVa44SBGT5c=";
sparseCheckout = [ "package/kernel/trelay/src" ];
};
sourceRoot = "${finalAttrs.src.name}/package/kernel/trelay/src";
hardeningDisable = [ "pic" "format" ];
nativeBuildInputs = [ kmod ] ++ kernel.moduleBuildDependencies;
postPatch = ''
cp '${./Makefile}' Makefile
'';
makeFlags = kernel.makeFlags ++ [
"KERNELRELEASE=${kernel.modDirVersion}"
"KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
"INSTALL_MOD_PATH=$(out)"
];
meta = with lib; {
description = "For relaying IP packets between two devices to build a IP bridge between them";
longDescription = ''
A kernel module that relays ethernet packets between two devices (similar to a bridge),
but without any MAC address checks.
This makes it possible to bridge client mode or ad-hoc mode wifi devices to ethernet VLANs,
assuming the remote end uses the same source MAC address as the device that packets are
supposed to exit from.
'';
homepage = "https://github.com/openwrt/openwrt/tree/main/package/kernel/trelay";
license = licenses.gpl2Plus;
maintainers = [ maintainers.aprl ];
platforms = platforms.linux;
broken = lib.versionOlder kernel.version "5.10";
};
})