diff --git a/nix/lib/config/legacy.nix b/nix/lib/config/legacy.nix index 7abf78e..c6ea8d8 100644 --- a/nix/lib/config/legacy.nix +++ b/nix/lib/config/legacy.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, self, ... }: let - mainServer = "server1"; + mainServers = [ "server1" "server2" ]; pillar = self.lib.saltPillarFor "*"; renameAttr = from: to: attrset: @@ -58,9 +58,9 @@ in config.site.hosts = lib.mkMerge ( [ - { - "${mainServer}".role = "server"; - } + (builtins.foldl' (result: hostName: result // { + "${hostName}".role = "server"; + }) {} mainServers) (builtins.mapAttrs (_: switch: { inherit (switch) model location password; @@ -77,7 +77,7 @@ in ctPillar = self.lib.saltPillarFor name; in { role = "container"; - location = mainServer; + location = "server2"; interfaces = builtins.mapAttrs (net: interface: renameAttr "gw" "gw4" diff --git a/nix/nixos-module/default.nix b/nix/nixos-module/default.nix index 2e17dca..aeef922 100644 --- a/nix/nixos-module/default.nix +++ b/nix/nixos-module/default.nix @@ -16,6 +16,9 @@ in { ./server/lxc-containers.nix ./server/network.nix ] + ++ optionals (hostName == "server2") [ + ./server/server2.nix + ] ++ optionals (hostConfig.role == "container") [ ./container/defaults.nix ./container/dhcp-server.nix diff --git a/nix/nixos-module/server/server2.nix b/nix/nixos-module/server/server2.nix new file mode 100644 index 000000000..f3d6f5e --- /dev/null +++ b/nix/nixos-module/server/server2.nix @@ -0,0 +1,57 @@ +{ pkgs, ... }: + +{ + boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "usbhid" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "server2/root"; + fsType = "zfs"; + }; + + fileSystems."/var" = + { device = "server2/root/var"; + fsType = "zfs"; + }; + + fileSystems."/nix" = + { device = "server2/root/nix"; + fsType = "zfs"; + }; + + fileSystems."/nix/store" = + { device = "server2/root/nix/store"; + fsType = "zfs"; + }; + + fileSystems."/nix/var" = + { device = "server2/root/nix/var"; + fsType = "zfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/29BF-1E56"; + fsType = "vfat"; + }; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/sda"; + + boot.kernelParams = [ "mitigations=off" ]; + + networking.hostName = "server2"; # Define your hostname. + networking.hostId = "52525252"; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + environment.systemPackages = with pkgs; [ + wget vim git screen + ]; + #nix.registry.zentralwerk-network.flake = "git+https://gitea.c3d2.de/zentralwerk/network.git?ref=nix"; + services.openssh.enable = true; + services.openssh.permitRootLogin = "yes"; +} diff --git a/salt-pillar/top.sls b/salt-pillar/top.sls index c536542..a4608d3 100644 --- a/salt-pillar/top.sls +++ b/salt-pillar/top.sls @@ -10,6 +10,13 @@ base: - cpe.aps - collectd.server1 - keys + 'server2': + - lxc-containers.server1 + - bird.ospf + - switches + - cpe.aps + - collectd.server1 + - keys 'priv*-gw': - dhcp - bird.radv