Skip to content

Commit

Permalink
Merge pull request #1161 from cachix/process-compose-settings
Browse files Browse the repository at this point in the history
process: fix process-compose settings and other process managers
  • Loading branch information
domenkozar authored Oct 7, 2024
2 parents 35adc63 + ce335f1 commit fed89ff
Show file tree
Hide file tree
Showing 13 changed files with 360 additions and 328 deletions.
204 changes: 83 additions & 121 deletions docs/reference/options.md

Large diffs are not rendered by default.

25 changes: 1 addition & 24 deletions docs/supported-process-managers/hivemind.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,7 @@

[comment]: # (Please add your documentation on top of this line)

## process-managers\.hivemind\.enable

Whether to enable hivemind as process-manager\.



*Type:*
boolean



*Default:*
` false `



*Example:*
` true `



## process-managers\.hivemind\.package


## process\.managers\.hivemind\.package

The hivemind package to use\.

Expand Down
25 changes: 1 addition & 24 deletions docs/supported-process-managers/honcho.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,7 @@

[comment]: # (Please add your documentation on top of this line)

## process-managers\.honcho\.enable

Whether to enable honcho as process-manager\.



*Type:*
boolean



*Default:*
` false `



*Example:*
` true `



## process-managers\.honcho\.package


## process\.managers\.honcho\.package

The honcho package to use\.

Expand Down
25 changes: 1 addition & 24 deletions docs/supported-process-managers/overmind.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,7 @@

[comment]: # (Please add your documentation on top of this line)

## process-managers\.overmind\.enable

Whether to enable overmind as process-manager\.



*Type:*
boolean



*Default:*
` false `



*Example:*
` true `



## process-managers\.overmind\.package


## process\.managers\.overmind\.package

The overmind package to use\.

Expand Down
84 changes: 70 additions & 14 deletions docs/supported-process-managers/process-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,47 @@

[comment]: # (Please add your documentation on top of this line)

## process-managers\.process-compose\.enable
## process\.managers\.process-compose\.package

Whether to enable process-compose as process-manager\.
The process-compose package to use\.



*Type:*
boolean
package



*Default:*
` false `


` pkgs.process-compose `

*Example:*
` true `


## process\.managers\.process-compose\.port

## process-managers\.process-compose\.package


The port to bind the process-compose server to\.

The process-compose package to use\.
Not used when ` unixSocket.enable ` is true\.



*Type:*
package
signed integer



*Default:*
` pkgs.process-compose `
` 8080 `



## process-managers\.process-compose\.settings
## process\.managers\.process-compose\.settings



process-compose\.yaml specific process attributes\.
Top-level process-compose\.yaml options

Example: https://github\.com/F1bonacc1/process-compose/blob/main/process-compose\.yaml\`

