DrSensor / modern-nix-templates

Modern nix flake templates that only use both fastest and leanest toolchains
BSD Zero Clause License
0 stars 0 forks source link

lib: add wrapper for watchexec #13

Open DrSensor opened 3 years ago

DrSensor commented 3 years ago

https://github.com/watchexec/watchexec

Usages

low-level
rec {
  packages.${name} = <deriv>;
  apps.${name} = watchExecApp packages.${name} "${flags}";
}
middle-level
rec {
  packages.${name} = <deriv>;
  apps.${name} = mkApp {
    drv = packages.${name};
    watchexec.enable = true;
    watchexec.files = [ ".go" ]; # also accept string with leading dot, regex string, and list of regex string or string with leading dot
    watchexec.clearscreen = true;
    watchexec.signals = [ "SIGHUP" "SIGKILL" ]; # or use attributes
  };
}
high-level
rec {
  packages.${name} = <deriv>;
  apps.${name} = runPackage packages.${name} {
    watch.enable = true; # file extensions will be inferred
    watch.clearscreen = true; # automatically infer `watch.enable=true`
    # all CAPS_LOCK attribute value will be inferred as environment variable
  };
}

Important ⚠