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.

139 lines
3.0 KiB

1 year ago
2 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. {
  2. inputs = {
  3. nixpkgs = {
  4. type = "github";
  5. owner = "NixOS";
  6. repo = "nixpkgs";
  7. ref = "nixos-24.05";
  8. };
  9. colmena = {
  10. type = "github";
  11. owner = "zhaofengli";
  12. repo = "colmena";
  13. inputs.nixpkgs.follows = "nixpkgs";
  14. };
  15. nixago = {
  16. type = "github";
  17. owner = "nix-community";
  18. repo = "nixago";
  19. inputs.nixpkgs.follows = "nixpkgs";
  20. inputs.flake-utils.follows = "utils";
  21. };
  22. pre-commit-hooks = {
  23. type = "github";
  24. owner = "cachix";
  25. repo = "pre-commit-hooks.nix";
  26. inputs.nixpkgs.follows = "nixpkgs";
  27. };
  28. sops = {
  29. type = "github";
  30. owner = "Mic92";
  31. repo = "sops-nix";
  32. inputs.nixpkgs.follows = "nixpkgs";
  33. inputs.nixpkgs-stable.follows = "nixpkgs";
  34. };
  35. utils = {
  36. type = "github";
  37. owner = "numtide";
  38. repo = "flake-utils";
  39. };
  40. disko = {
  41. type = "github";
  42. owner = "nix-community";
  43. repo = "disko";
  44. inputs.nixpkgs.follows = "nixpkgs";
  45. };
  46. gather = {
  47. type = "github";
  48. owner = "fooker";
  49. repo = "gather.nix";
  50. };
  51. ldap-sync = {
  52. type = "git";
  53. url = "https://gogs.informatik.hs-fulda.de/fooker/ldap-sync.git";
  54. flake = false;
  55. };
  56. };
  57. outputs = { nixpkgs, utils, disko, ... }@inputs: {
  58. colmena = import ./deployment.nix inputs;
  59. devShell = utils.lib.eachSystemMap utils.lib.allSystems (system:
  60. let
  61. pkgs = nixpkgs.legacyPackages.${system};
  62. colmena = inputs.colmena.defaultPackage.${system}.overrideAttrs (final: prev: {
  63. patches = (prev.patches or [ ]) ++ [
  64. ./patches/colmena-disable-ssh-master.patch
  65. ];
  66. });
  67. pre-commit-hooks = inputs.pre-commit-hooks.lib.${system}.run {
  68. src = ./.;
  69. hooks = {
  70. nixpkgs-fmt.enable = true;
  71. statix.enable = true;
  72. shellcheck.enable = true;
  73. };
  74. };
  75. sops-hooks = inputs.nixago.lib.${system}.make {
  76. data = (pkgs.callPackage ./sops.nix { }).config;
  77. output = ".sops.yaml";
  78. format = "yaml";
  79. };
  80. gather = pkgs.writeShellScript "gather" ''
  81. ROOT=${toString ./.}
  82. MACHINES=( "$(${colmena}/bin/colmena eval -E '{nodes, ...}: ')" )
  83. if [[ "$1" != "" ]]; then
  84. else
  85. mapfile -t MACHINES < <()
  86. fi
  87. '';
  88. in
  89. pkgs.mkShell {
  90. buildInputs = [
  91. colmena
  92. #gather
  93. ] ++ (with pkgs; [
  94. bash
  95. gitAndTools.git
  96. gnutar
  97. gzip
  98. openssh
  99. sops
  100. age
  101. mkdocs
  102. ] ++ [
  103. (pkgs.vscode-with-extensions.override {
  104. vscode = pkgs.vscodium;
  105. vscodeExtensions = with pkgs.vscode-extensions; [
  106. bbenoist.nix
  107. ];
  108. })
  109. ]);
  110. shellHook = ''
  111. ${pre-commit-hooks.shellHook}
  112. ${sops-hooks.shellHook}
  113. '';
  114. });
  115. };
  116. }