nix-config/modules/scripts/ptest.nix
Oliver Davies d23ae4bdcf Fix evaluation warnings
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
2025-11-01 16:07:13 +00:00

42 lines
767 B
Nix

{ withSystem, ... }:
let
name = "ptest";
in
{
perSystem =
psArgs@{ pkgs, ... }:
with pkgs;
{
packages.${name} = writeShellApplication {
inherit name;
runtimeInputs = [
psArgs.config.packages.onchange
];
text = ''
command="phpunit"
args=("--colors")
bin="vendor/bin"
if [[ -x "$bin/pest" ]]; then
command="pest"
args=()
fi
onchange "**/*.php" \
"$bin/$command ''${args[*]} $*"
'';
};
};
flake.modules.homeManager.base =
{ pkgs, ... }:
{
home.packages = [
(withSystem pkgs.stdenv.hostPlatform.system (psArgs: psArgs.config.packages.${name}))
];
};
}