add containers/freifunk

This commit is contained in:
Astro 2020-04-05 02:31:57 +02:00
parent 8c8ce01820
commit 202efe3a07
4 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,60 @@
{ config, pkgs, lib, ... }:
let
meshInterface = "bmx";
in {
imports = [
<nixpkgs/nixos/modules/profiles/minimal.nix>
<lib>
<lib/lxc-container.nix>
<lib/shared.nix>
];
c3d2 = {
isInHq = false;
enableHail = false;
};
networking.hostName = "freifunk";
networking.useNetworkd = true;
networking.nameservers = [ "172.20.73.8" "9.9.9.9" ];
# Required for krops
services.openssh.enable = true;
environment.systemPackages = with pkgs; [ git tcpdump ];
systemd.network.networks = {
"10-bmx" = {
enable = true;
matchConfig = { Name = meshInterface; };
networkConfig = {
Address = "10.200.0.15/16";
};
};
"20-core" = {
enable = true;
matchConfig = { Name = "core"; };
networkConfig = {
Address = "172.20.72.40/26";
Gateway = "172.20.72.7";
};
};
};
systemd.services.bmxd =
let
bmxd = import (toString <lib/pkgs/bmxd.nix>) { inherit pkgs; };
in {
after = [ "systemd-networkd.service" ];
wantedBy = [ "network.target" ];
serviceConfig = {
ExecStart = "${bmxd}/sbin/bmxd --no_fork 1 --throw-rules 0 --prio-rules 0 dev=${meshInterface} /linklayer 0";
Restart = "always";
};
};
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "20.03"; # Did you read the comment?
}

Binary file not shown.

View File

@ -29,4 +29,5 @@ let
in {
scrape = deployContainer "scrape" "172.20.73.32";
ledstripes = deployContainer "ledstripes" "172.22.99.168";
freifunk = deployContainer "freifunk" "172.20.72.40";
}

20
lib/pkgs/bmxd.nix Normal file
View File

@ -0,0 +1,20 @@
{ pkgs ? import <nixpkgs> {},
src ? builtins.fetchGit "https://gitlab.freifunk-dresden.de/firmware-developer/firmware.git",
}:
with pkgs;
let
path = "${src}/feeds/19.07/feeds-own/bmxd";
makefile = builtins.readFile "${path}/Makefile";
makeDef = name:
builtins.elemAt (builtins.match ".*?${name}:=([^\n]+).*?" makefile) 0;
name = makeDef "PKG_NAME";
version = makeDef "PKG_VERSION";
release = makeDef "PKG_RELEASE";
in stdenv.mkDerivation {
name = "${name}-${version}-${release}";
src = "${path}/sources";
installPhase = ''
make install SBINDIR=$out/sbin
'';
}