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.

64 lines
1.4 KiB

  1. { pkgs, lib, config, modulesPath, manangerConfig, ... }:
  2. with lib;
  3. let
  4. auto-install = pkgs.writeShellScript "nixos-install" ''
  5. if [[ "$(cat /proc/cmdline)" =~ nixos\.install=([^ ]+) ]]; then
  6. INSTALL="''${BASH_REMATCH[1]}"
  7. else
  8. echo "No install derivation found" >&2
  9. exit 1
  10. fi
  11. '';
  12. in
  13. {
  14. imports = [
  15. "${modulesPath}/installer/netboot/netboot-minimal.nix"
  16. ];
  17. config = {
  18. services.getty.autologinUser = lib.mkForce "root";
  19. networking.hostName = "installer";
  20. networking.hosts = mkForce manangerConfig.networking.hosts;
  21. users.users."root" = mkForce manangerConfig.users.users."root";
  22. systemd.services."auto-install" = {
  23. description = "Automated NixOS installer";
  24. wants = [ "network-online.target" ];
  25. after = [ "network-online.target" ];
  26. wantedBy = [ "multi-user.target" ];
  27. unitConfig = {
  28. AssertKernelCommandLine = "nixos.install";
  29. FailureAction = "reboot-force";
  30. };
  31. serviceConfig = {
  32. Type = "oneshot";
  33. ExecStart = auto-install;
  34. StandardInput = "tty-force";
  35. TTYPath = "/dev/tty1";
  36. TTYVTDisallocate = false;
  37. };
  38. };
  39. nix.settings = {
  40. substituters = [
  41. "http://cache.${manangerConfig.networking.domain}"
  42. ];
  43. trusted-public-keys = [
  44. (fileContents manangerConfig.gather.parts."cache/key".path)
  45. ];
  46. };
  47. system.stateVersion = config.system.nixos.release;
  48. };
  49. }