From 983391385c120cea6c198b32299c6350c9fce8f8 Mon Sep 17 00:00:00 2001 From: Dennis Frieberg Date: Sun, 1 Oct 2023 15:56:46 +0200 Subject: [PATCH] initial testlab config --- .../nerf-nixos-testlab/configuration.nix | 17 ++++++++++ .../hardware-configuration.nix | 34 +++++++++++++++++++ nixos/machines/nerf-nixos-testlab/network.nix | 15 ++++++++ 3 files changed, 66 insertions(+) create mode 100644 nixos/machines/nerf-nixos-testlab/configuration.nix create mode 100644 nixos/machines/nerf-nixos-testlab/hardware-configuration.nix create mode 100644 nixos/machines/nerf-nixos-testlab/network.nix diff --git a/nixos/machines/nerf-nixos-testlab/configuration.nix b/nixos/machines/nerf-nixos-testlab/configuration.nix new file mode 100644 index 0000000..d7e688e --- /dev/null +++ b/nixos/machines/nerf-nixos-testlab/configuration.nix @@ -0,0 +1,17 @@ +flake-inputs: +{config, pkgs, lib, ... }: { + +imports = [ + ./hardware-configuration.nix + ../../roles + ../../roles/xen_guest.nix + ./network.nix +]; + +# System configuration here + + boot.loader.grub.storePath = "/nix/store"; + boot.loader.grub.copyKernels = false; + networking.hostName = "nerf-nixos-testlab"; + system.stateVersion = "23.11"; +} diff --git a/nixos/machines/nerf-nixos-testlab/hardware-configuration.nix b/nixos/machines/nerf-nixos-testlab/hardware-configuration.nix new file mode 100644 index 0000000..95e7977 --- /dev/null +++ b/nixos/machines/nerf-nixos-testlab/hardware-configuration.nix @@ -0,0 +1,34 @@ +{config, lib, pkgs, modulesPath, ...}: { + imports = [ ]; + + fileSystems."/" = { + device = "root"; + fsType = "tmpfs"; + options = [ "size=1G" "mode=755" ]; + }; + fileSystems."/persistence" = { + device = "/dev/disk/by-uuid/30962650-f1dd-44bc-bca3-da1cdaa6fe3d"; + fsType = "ext4"; + neededForBoot = true; + }; + fileSystems."/persist" = { + device = "/persistence/persist"; + options = [ "bind" ]; + + }; + fileSystems."/nix" = { + device = "/persistence/nix"; + options = [ "bind" ]; + }; + fileSystems."/boot" = { + device = "/persistence/boot"; + options = [ "bind" ]; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/30962650-f1dd-44bc-bca3-da1cdaa6fe3d"; }]; + + nix.settings.max-jobs = lib.mkDefault 4; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/machines/nerf-nixos-testlab/network.nix b/nixos/machines/nerf-nixos-testlab/network.nix new file mode 100644 index 0000000..a8716c8 --- /dev/null +++ b/nixos/machines/nerf-nixos-testlab/network.nix @@ -0,0 +1,15 @@ +# We sohuld put that config somewhere in roles and give it a parameter or something, +# everyone gets the same nameserver and the same prefixLength and address vs defaultGateway alsways +# depend on the same thing +{ + imports = [ ]; + networking = { + interfaces.enX0.ipv4.addresses = [ { + address = "192.168.0.40"; + prefixLength = 16; + } ]; + defaultGateway = "192.168.0.167"; + nameservers = ["130.83.2.22" "130.83.56.60" "130.83.22.60" "130.82.22.63"]; + }; +} +