Reintroduce shell_command; resolves #19

Thus we are no longer dependent on global bash.
This commit is contained in:
Sridhar Ratnakumar 2023-06-13 13:41:24 -04:00
parent 65d7e4d302
commit 1fbcf33a9e
3 changed files with 25 additions and 12 deletions

View File

@ -2,7 +2,9 @@
## Unreleased
- Add `testScript` option for adding flake checks based on nixosTest library.
- #18: Add `testScript` option for adding flake checks based on nixosTest library.
- Fixes
- #19: Add pkgs.bash to process-compose's path, so a global bash is not required.
## 0.1.0 (Jun 12, 2023)

View File

@ -41,15 +41,29 @@ in
example = "./pc.log";
};
shell = {
shell_argument = mkOption {
type = types.str;
default = "-c";
example = "-c";
};
shell_command = mkOption {
type = types.str;
description = ''
The shell to use to run the process `command`s.
For reproducibility across systems, by default this uses
`pkgs.bash`.
'';
default = lib.getExe pkgs.bash;
};
};
version = mkOption {
type = types.nullOr types.str;
default = null;
example = "0.5";
};
# NOTE: We don't allow the `shell` option because it meaningless in
# lieu of our use of pkgs.writeShellApplication (see command.nix).
};
};
example =

View File

@ -17,12 +17,11 @@ in
};
outputs.check = mkOption {
type = types.nullOr types.package;
default = if config.testScript == null then null else
default = if config.testScript == null then null else
pkgs.nixosTest {
inherit (config) testScript;
name = "process-compose-${name}-test";
nodes.machine = {
environment.systemPackages = [ pkgs.bash ]; # process-compose requires it.
systemd.services.process-compose = {
enable = true;
wantedBy = [ "default.target" ];
@ -32,9 +31,7 @@ in
name = "process-compose-${name}";
text = ''
set -x
echo "Launching procese-compose on ${name} ..."
# make bash available to process-compose
export PATH=/run/current-system/sw/bin:$PATH
echo "Launching process-compose on ${name} ..."
${lib.getExe config.outputs.package} -t=false
'';
});
@ -42,6 +39,6 @@ in
};
};
};
};
};
};
}
}