Introducing Nix Scheduler Hook: A Build Hook for Sending Builds to Job Schedulers
=================================================================================
I’ve recently written a program that can be used as a Nix build hook for submitting builds to job schedulers. Slurm through its REST API or native libraries and PBS are supported. It’s available at https://codeberg.com/lisanna/nix-scheduler-hook and in Nixpkgs as nix-scheduler-hook.
nix-scheduler-hook is very easy to use. After building it, a binary named nsh is available. Simply set build-hook to the path to this binary, and create a nsh.conf file in a Nix configuration directory containing your Slurm JWT token (slurm-jwt-token = <token>) and the API host of the endpoint running slurmrestd (slurm-api-host = <host>). Full usage details are available in the README.
Because it depends on a job scheduler for scheduling builds, the value of the Nix builders setting / your machines file is ignored when using it as your build hook. This means the nodes in the cluster must be configured to be accessible by hostname in your SSH configuration file rather than just your machines file. I hope to eventually add a feature where builds are forwarded on to the regular build hook in decline cases (such as system mismatch) rather than simply declining.
Bug reports and enhancement requests are welcome!