Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
parent
a74ee06ec3
commit
4f53f5de75
2 changed files with 69 additions and 15 deletions
|
@ -1,23 +1,35 @@
|
||||||
|
{ withSystem, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
name = "onchange";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
|
perSystem =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
with pkgs;
|
||||||
|
{
|
||||||
|
packages.${name} = writeShellApplication {
|
||||||
|
inherit name;
|
||||||
|
|
||||||
|
runtimeInputs = [
|
||||||
|
coreutils
|
||||||
|
entr
|
||||||
|
];
|
||||||
|
|
||||||
|
text = ''
|
||||||
|
PATTERN="$1"
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
find . -path "$PATTERN" -type f | entr -cs "$@"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
flake.modules.homeManager.base =
|
flake.modules.homeManager.base =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
home.packages = [
|
home.packages = [
|
||||||
(pkgs.writeShellApplication {
|
(withSystem pkgs.system (psArgs: psArgs.config.packages.${name}))
|
||||||
name = "onchange";
|
|
||||||
|
|
||||||
runtimeInputs = with pkgs; [
|
|
||||||
coreutils
|
|
||||||
entr
|
|
||||||
];
|
|
||||||
|
|
||||||
text = ''
|
|
||||||
PATTERN="$1"
|
|
||||||
shift 1
|
|
||||||
|
|
||||||
find . -path "$PATTERN" -type f | entr -cs "$@"
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
42
modules/scripts/ptest.nix
Normal file
42
modules/scripts/ptest.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{ 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}))
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue