server2.nix: hack in

This commit is contained in:
Astro 2021-04-04 21:59:17 +02:00
parent 53cbe8e74b
commit 2e2d8c976d
4 changed files with 72 additions and 5 deletions

View File

@ -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"

View File

@ -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

View File

@ -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";
}

View File

@ -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