From e3fe4e656cef9e16ce9389855aceba18fa93b2b0 Mon Sep 17 00:00:00 2001 From: Gonne Date: Fri, 29 Nov 2024 11:55:58 +0100 Subject: [PATCH] Add Nodens, a VM to install NixOS VMs --- nixos/machines/nodens/configuration.nix | 16 +++++++++ .../nodens/hardware-configuration.nix | 33 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 nixos/machines/nodens/configuration.nix create mode 100644 nixos/machines/nodens/hardware-configuration.nix diff --git a/nixos/machines/nodens/configuration.nix b/nixos/machines/nodens/configuration.nix new file mode 100644 index 0000000..b01e154 --- /dev/null +++ b/nixos/machines/nodens/configuration.nix @@ -0,0 +1,16 @@ +{pkgs, ...}: { + imports = [ + ./hardware-configuration.nix + ../../roles + ../../roles/vm.nix + ../../modules/vmNetwork.nix + ]; + + # System configuration here + + systemPackages = [pkgs.git]; + + networking.hostName = "nodens"; + vmNetwork.ipv4 = "192.168.0.18"; + system.stateVersion = "24.11"; +} diff --git a/nixos/machines/nodens/hardware-configuration.nix b/nixos/machines/nodens/hardware-configuration.nix new file mode 100644 index 0000000..0253296 --- /dev/null +++ b/nixos/machines/nodens/hardware-configuration.nix @@ -0,0 +1,33 @@ +{ + lib, + pkgs, + ... +}: { + imports = []; + + fileSystems."/" = { + device = "root"; + fsType = "tmpfs"; + options = ["size=1G" "mode=755"]; + }; + # Different than usual names in order to automount other VMs + fileSystems."/persist" = { + device = "/dev/disk/by-label/nixosNodens"; + fsType = "btrfs"; + options = ["subvol=persist"]; + neededForBoot = true; + }; + fileSystems."/boot" = { + device = "/dev/disk/by-label/bootNodens"; + fsType = "ext4"; + }; + fileSystems."/nix" = { + device = "/dev/disk/by-label/nixosNodens"; + fsType = "btrfs"; + options = ["subvol=nix"]; + }; + + # swapDevices = [{device = "/dev/disk/by-uuid/TODO";}]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}