nix-config/modules/scripts/ptest.nix

43 lines
747 B
Nix
Raw Normal View History

{ 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.system (psArgs: psArgs.config.packages.${name}))
];
};
}