From 1c863a84955d503920e87e229ba300a325c3b000 Mon Sep 17 00:00:00 2001 From: catvayor Date: Sat, 6 Apr 2024 14:36:37 +0200 Subject: [PATCH] ssh sending of the config --- configMaker.nix | 6 +++++- moduleMaker.nix | 52 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/configMaker.nix b/configMaker.nix index ded07fe..f818513 100644 --- a/configMaker.nix +++ b/configMaker.nix @@ -104,6 +104,10 @@ let module_inst = { "me0" ]; in (import ).evalModules { - modules = [ module module_inst ]; + specialArgs.pkgs = import {}; + modules = [ + module + module_inst + ]; } diff --git a/moduleMaker.nix b/moduleMaker.nix index bc9f59e..a6b5c8d 100644 --- a/moduleMaker.nix +++ b/moduleMaker.nix @@ -1,5 +1,5 @@ interfaces: -{ lib, config, ... }: +{ lib, pkgs, config, ... }: let cfg = config; in with lib; { options = { @@ -41,6 +41,7 @@ in with lib; { in types.listOf vlan_type; default = [ ]; }; + # TODO: use this option dhcp_trusted = mkOption { type = types.bool; default = false; @@ -147,18 +148,39 @@ in with lib; { '' else ""; - in [ '' - - ${builtins.concatStringsSep "\n" interface_xmls} - ${irb_intf} - - - - ${builtins.concatStringsSep "\n" rstps} - - - - ${builtins.concatStringsSep "\n" vlans} - '' vlan_trust_table - ]; + config = '' + + ${builtins.concatStringsSep "\n" interface_xmls} + ${irb_intf} + + + + ${builtins.concatStringsSep "\n" rstps} + + + + ${builtins.concatStringsSep "\n" vlans} + + ''; + rpc_requests = pkgs.writeText "config_rpc.xml" '' + + + + + ${config} + + + + + + + + + + + ''; + in pkgs.writeShellScript "deploy.sh" '' + ${pkgs.openssh}/bin/ssh jourdan01.dgn -p 830 -s netconf < ${rpc_requests} + '' + ; }