Expand Down Expand Up @@ -81,3 +78,62 @@ YAML value
];
}
```



## process\.managers\.process-compose\.tui\.enable



Enable the TUI (Terminal User Interface)



*Type:*
boolean



*Default:*
` true `



## process\.managers\.process-compose\.unixSocket\.enable



Whether to enable running the process-compose server over unix domain sockets instead of tcp\.



*Type:*
boolean



*Default:*
` true `



*Example:*
` true `



## process\.managers\.process-compose\.unixSocket\.path



Override the path to the unix socket\.



*Type:*
string



*Default:*
` ${config.devenv.runtime}/pc.sock `
73 changes: 36 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,62 +109,61 @@
inherit (pkgs) lib;
languageOptions = builtins.mapAttrs (key: _: generateKeyOptions key) evaluatedModules.config.languages;
serviceOptions = builtins.mapAttrs (key: _: generateKeyOptions key) evaluatedModules.config.services;
processManagersOptions = builtins.mapAttrs (key: _: generateKeyOptions key) evaluatedModules.config.process-managers;
processManagersOptions = builtins.mapAttrs (key: _: generateKeyOptions key) evaluatedModules.config.process.managers;
processedOptions = option: builtins.mapAttrs (key: options: optionsDocs options) option;
in
pkgs.stdenv.mkDerivation {
name = "generate-individual-docs";
src = ./docs/individual-docs;
buildPhase = ''
languageDir=./languages
serviceDir=./services
processManagerDir=./process-managers
mkdir -p $out/docs/individual-docs/supported-languages
mkdir -p $out/docs/individual-docs/supported-services
mkdir -p $out/docs/individual-docs/supported-process-managers
AUTOGEN_NOTICE="[comment]: # (Do not edit this file as it is autogenerated. Go to docs/individual-docs if you want to make edits.)"
languageDir=./languages
serviceDir=./services
processManagerDir=./process-managers
mkdir -p $out/docs/individual-docs/supported-languages
mkdir -p $out/docs/individual-docs/supported-services
mkdir -p $out/docs/individual-docs/supported-process-managers
AUTOGEN_NOTICE="[comment]: # (Do not edit this file as it is autogenerated. Go to docs/individual-docs if you want to make edits.)"
${lib.concatStringsSep "\n" (lib.mapAttrsToList (key: options: ''
content=$(cat ${options.optionsCommonMark})
file=$languageDir/${key}.md
${lib.concatStringsSep "\n" (lib.mapAttrsToList (key: options: ''
content=$(cat ${options.optionsCommonMark})
file=$languageDir/${key}.md
sed -i "1i$AUTOGEN_NOTICE" "$file"
substituteInPlace $file \
--subst-var-by \
AUTOGEN_OPTIONS \
"$content"
sed -i "1i$AUTOGEN_NOTICE" "$file"
substituteInPlace $file \
--subst-var-by \
AUTOGEN_OPTIONS \
"$content"
cp $file $out/docs/individual-docs/supported-languages/${key}.md
cp $file $out/docs/individual-docs/supported-languages/${key}.md
'') ( processedOptions languageOptions ))}
'') ( processedOptions languageOptions ))}
${lib.concatStringsSep "\n" (lib.mapAttrsToList (key: options: ''
content=$(cat ${options.optionsCommonMark})
file=$serviceDir/${key}.md
content=$(cat ${options.optionsCommonMark})
file=$serviceDir/${key}.md
sed -i "1i$AUTOGEN_NOTICE" "$file"
substituteInPlace $file \
--subst-var-by \
AUTOGEN_OPTIONS \
"$content"
sed -i "1i$AUTOGEN_NOTICE" "$file"
substituteInPlace $file \
--subst-var-by \
AUTOGEN_OPTIONS \
"$content"
cp $file $out/docs/individual-docs/supported-services/${key}.md
cp $file $out/docs/individual-docs/supported-services/${key}.md
'') ( processedOptions serviceOptions ))}
'') ( processedOptions serviceOptions ))}
${lib.concatStringsSep "\n" (lib.mapAttrsToList (key: options: ''
content=$(cat ${options.optionsCommonMark})
file=$processManagerDir/${key}.md
sed -i "1i$AUTOGEN_NOTICE" "$file"
substituteInPlace $file \
--subst-var-by \
AUTOGEN_OPTIONS \
"$content"
content=$(cat ${options.optionsCommonMark})
file=$processManagerDir/${key}.md
cp $file $out/docs/individual-docs/supported-process-managers/${key}.md
'') ( processedOptions processManagersOptions))}
sed -i "1i$AUTOGEN_NOTICE" "$file"
substituteInPlace $file \
--subst-var-by \
AUTOGEN_OPTIONS \
"$content"
cp $file $out/docs/individual-docs/supported-process-managers/${key}.md
'') ( processedOptions processManagersOptions))}
'';
};
});
Expand Down
4 changes: 2 additions & 2 deletions src/modules/integrations/hostctl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ in
};

config = lib.mkIf (hostContent != "") {
process.before = ''
process.manager.before = ''
if [[ ! -f "$DEVENV_STATE/hostctl" || "$(cat "$DEVENV_STATE/hostctl")" != "${hostHash}" ]]; then
sudo ${pkgs.hostctl}/bin/hostctl replace ${config.hostsProfileName} --from ${file}
mkdir -p "$DEVENV_STATE"
echo "${hostHash}" > "$DEVENV_STATE/hostctl"
fi
'';

process.after = ''
process.manager.after = ''
rm -f "$DEVENV_STATE/hostctl"
sudo ${pkgs.hostctl}/bin/hostctl remove ${config.hostsProfileName}
'';
Expand Down
2 changes: 1 addition & 1 deletion src/modules/integrations/mkcert.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ in
};

config = lib.mkIf (domainList != "") {
process.before = ''
process.manager.before = ''
mkdir -p "${config.env.DEVENV_STATE}/mkcert"
if [[ ! -f "$DEVENV_STATE/mkcert/rootCA.pem" ]]; then
Expand Down
20 changes: 15 additions & 5 deletions src/modules/process-managers/hivemind.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
{ pkgs, config, lib, ... }:
let
cfg = config.process-managers.hivemind;
cfg = config.process.managers.hivemind;
in
{
options.process-managers.hivemind = {
enable = lib.mkEnableOption "hivemind as process-manager";
options.process.managers.hivemind = {
enable = lib.mkEnableOption "hivemind as the process manager" // {
internal = true;
};

package = lib.mkOption {
type = lib.types.package;
default = pkgs.hivemind;
defaultText = lib.literalExpression "pkgs.hivemind";
description = "The hivemind package to use.";
};
};

config = lib.mkIf cfg.enable {
processManagerCommand = ''
${cfg.package}/bin/hivemind --print-timestamps "$@" ${config.procfile} &
process.manager.args = {
"print-timestamps" = true;
};

process.manager.command = lib.mkDefault ''
${cfg.package}/bin/hivemind \
${lib.cli.toGNUCommandLineShell {} config.process.manager.args} \
"$@" ${config.procfile} &
'';

packages = [ cfg.package ];
Expand Down
Loading

0 comments on commit fed89ff

Please sign in to comment.