From 1ef708bab899adbd23f3f70a3b80938a9cb5c80f Mon Sep 17 00:00:00 2001 From: Jermeiah S Date: Thu, 10 Jul 2025 02:25:08 -0400 Subject: [PATCH] repo cleanup I moved things around to be easier to reason --- base.nix | 22 ++++++++++++++++++++ configuration.nix | 51 +++++++++++------------------------------------ vm-variant.nix | 14 +------------ 3 files changed, 35 insertions(+), 52 deletions(-) create mode 100644 base.nix diff --git a/base.nix b/base.nix new file mode 100644 index 0000000..5469fc3 --- /dev/null +++ b/base.nix @@ -0,0 +1,22 @@ +{ lib, ... }: +{ + nix = { + settings.experimental-features = [ + "nix-command" + "flakes" + ]; + }; + networking = { + firewall.enable = false; + useDHCP = lib.mkForce true; + hostName = "demo"; + }; + # Optional: Make sure DNS is configured + networking = { + nameservers = [ + "9.9.9.9" + ]; + }; + + system.stateVersion = "25.05"; +} diff --git a/configuration.nix b/configuration.nix index e7d82aa..d2c6c2b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,6 +1,6 @@ { # config, - lib, + # lib, pkgs, ... }: @@ -11,47 +11,22 @@ let in { imports = [ + ./base.nix # ./microvm.nix ./vm-variant.nix ]; - networking = { - firewall.enable = false; - useDHCP = lib.mkForce true; - hostName = "demo"; - }; - services.avahi = { - enable = true; - nssmdns = true; - publish = { - enable = true; - addresses = true; - workstation = true; - }; - }; - # boot = { - # # loader.grub.device = "nodev"; - # kernelParams = [ "console=ttyS0" ]; - # }; - users.users = { - root = { - password = ""; - }; - }; + virtualisation.vmVariant = { + virtualisation = { - # Optional: Make sure DNS is configured - networking = { - nameservers = [ - "9.9.9.9" - ]; - # Enable networking - # networkmanager.enable = true; - }; - nix = { - settings.experimental-features = [ - "nix-command" - "flakes" - ]; + forwardPorts = [ + { + from = "host"; + host.port = 8888; + guest.port = 80; + } + ]; + }; }; services.nginx = { enable = true; @@ -66,6 +41,4 @@ in }; }; - # users.mutableUsers = false; - system.stateVersion = "25.05"; } diff --git a/vm-variant.nix b/vm-variant.nix index 7048d72..f4b847b 100644 --- a/vm-variant.nix +++ b/vm-variant.nix @@ -1,22 +1,10 @@ _: { virtualisation.vmVariant = { - # virtualisation.diskImage = null; - # Boot with tmpfs as root - virtualisation = { - - forwardPorts = [ - { - from = "host"; - host.port = 8888; - guest.port = 80; - } - ]; - graphics = false; # disables graphical output + graphics = false; memorySize = 1024; diskImage = null; - # qemu.options = [ "-M microvm,x-option-roms=off,pit=off,pic=on,isa-serial=off" ]; }; services.getty = { autologinUser = "root";