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. Currently Slurm through its REST API is supported. It’s available at https://github.com/lisanna-dettwyler/nix-scheduler-hook, and currently needs to be built from source until I can get it added to Nixpkgs.

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.

It is currently in a very early stage of development, and thus there are a number of unresolved issues and missing features. For instance, requiredSystemFeatures is not yet supported, and the GC roots of the build results are not properly automatically cleaned up. However, it is in a basically usable state. Bug reports and enhancements are welcome!

· nix, hpc