nixos: allow passing params to nodes

This commit is contained in:
Ben Wolsieffer 2020-09-14 14:46:37 -04:00
parent 5a3ba1fb0c
commit 26bcbd3f86

View file

@ -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 ++