initial commit

main
n0emis 3 years ago
commit 77ab74f97d
Signed by: n0emis
GPG Key ID: 00FAF748B777CF10

@ -0,0 +1,27 @@
{ lib, stdenv, fetchurl, pkg-config, libnl }:
stdenv.mkDerivation rec {
pname = "batctl";
version = "2013.4.0";
src = fetchurl {
url = "https://downloads.open-mesh.org/batman/releases/batman-adv-${version}/${pname}-${version}.tar.gz";
sha256 = "TerjtmZNDROs96js50F1oxpy/lj7FcuREqmiAUsyy0w=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libnl ];
preBuild = ''
makeFlags="PREFIX=$out PKG_CONFIG=${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config"
'';
meta = {
homepage = "https://www.open-mesh.org/projects/batman-adv/wiki/Wiki";
description = "B.A.T.M.A.N. routing protocol in a linux kernel module for layer 2, control tool";
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ fpletz ];
platforms = with lib.platforms; linux;
};
}

@ -0,0 +1,28 @@
{ stdenv, fetchFromGitHub, kernel }:
stdenv.mkDerivation rec {
pname = "batman-adv-legacy";
version = "2013.4.0-65";
src = fetchFromGitHub {
owner = "freifunk-gluon";
repo = "batman-adv-legacy";
rev = "d8bfd8e4b5bd45023b3d0201ee035f7af3dac44a";
sha256 = "sha256-9nivJU+GndvlgD2bh3Y2213Qv79gDRagmsCzuN9zt/Y=";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
hardeningDisable = [ "pic" ];
preBuild = ''
makeFlags="KERNELPATH=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
sed -i -e "s,INSTALL_MOD_DIR=,INSTALL_MOD_PATH=$out INSTALL_MOD_DIR=," \
-e /depmod/d Makefile
'';
meta = {
homepage = "https://www.open-mesh.org/projects/batman-adv/wiki/Wiki";
description = "B.A.T.M.A.N. routing protocol in a linux kernel module for layer 2";
};
}

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.ffnix;
in
{
options.ffnix = {
enable = mkEnableOption "ffnix";
batman-legacy = mkEnableOption "batman-adv-legacy";
};
config = mkIf cfg.enable {
services.vnstat.enable = true;
programs.mtr.enable = true;
};
imports = [
./modules/batman.nix
];
}

@ -0,0 +1,21 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
ffnixModule = import ./.;
in {
overlay = final: prev: {
batman-adv-legacy = kernelPackages: kernelPackages.callPackage ./batman-adv-legacy.nix {};
batctl-legacy = final.callPackage ./batctl-legacy.nix {};
};
overlays = [ self.overlay ];
nixosModules.ffnix = ffnixModule;
nixosModule = ffnixModule;
};
}

@ -0,0 +1,20 @@
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.ffnix;
in
{
config = mkIf cfg.enable {
boot.kernelModules = [ "batman_adv" ];
boot.extraModulePackages = []
++ lib.optional (!cfg.batman-legacy) config.boot.kernelPackages.batman_adv
++ lib.optional cfg.batman-legacy (pkgs.batman-adv-legacy config.boot.kernelPackages);
environment.systemPackages = []
++ lib.optional (!cfg.batman-legacy) pkgs.batctl
++ lib.optional cfg.batman-legacy pkgs.batctl-legacy;
};
}
Loading…
Cancel
Save