api: consistently use 'outputs' submodule

This commit is contained in:
Sridhar Ratnakumar 2023-06-09 15:09:23 -04:00
parent 248d02a4ff
commit f2ec5b572a
3 changed files with 11 additions and 8 deletions

View File

@ -17,24 +17,27 @@ in
default = null;
description = "Enable or disable the TUI for the application.";
};
extraCliArgs =
outputs.upCommandArgs =
let
cliArgsAttr = {
port = "-p ${toString config.port}";
tui = "-t=${lib.boolToString config.tui}";
};
getCliArgs =
args =
lib.mapAttrsToList
(opt: arg: lib.optionalString (config.${opt} != null) arg)
cliArgsAttr;
in
mkOption {
type = types.str;
default = lib.concatStringsSep " " getCliArgs;
default = lib.concatStringsSep " " args;
internal = true;
readOnly = true;
description = ''
Extra command-line arguments to pass to process-compose.
Additional CLI arguments to pass to 'process-compose up'.
Note: `-f` option is always included, pointing to generated config.
And is thus not handled by this option.
'';
};
};

View File

@ -32,8 +32,8 @@ in
runtimeInputs = [ config.package ];
text = ''
process-compose up \
-f ${config.settingsYaml} \
${config.extraCliArgs} \
-f ${config.outputs.settingsYaml} \
${config.outputs.upCommandArgs} \
"$@"
'';
};

View File

@ -26,13 +26,13 @@ in
'';
};
settingsYaml = mkOption {
outputs.settingsYaml = mkOption {
type = types.attrsOf types.raw;
internal = true;
};
};
config.settingsYaml =
config.outputs.settingsYaml =
let
toYAMLFile =
attrs: