From 0bba8ae24b96beb51a82297f86cf571069c909a8 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 09:59:41 -0400 Subject: [PATCH 01/13] Remove `cli.up` module Renme `cli.global` to `cli.options`. We only support setting global options. --- CHANGELOG.md | 2 +- example/flake.nix | 7 +-- nix/process-compose/cli-options.nix | 88 ++++------------------------- nix/process-compose/default.nix | 9 +-- 4 files changed, 14 insertions(+), 92 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2beafab..9eb7f6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased - New features - - #81: Complete support for specifying process-compose CLI options (global and `up` subcommand arguments) + - #81: Support for specifying process-compose global CLI options - **Breaking change**: Old options `httpServer` and `tui` were removed; users should use the new `cli` module to set all process-compose cli arguments and options. - ~~#18: Add `testScript` option for adding flake checks based on nixosTest library.~~ - #39: Allow `test` process to act as a test, which then gets run as part of flake checks. diff --git a/example/flake.nix b/example/flake.nix index 59a1424..251a41f 100644 --- a/example/flake.nix +++ b/example/flake.nix @@ -25,14 +25,9 @@ { cli = { # Global options for `process-compose` - global = { + options = { no-server = true; }; - # Options for `process-compose up` - up = { - disable-dotenv = true; - theme = "Cobalt"; - }; }; settings = { environment = { diff --git a/nix/process-compose/cli-options.nix b/nix/process-compose/cli-options.nix index 0ba1d5d..edc3a3b 100644 --- a/nix/process-compose/cli-options.nix +++ b/nix/process-compose/cli-options.nix @@ -5,7 +5,7 @@ in { options = { cli = { - global = { + options = { log-file = mkOption { type = types.nullOr types.str; default = null; @@ -35,88 +35,20 @@ in default = false; }; }; - up = { - detached = mkOption { - type = types.bool; - default = false; - }; - disable-dotenv = mkOption { - type = types.bool; - default = false; - }; - env = mkOption { - type = types.listOf types.str; - default = [ ]; - }; - hide-disabled = mkOption { - type = types.bool; - default = false; - }; - keep-project = mkOption { - type = types.bool; - default = false; - }; - namespace = mkOption { - type = types.listOf types.str; - default = [ ]; - }; - no-deps = mkOption { - type = types.bool; - default = false; - }; - ref-rate = mkOption { - type = types.nullOr types.str; - default = null; - }; - reverse = mkOption { - type = types.bool; - default = false; - }; - sort = mkOption { - type = types.nullOr types.str; - default = null; - }; - theme = mkOption { - type = types.nullOr types.str; - default = null; - }; - tui = mkOption { - type = types.bool; - default = true; - }; - }; # The final CLI arguments we will pass to process-compose binary. outputs = { # TODO: We should refactor this to generically iterate on options and produce the CLI automatically using naming conventions and types. - global = lib.mkOption { - type = types.str; - default = let global = config.cli.global; in lib.escapeShellArgs ( - (lib.optionals (global.log-file != null) [ "--log-file" global.log-file ]) - ++ (lib.optionals global.no-server [ "--no-server" ]) - ++ (lib.optionals global.ordered-shutdown [ "--ordered-shutdown" ]) - ++ (lib.optionals (global.port != null) [ "--port" "${builtins.toString global.port}" ]) - ++ (lib.optionals global.read-only [ "--read-only" ]) - ++ (lib.optionals (global.unix-socket != null) [ "--unix-socket" global.unix-socket ]) - ++ (lib.optionals global.use-uds [ "--use-uds" ]) - ); - }; - up = lib.mkOption { + options = lib.mkOption { type = types.str; - default = let up = config.cli.up; in lib.escapeShellArgs ( - (lib.optionals up.detached [ "--detached" ]) - ++ (lib.optionals up.disable-dotenv [ "--disable-dotenv" ]) - ++ (lib.concatMap (v: [ "--env" v ]) up.env) - ++ (lib.optionals up.hide-disabled [ "--hide-disabled" ]) - ++ (lib.optionals up.keep-project [ "--keep-project" ]) - ++ (lib.concatMap (v: [ "--namespace" v ]) up.namespace) - ++ (lib.optionals up.no-deps [ "--no-deps" ]) - ++ (lib.optionals (up.ref-rate != null) [ "--ref-rate" up.ref-rate ]) - ++ (lib.optionals up.reverse [ "--reverse" ]) - ++ (lib.optionals (up.sort != null) [ "--sort" up.sort ]) - ++ (lib.optionals (up.theme != null) [ "--theme" up.theme ]) - ++ (lib.optionals up.reverse [ "--reverse" ]) - ++ (lib.optionals (!up.tui) [ "--tui=false" ]) + default = let o = config.cli.options; in lib.escapeShellArgs ( + (lib.optionals (o.log-file != null) [ "--log-file" o.log-file ]) + ++ (lib.optionals o.no-server [ "--no-server" ]) + ++ (lib.optionals o.ordered-shutdown [ "--ordered-shutdown" ]) + ++ (lib.optionals (o.port != null) [ "--port" "${builtins.toString o.port}" ]) + ++ (lib.optionals o.read-only [ "--read-only" ]) + ++ (lib.optionals (o.unix-socket != null) [ "--unix-socket" o.unix-socket ]) + ++ (lib.optionals o.use-uds [ "--use-uds" ]) ); }; }; diff --git a/nix/process-compose/default.nix b/nix/process-compose/default.nix index e0b790e..8934841 100644 --- a/nix/process-compose/default.nix +++ b/nix/process-compose/default.nix @@ -46,15 +46,10 @@ in ${preHook} run-process-compose () { - set -x; process-compose ${cliOutputs.global} --config ${configFile} "$@"; set +x + set -x; process-compose ${cliOutputs.options} --config ${configFile} "$@"; set +x } - # Run `up` command, with arguments; unless the user wants to pass their own subcommand. - if [ "$#" -eq 0 ]; then - run-process-compose up ${cliOutputs.up} - else - run-process-compose "$@" - fi + run-process-compose "$@" ${postHook} ''; From f6d3b58d42695e304085ac4d4ce34f46c578b69a Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 10:02:19 -0400 Subject: [PATCH 02/13] Add option description to cli.options --- nix/process-compose/cli-options.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nix/process-compose/cli-options.nix b/nix/process-compose/cli-options.nix index edc3a3b..2efea78 100644 --- a/nix/process-compose/cli-options.nix +++ b/nix/process-compose/cli-options.nix @@ -9,30 +9,37 @@ in log-file = mkOption { type = types.nullOr types.str; default = null; + description = "Pass --log-file to process-compose"; }; no-server = mkOption { type = types.bool; default = false; + description = "Pass --no-server to process-compose"; }; ordered-shutdown = mkOption { type = types.bool; default = false; + description = "Pass --ordered-shutdown to process-compose"; }; port = mkOption { type = types.nullOr types.int; default = null; + description = "Pass --port to process-compose"; }; read-only = mkOption { type = types.bool; default = false; + description = "Pass --read-only to process-compose"; }; unix-socket = mkOption { type = types.nullOr types.str; default = null; + description = "Pass --unix-socket to process-compose"; }; use-uds = mkOption { type = types.bool; default = false; + description = "Pass --use-uds to process-compose"; }; }; From 7221333ef9d9d9d7239f0376f9b803b02b53d4e3 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 10:09:47 -0400 Subject: [PATCH 03/13] Use types.submodule so we can add description to these options --- nix/process-compose/cli-options.nix | 77 ++++++++++++++++------------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/nix/process-compose/cli-options.nix b/nix/process-compose/cli-options.nix index 2efea78..9972206 100644 --- a/nix/process-compose/cli-options.nix +++ b/nix/process-compose/cli-options.nix @@ -5,41 +5,47 @@ in { options = { cli = { - options = { - log-file = mkOption { - type = types.nullOr types.str; - default = null; - description = "Pass --log-file to process-compose"; - }; - no-server = mkOption { - type = types.bool; - default = false; - description = "Pass --no-server to process-compose"; - }; - ordered-shutdown = mkOption { - type = types.bool; - default = false; - description = "Pass --ordered-shutdown to process-compose"; - }; - port = mkOption { - type = types.nullOr types.int; - default = null; - description = "Pass --port to process-compose"; - }; - read-only = mkOption { - type = types.bool; - default = false; - description = "Pass --read-only to process-compose"; - }; - unix-socket = mkOption { - type = types.nullOr types.str; - default = null; - description = "Pass --unix-socket to process-compose"; - }; - use-uds = mkOption { - type = types.bool; - default = false; - description = "Pass --use-uds to process-compose"; + options = mkOption { + description = "CLI options to pass to process-compose binary"; + default = { }; + type = types.submodule { + options = { + log-file = mkOption { + type = types.nullOr types.str; + default = null; + description = "Pass --log-file to process-compose"; + }; + no-server = mkOption { + type = types.bool; + default = false; + description = "Pass --no-server to process-compose"; + }; + ordered-shutdown = mkOption { + type = types.bool; + default = false; + description = "Pass --ordered-shutdown to process-compose"; + }; + port = mkOption { + type = types.nullOr types.int; + default = null; + description = "Pass --port to process-compose"; + }; + read-only = mkOption { + type = types.bool; + default = false; + description = "Pass --read-only to process-compose"; + }; + unix-socket = mkOption { + type = types.nullOr types.str; + default = null; + description = "Pass --unix-socket to process-compose"; + }; + use-uds = mkOption { + type = types.bool; + default = false; + description = "Pass --use-uds to process-compose"; + }; + }; }; }; @@ -48,6 +54,7 @@ in # TODO: We should refactor this to generically iterate on options and produce the CLI automatically using naming conventions and types. options = lib.mkOption { type = types.str; + description = "The final CLI arguments we will pass to process-compose binary."; default = let o = config.cli.options; in lib.escapeShellArgs ( (lib.optionals (o.log-file != null) [ "--log-file" o.log-file ]) ++ (lib.optionals o.no-server [ "--no-server" ]) From d1906a4cf29353d62ef788e37fbffba98a634192 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 10:10:02 -0400 Subject: [PATCH 04/13] cli.oputputs.* should be readonly --- nix/process-compose/cli-options.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/process-compose/cli-options.nix b/nix/process-compose/cli-options.nix index 9972206..3279c29 100644 --- a/nix/process-compose/cli-options.nix +++ b/nix/process-compose/cli-options.nix @@ -54,6 +54,7 @@ in # TODO: We should refactor this to generically iterate on options and produce the CLI automatically using naming conventions and types. options = lib.mkOption { type = types.str; + readOnly = true; description = "The final CLI arguments we will pass to process-compose binary."; default = let o = config.cli.options; in lib.escapeShellArgs ( (lib.optionals (o.log-file != null) [ "--log-file" o.log-file ]) From 014bfa105dc79e3f94d4abf7d40b43077d73e237 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 10:12:21 -0400 Subject: [PATCH 05/13] ci: Do flake-parts linkcheck --- .github/workflows/ci.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a3219d9..d970dc7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,7 +5,7 @@ on: - main pull_request: jobs: - checks: + build: runs-on: ${{ matrix.os }} strategy: matrix: @@ -16,3 +16,9 @@ jobs: - name: Install omnix run: nix --accept-flake-config profile install "github:juspay/omnix" - run: om ci + flake-parts-linkCheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - run: nix build github:hercules-ci/flake.parts-website#checks.x86_64-linux.linkcheck --override-input process-compose-flake . From dd67ac41e221bb94ad07da478a525b230261c4df Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 10:16:02 -0400 Subject: [PATCH 06/13] preHook and postHook actually belong in 'cli' --- CHANGELOG.md | 6 ++++-- nix/process-compose/cli-options.nix | 10 ++++++++++ nix/process-compose/cli.nix | 20 -------------------- nix/process-compose/default.nix | 5 ++--- 4 files changed, 16 insertions(+), 25 deletions(-) delete mode 100644 nix/process-compose/cli.nix diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eb7f6e..da2ee38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,10 @@ ## Unreleased - New features - - #81: Support for specifying process-compose global CLI options - - **Breaking change**: Old options `httpServer` and `tui` were removed; users should use the new `cli` module to set all process-compose cli arguments and options. + - #81, #84: Support for specifying process-compose global CLI options + - **Breaking changes**: + - `preHook` and `postHook` are now inside `cli` module. + - Old options `httpServer` and `tui` were removed; users should use the new `cli` module to set all process-compose cli arguments and options. - ~~#18: Add `testScript` option for adding flake checks based on nixosTest library.~~ - #39: Allow `test` process to act as a test, which then gets run as part of flake checks. - #55: Add `lib` flake output - library of useful functions diff --git a/nix/process-compose/cli-options.nix b/nix/process-compose/cli-options.nix index 3279c29..8133c3a 100644 --- a/nix/process-compose/cli-options.nix +++ b/nix/process-compose/cli-options.nix @@ -5,6 +5,16 @@ in { options = { cli = { + preHook = mkOption { + type = types.lines; + default = ""; + description = "Shell commands to run before process-compose starts."; + }; + postHook = mkOption { + type = types.lines; + default = ""; + description = "Shell commands to run after process-compose completes."; + }; options = mkOption { description = "CLI options to pass to process-compose binary"; default = { }; diff --git a/nix/process-compose/cli.nix b/nix/process-compose/cli.nix deleted file mode 100644 index c2a44d8..0000000 --- a/nix/process-compose/cli.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ lib, ... }: - -let - inherit (lib) types mkOption; -in -{ - options = - { - preHook = mkOption { - type = types.lines; - default = ""; - description = "Shell commands to run before process-compose starts."; - }; - postHook = mkOption { - type = types.lines; - default = ""; - description = "Shell commands to run after process-compose completes."; - }; - }; -} diff --git a/nix/process-compose/default.nix b/nix/process-compose/default.nix index 8934841..f2e0160 100644 --- a/nix/process-compose/default.nix +++ b/nix/process-compose/default.nix @@ -5,7 +5,6 @@ let in { imports = [ - ./cli.nix ./cli-options.nix ./settings ./test.nix @@ -60,7 +59,7 @@ in mkProcessComposeWrapper { inherit name; - inherit (config) preHook postHook; + inherit (config.cli) preHook postHook; cliOutputs = config.cli.outputs; configFile = config.outputs.settingsFile; }; @@ -71,7 +70,7 @@ in mkProcessComposeWrapper { name = "${name}-test"; - inherit (config) preHook postHook; + inherit (config.cli) preHook postHook; cliOutputs = config.cli.outputs; configFile = config.outputs.settingsTestFile; } From fb01664c1544c44808a0ffc9b2a2ed210719ae60 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 10:16:46 -0400 Subject: [PATCH 07/13] refactor: Rename in accordance with semantics --- nix/process-compose/{cli-options.nix => cli.nix} | 0 nix/process-compose/default.nix | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename nix/process-compose/{cli-options.nix => cli.nix} (100%) diff --git a/nix/process-compose/cli-options.nix b/nix/process-compose/cli.nix similarity index 100% rename from nix/process-compose/cli-options.nix rename to nix/process-compose/cli.nix diff --git a/nix/process-compose/default.nix b/nix/process-compose/default.nix index f2e0160..343a757 100644 --- a/nix/process-compose/default.nix +++ b/nix/process-compose/default.nix @@ -5,7 +5,7 @@ let in { imports = [ - ./cli-options.nix + ./cli.nix ./settings ./test.nix ]; From 9148cf5e41d9ab5a2640b7711ed6fdb549793f8e Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 13:12:18 -0400 Subject: [PATCH 08/13] Add cli.environment.PC_DISABLE_TUI --- CHANGELOG.md | 4 ++-- example/flake.nix | 1 + nix/process-compose/cli.nix | 24 ++++++++++++++++++++++++ nix/process-compose/default.nix | 4 +++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da2ee38..ace0d4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - #81, #84: Support for specifying process-compose global CLI options - **Breaking changes**: - `preHook` and `postHook` are now inside `cli` module. - - Old options `httpServer` and `tui` were removed; users should use the new `cli` module to set all process-compose cli arguments and options. + - Old options `httpServer` and `tui` were removed; users should use the new `cli` module to set all process-compose cli global options. TUI can be disabled using `cli.environment.PC_DISABLE_TUI = true;` - ~~#18: Add `testScript` option for adding flake checks based on nixosTest library.~~ - #39: Allow `test` process to act as a test, which then gets run as part of flake checks. - #55: Add `lib` flake output - library of useful functions @@ -14,7 +14,7 @@ - New options - #52: Add `is_foreground` option - ~~#54: Add `apiServer` option to control REST API server~~ - - $60: Add `httpServer.{enable, port, uds}` options to control the HTTP server. + - ~~$60: Add `httpServer.{enable, port, uds}` options to control the HTTP server.~~ - #56: Add `preHook` and `postHook` for running commands before and after launching process-compose respectively. - #67: Add `ready_log_line` - #226: Add `availability.exit_on_skipped` diff --git a/example/flake.nix b/example/flake.nix index 251a41f..396330d 100644 --- a/example/flake.nix +++ b/example/flake.nix @@ -24,6 +24,7 @@ in { cli = { + # environment.PC_DISABLE_TUI = true; # Global options for `process-compose` options = { no-server = true; diff --git a/nix/process-compose/cli.nix b/nix/process-compose/cli.nix index 8133c3a..a393b84 100644 --- a/nix/process-compose/cli.nix +++ b/nix/process-compose/cli.nix @@ -15,6 +15,19 @@ in default = ""; description = "Shell commands to run after process-compose completes."; }; + environment = mkOption { + default = { }; + description = "Environment variables to pass to process-compose binary."; + type = types.submodule { + options = { + PC_DISABLE_TUI = mkOption { + type = types.nullOr types.bool; + default = null; + description = "Disable the TUI (Text User Interface) of process-compose"; + }; + }; + }; + }; options = mkOption { description = "CLI options to pass to process-compose binary"; default = { }; @@ -76,6 +89,17 @@ in ++ (lib.optionals o.use-uds [ "--use-uds" ]) ); }; + + environment = lib.mkOption { + type = types.str; + description = "Shell script prefix setting environment variables"; + readOnly = true; + default = + lib.concatStringsSep " " (lib.mapAttrsToList + (name: value: + if value == null then "" else "${name}=${builtins.toJSON value}") + config.cli.environment); + }; }; }; }; diff --git a/nix/process-compose/default.nix b/nix/process-compose/default.nix index 343a757..6df3db5 100644 --- a/nix/process-compose/default.nix +++ b/nix/process-compose/default.nix @@ -45,7 +45,9 @@ in ${preHook} run-process-compose () { - set -x; process-compose ${cliOutputs.options} --config ${configFile} "$@"; set +x + set -x + ${cliOutputs.environment} process-compose ${cliOutputs.options} --config ${configFile} "$@" + set +x } run-process-compose "$@" From cc5c2ed17aeba0f93c962b30992cb5cec3748a5e Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 13:34:23 -0400 Subject: [PATCH 09/13] refactor: simplify mkProcessComposeWrapper args --- nix/process-compose/default.nix | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/nix/process-compose/default.nix b/nix/process-compose/default.nix index 6df3db5..eb96d7c 100644 --- a/nix/process-compose/default.nix +++ b/nix/process-compose/default.nix @@ -37,22 +37,22 @@ in config.outputs = let - mkProcessComposeWrapper = { name, cliOutputs, configFile, preHook, postHook, }: + mkProcessComposeWrapper = { name, configFile }: pkgs.writeShellApplication { inherit name; runtimeInputs = [ config.package ]; text = '' - ${preHook} + ${config.cli.preHook} run-process-compose () { set -x - ${cliOutputs.environment} process-compose ${cliOutputs.options} --config ${configFile} "$@" + ${config.cli.outputs.environment} process-compose ${config.cli.outputs.options} --config ${configFile} "$@" set +x } run-process-compose "$@" - ${postHook} + ${config.cli.postHook} ''; }; in @@ -61,19 +61,13 @@ in mkProcessComposeWrapper { inherit name; - inherit (config.cli) preHook postHook; - cliOutputs = config.cli.outputs; configFile = config.outputs.settingsFile; }; testPackage = - if - (builtins.hasAttr "test" config.settings.processes) - then + if (builtins.hasAttr "test" config.settings.processes) then mkProcessComposeWrapper { name = "${name}-test"; - inherit (config.cli) preHook postHook; - cliOutputs = config.cli.outputs; configFile = config.outputs.settingsTestFile; } else null; From e4cd7b0830600e16409c853fe4cf1a3979ddb9fe Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 13:37:36 -0400 Subject: [PATCH 10/13] Set unique name for test config file --- nix/process-compose/settings/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nix/process-compose/settings/default.nix b/nix/process-compose/settings/default.nix index 65f6bf3..4230e02 100644 --- a/nix/process-compose/settings/default.nix +++ b/nix/process-compose/settings/default.nix @@ -126,15 +126,15 @@ in # evaluate it again and to get rid of it. in lib.pipe attrs [ f f ]; - toPCJson = attrs: + toPCJson = name: attrs: pkgs.writeTextFile { name = "process-compose-${name}.json"; text = builtins.toJSON attrs; }; in { - settingsFile = toPCJson (removeNullAndEmptyAttrs config.settings); - settingsTestFile = toPCJson (removeNullAndEmptyAttrs + settingsFile = toPCJson name (removeNullAndEmptyAttrs config.settings); + settingsTestFile = toPCJson "${name}-test" (removeNullAndEmptyAttrs (lib.updateManyAttrsByPath [ { path = [ "processes" "test" ]; @@ -144,4 +144,3 @@ in config.settings)); }; } - From 04f4cf447205c3e39c4713eadc3d35ef8b1f2499 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 13:37:46 -0400 Subject: [PATCH 11/13] just: Add ex-check And make 'just ex' accept args --- justfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 7a8a161..6ad6cdf 100644 --- a/justfile +++ b/justfile @@ -15,5 +15,9 @@ doc-static: nix build ./doc # Run example, using current process-compose -ex: - cd ./example && nix run --override-input process-compose-flake .. +ex *ARGS: + cd ./example && nix run --override-input process-compose-flake .. . -- {{ARGS}} + +# Run example's test +ex-check: + cd ./example && nix flake check -L --override-input process-compose-flake .. From 664a93612e32bcae16ab983541eabb89039d3f73 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 13:38:08 -0400 Subject: [PATCH 12/13] Use PC_CONFIG_FILES --- nix/process-compose/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/process-compose/default.nix b/nix/process-compose/default.nix index eb96d7c..3d61756 100644 --- a/nix/process-compose/default.nix +++ b/nix/process-compose/default.nix @@ -46,7 +46,7 @@ in run-process-compose () { set -x - ${config.cli.outputs.environment} process-compose ${config.cli.outputs.options} --config ${configFile} "$@" + ${config.cli.outputs.environment} PC_CONFIG_FILES=${configFile} process-compose ${config.cli.outputs.options} "$@" set +x } From dcb5ebe28ac992cac5f56b2b68a8ab4f39146600 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 21 Oct 2024 13:38:29 -0400 Subject: [PATCH 13/13] refactor --- nix/process-compose/default.nix | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/nix/process-compose/default.nix b/nix/process-compose/default.nix index 3d61756..0b37370 100644 --- a/nix/process-compose/default.nix +++ b/nix/process-compose/default.nix @@ -44,13 +44,9 @@ in text = '' ${config.cli.preHook} - run-process-compose () { - set -x - ${config.cli.outputs.environment} PC_CONFIG_FILES=${configFile} process-compose ${config.cli.outputs.options} "$@" - set +x - } - - run-process-compose "$@" + set -x + ${config.cli.outputs.environment} PC_CONFIG_FILES=${configFile} process-compose ${config.cli.outputs.options} "$@" + set +x ${config.cli.postHook} '';