From 26bcbd3f86c9ef799c67b09b8273ec3bdf2fd766 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Mon, 14 Sep 2020 14:46:37 -0400 Subject: [PATCH] nixos: allow passing params to nodes --- modules/nodes.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/modules/nodes.nix b/modules/nodes.nix index ac4d30d0fa..c327253a24 100644 --- a/modules/nodes.nix +++ b/modules/nodes.nix @@ -84,6 +84,14 @@ in { Arguments to pass to the node. ''; }; + + params = mkOption { + type = types.attrsOf types.str; + default = {}; + description = '' + Key-value parameters to pass to the node. + ''; + }; }; config = mkMerge [ @@ -141,9 +149,11 @@ in { config = mkIf cfg.enable { systemd.services = mkMerge [ - (serviceGenerator (config: - escapeShellArgs ([ "${config.env}/bin/rosrun" config.package config.node ] ++ config.args) - ) cfg.nodes) + (serviceGenerator (config: escapeShellArgs ( + [ "${config.env}/bin/rosrun" config.package config.node ] ++ + (mapAttrsToList (n: v: "${n}:=${v}") config.params) ++ + config.args + )) cfg.nodes) (serviceGenerator (config: escapeShellArgs ( [ "${config.env}/bin/roslaunch" "--wait" ] ++ config.roslaunchArgs ++