NixOS configuration for HPC cluster https://docs.hpc.informatik.hs-fulda.de/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
891 B

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. { pkgs, config, ... }:
  2. {
  3. services.nix-serve = {
  4. enable = true;
  5. secretKeyFile = "/var/lib/cache/priv-key.pem";
  6. };
  7. services.nginx = {
  8. virtualHosts = {
  9. "cache.${config.networking.domain}" = {
  10. locations."/".proxyPass = "http://${config.services.nix-serve.bindAddress}:${toString config.services.nix-serve.port}";
  11. };
  12. };
  13. };
  14. hpc.hostFile.aliases = [
  15. "cache.${config.networking.domain}"
  16. ];
  17. system.activationScripts."generate-binary-cache-key" = ''
  18. if ! [ -f "/var/lib/cache/priv-key.pem" ]; then
  19. mkdir -pv /var/lib/cache
  20. ${pkgs.nix}/bin/nix-store --generate-binary-cache-key \
  21. "cache.${config.networking.domain}" \
  22. /var/lib/cache/priv-key.pem \
  23. /var/lib/cache/pub-key.pem
  24. fi
  25. '';
  26. gather.parts."cache/key" = {
  27. name = "cache-pub-key.pem";
  28. file = "/var/lib/cache/pub-key.pem";
  29. };
  30. }