Netconf-Module/default.nix
2024-04-06 23:56:42 +02:00

78 lines
1.4 KiB
Nix

{ pkgs ? (import <nixpkgs> {}) }:
let
moduleEX2300 = import ./moduleMaker.nix [
"ge-0/0/0"
"ge-0/0/1"
"ge-0/0/2"
"ge-0/0/3"
"ge-0/0/4"
"ge-0/0/5"
"ge-0/0/6"
"ge-0/0/7"
"ge-0/0/8"
"ge-0/0/9"
"ge-0/0/10"
"ge-0/0/11"
"ge-0/0/12"
"ge-0/0/13"
"ge-0/0/14"
"ge-0/0/15"
"ge-0/0/16"
"ge-0/0/17"
"ge-0/0/18"
"ge-0/0/19"
"ge-0/0/20"
"ge-0/0/21"
"ge-0/0/22"
"ge-0/0/23"
"ge-0/0/24"
"ge-0/0/25"
"ge-0/0/26"
"ge-0/0/27"
"ge-0/0/28"
"ge-0/0/29"
"ge-0/0/30"
"ge-0/0/31"
"ge-0/0/32"
"ge-0/0/33"
"ge-0/0/34"
"ge-0/0/35"
"ge-0/0/36"
"ge-0/0/37"
"ge-0/0/38"
"ge-0/0/39"
"ge-0/0/40"
"ge-0/0/41"
"ge-0/0/42"
"ge-0/0/43"
"ge-0/0/44"
"ge-0/0/45"
"ge-0/0/46"
"ge-0/0/47"
"ge-0/1/0"
"ge-0/1/1"
"ge-0/1/2"
"ge-0/1/3"
"xe-0/1/0"
"xe-0/1/1"
"xe-0/1/2"
"xe-0/1/3"
"me0"
];
evaluator = name: module_inst:
let cfg = pkgs.lib.evalModules {
specialArgs = { inherit pkgs name; };
modules = [
moduleEX2300
module_inst
];
};
in "ln -s ${cfg.config.deployement.cmd} $out/${name}";
hive = import ./netconf-hive.nix;
cmds = builtins.attrValues (builtins.mapAttrs evaluator hive);
in
pkgs.runCommand "netconf-deploy" {}
(builtins.concatStringsSep "\n" ([ "mkdir $out" ] ++ cmds))