From 511243fcbf47cf6d8b790751a9b80b3f521436a8 Mon Sep 17 00:00:00 2001 From: Gonne Date: Mon, 18 Dec 2023 17:52:53 +0100 Subject: [PATCH] Differentiate hardware and vms in roles --- nixos/roles/default.nix | 21 +++++++++++++-------- nixos/roles/hardware.nix | 5 +++++ nixos/roles/vm.nix | 8 ++++++++ 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 nixos/roles/hardware.nix create mode 100644 nixos/roles/vm.nix diff --git a/nixos/roles/default.nix b/nixos/roles/default.nix index 60284a7..f015cb8 100644 --- a/nixos/roles/default.nix +++ b/nixos/roles/default.nix @@ -1,16 +1,21 @@ { pkgs, lib, - modulesPath, + vm ? true, ... }: { - imports = [ - ./admins.nix - ./nix_keys.nix - ./prometheusNodeExporter.nix - (modulesPath + "/virtualisation/xen-domU.nix") - ../modules/impermanence.nix - ]; + imports = + [ + ./admins.nix + ./nix_keys.nix + ./prometheusNodeExporter.nix + ../modules/impermanence.nix + ] + ++ ( + if vm + then [./vm.nix] + else [./hardware.nix] + ); nix = { extraOptions = '' experimental-features = nix-command flakes diff --git a/nixos/roles/hardware.nix b/nixos/roles/hardware.nix new file mode 100644 index 0000000..ac55bcc --- /dev/null +++ b/nixos/roles/hardware.nix @@ -0,0 +1,5 @@ +{ + # Bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/nixos/roles/vm.nix b/nixos/roles/vm.nix new file mode 100644 index 0000000..45a995e --- /dev/null +++ b/nixos/roles/vm.nix @@ -0,0 +1,8 @@ +{ + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/virtualisation/xen-domU.nix") + ]; +}