mirror of
https://github.com/Platonic-Systems/process-compose-flake.git
synced 2024-09-11 14:07:00 +03:00
Allow 'environment' to be attrset
This commit is contained in:
parent
7f624ce916
commit
c837b8851f
@ -19,11 +19,11 @@
|
||||
# This adds a `self.packages.default`
|
||||
process-compose."default" = {
|
||||
settings = {
|
||||
environment = [
|
||||
"DATAFILE=data.sqlite"
|
||||
];
|
||||
processes = {
|
||||
environment = {
|
||||
DATAFILE = "data.sqlite";
|
||||
};
|
||||
|
||||
processes = {
|
||||
# Print a pony every 2 seconds, because why not.
|
||||
ponysay.command = ''
|
||||
while true; do
|
||||
|
@ -1,6 +1,20 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
inherit (types) nullOr either listOf str attrsOf;
|
||||
in
|
||||
lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.listOf lib.types.str);
|
||||
type =
|
||||
nullOr
|
||||
(either (listOf str) (attrsOf str));
|
||||
default = null;
|
||||
example = [ "ABC=2221" "PRINT_ERR=111" ];
|
||||
example = { ABC="2221"; PRINT_ERR="111"; };
|
||||
description = ''
|
||||
Attrset of environment variables.
|
||||
|
||||
List of strings is also allowed.
|
||||
'';
|
||||
apply = attrs:
|
||||
if ! builtins.isAttrs attrs then attrs else
|
||||
lib.mapAttrsToList (name: value: "${name}=${value}") attrs;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user