@@ 1,9 1,13 @@
-{ runCommand, writeScript, execline, cacert, nix }:
+{ runCommand, writeScript, runit, execline, cacert, nix }:
let
+ # Increase limit of open files. Default soft/hard limit of 1024/4096
+ # is not enough for really huge derivations, like one built in
+ # tutor-papers.
runscript = writeScript "nix-daemon.run" ''
#!${execline}/bin/execlineb -P
export SSL_CERT_FILE ${cacert}/etc/ssl/certs/ca-bundle.crt
export NIX_SSL_CERT_FILE ${cacert}/etc/ssl/certs/ca-bundle.crt
+ ${runit}/bin/chpst -o 16000
${nix}/bin/nix-daemon
'';
in runCommand "nix-daemon.sv" { inherit runscript; } ''