From 528943263040c9f383361b1a37a3ee4db66412af Mon Sep 17 00:00:00 2001 From: Anthony Oleinik <48811365+antholeole@users.noreply.github.com> Date: Thu, 14 Mar 2024 01:59:47 -0700 Subject: Add support for other procfile runners (#5) * WIP * WIP * WIP * done * done * fix CI * fix CI * refactor: default to overmind in mkProcfileRunner * module: cleanup option docs * refactor: cleanup multi-test suite --------- Co-authored-by: seth --- module.nix | 50 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 15 deletions(-) (limited to 'module.nix') diff --git a/module.nix b/module.nix index cf243f9..8ea5cb0 100644 --- a/module.nix +++ b/module.nix @@ -11,6 +11,7 @@ self: { inherit (lib) literalExpression + literalMd mdDoc mkOption types @@ -20,6 +21,7 @@ self: { config, name, system, + pkgs, ... }: { options = { @@ -34,6 +36,17 @@ self: { ''; }; + procRunner = mkOption { + type = types.package; + default = pkgs.overmind; + defaultText = literalMd "pkgs.overmind"; + description = mdDoc '' + The Procfile runner to use. Officially supports: overmind, honcho. + If using an unsupported procRunner, the Procfile path will be passed as an argument to the procRunner. + ''; + example = literalExpression "pkgs.honcho"; + }; + package = mkOption { type = types.package; description = mdDoc "Final package containing runner for Procfile"; @@ -45,27 +58,34 @@ self: { package = self.lib.${system}.mkProcfileRunner { inherit name; procGroup = config.processes; + inherit (config) procRunner; }; }; }; in { options = { - perSystem = mkPerSystemOption ({system, ...}: { - options.procfiles = mkOption { - type = types.attrsOf (types.submoduleWith { - modules = [procfileSubmodule]; - specialArgs = {inherit system;}; - }); + perSystem = mkPerSystemOption ({ + system, + pkgs, + ... + }: { + options = { + procfiles = mkOption { + type = types.attrsOf (types.submoduleWith { + modules = [procfileSubmodule]; + specialArgs = {inherit system pkgs;}; + }); - default = {}; - description = mdDoc "Attribute set containing procfile declarations"; - example = literalExpression '' - { - daemons.processes = { - redis = lib.getExe' pkgs.redis "redis-server"; - }; - } - ''; + default = {}; + description = mdDoc "Attribute set containing procfile declarations"; + example = literalExpression '' + { + daemons.processes = { + redis = lib.getExe' pkgs.redis "redis-server"; + }; + } + ''; + }; }; }); }; -- cgit v1.2.3