Skip to content

Commit

Permalink
process-managers: move to process.managers
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo committed Sep 10, 2024
1 parent 0390d86 commit 4a3211c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 51 deletions.
73 changes: 36 additions & 37 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,62 +111,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/process-managers/hivemind.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ pkgs, config, lib, ... }:
let
cfg = config.process-managers.hivemind;
cfg = config.process.managers.hivemind;
in
{
options.process-managers.hivemind = {
options.process.managers.hivemind = {
enable = lib.mkEnableOption "hivemind as the process manager" // {
internal = true;
};
Expand Down
4 changes: 2 additions & 2 deletions src/modules/process-managers/honcho.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ pkgs, config, lib, ... }:
let
cfg = config.process-managers.honcho;
cfg = config.process.managers.honcho;
in
{
options.process-managers.honcho = {
options.process.managers.honcho = {
enable = lib.mkEnableOption "honcho as the process manager" // {
internal = true;
};
Expand Down
4 changes: 2 additions & 2 deletions src/modules/process-managers/overmind.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ pkgs, config, lib, ... }:
let
cfg = config.process-managers.overmind;
cfg = config.process.managers.overmind;
in
{
options.process-managers.overmind = {
options.process.managers.overmind = {
enable = lib.mkEnableOption "overmind as the process manager" // {
internal = true;
};
Expand Down
6 changes: 3 additions & 3 deletions src/modules/process-managers/process-compose.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{ pkgs, config, lib, ... }:
let
cfg = config.process-managers.process-compose;
cfg = config.process.managers.process-compose;
settingsFormat = pkgs.formats.yaml { };
in
{
options.process-managers.process-compose = {
options.process.managers.process-compose = {
enable = lib.mkEnableOption "process-compose as the process manager" // {
internal = true;
};
Expand Down Expand Up @@ -90,7 +90,7 @@ in

packages = [ cfg.package ];

process-managers.process-compose = {
process.managers.process-compose = {
configFile = lib.mkDefault (settingsFormat.generate "process-compose.yaml" cfg.settings);
settings = {
version = "0.5";
Expand Down
11 changes: 6 additions & 5 deletions src/modules/processes.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ let
};
});

supportedImplementations = builtins.attrNames options.process-managers;
supportedImplementations = builtins.attrNames options.process.managers;

implementation = config.process.manager.implementation;
envList =
Expand All @@ -45,9 +45,10 @@ in
imports =
(map (name: lib.mkRenamedOptionModule [ "process" name ] [ "process" "manager" name ]) [ "after" "before" "implementation" ])
++ [
(lib.mkRenamedOptionModule [ "process" "process-compose" "tui" ] [ "process-managers" "process-compose" "tui" "enable" ])
(lib.mkRenamedOptionModule [ "process" "process-compose" "unix-socket" ] [ "process-managers" "process-compose" "unixSocket" "path" ])
(lib.mkRenamedOptionModule [ "process" "process-compose" "tui" ] [ "process" "managers" "process-compose" "tui" "enable" ])
(lib.mkRenamedOptionModule [ "process" "process-compose" "unix-socket" ] [ "process" "managers" "process-compose" "unixSocket" "path" ])
(lib.mkRenamedOptionModule [ "processManagerCommand" ] [ "process" "manager" "command" ])
(lib.mkRenamedOptionModule [ "process-managers" ] [ "process" "managers" ])
];

options = {
Expand Down Expand Up @@ -122,7 +123,7 @@ in
let
enabledImplementations =
lib.pipe supportedImplementations [
(map (name: config.process-managers.${name}.enable))
(map (name: config.process.managers.${name}.enable))
(lib.filter lib.id)
];
in
Expand All @@ -132,7 +133,7 @@ in
'';
}];

process-managers.${implementation}.enable = lib.mkDefault true;
process.managers.${implementation}.enable = lib.mkDefault true;

procfile =
pkgs.writeText "procfile" (lib.concatStringsSep "\n"
Expand Down

0 comments on commit 4a3211c

Please sign in to comment.