Advertisement
Guest User

Untitled

a guest
Aug 9th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. let
  2. targetConfig = {
  3. test-cn-1 = {
  4. targetEnv = "none";
  5. targetHost = "192.168.1.232";
  6. };
  7. test-hv-1 = {
  8. targetEnv = "none";
  9. targetHost = "192.168.1.250";
  10. };
  11. };
  12.  
  13. user_data = import ./config/users.nix;
  14.  
  15. generateCnConfig = id: {
  16.  
  17. name = "test-cn-${toString (id+1)}";
  18.  
  19.  
  20.  
  21. value = { config, pkgs, lib, resources, ... }: {
  22. deployment = targetConfig."test-cn-${toString (id+1)}";
  23.  
  24.  
  25.  
  26. imports = [ (./config + "/test-cn-${toString (id+1)}.nix") ./config/users.nix ];
  27.  
  28. };
  29. };
  30. generateHvConfig = id: {
  31.  
  32. name = "test-hv-${toString (id+1)}";
  33.  
  34.  
  35.  
  36. value = { config, pkgs, lib, resources, ... }: {
  37. deployment = targetConfig."test-hv-${toString (id+1)}";
  38.  
  39.  
  40.  
  41. imports = [ (./config + "/test-hv-${toString (id+1)}.nix") ./config/users.nix];
  42. };
  43. };
  44.  
  45. cnServers = builtins.genList generateCnConfig 1;
  46. hvServers = builtins.genList generateHvConfig 1;
  47. in
  48. {
  49. network.description = "test";
  50.  
  51. } // builtins.listToAttrs cnServers
  52. // builtins.listToAttrs hvServers
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement