From f15669e51ea204831c17a62566feb04abdbba7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Mon, 27 Jan 2025 17:50:10 +0100 Subject: [PATCH] Clean up VM options --- services/tests/peertube.nix | 5 --- services/vm/garage-vm.nix | 1 - services/vm/interactive-vm.nix | 69 +++++++++++++++++++--------------- 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/services/tests/peertube.nix b/services/tests/peertube.nix index 6a5161b..a811ea2 100644 --- a/services/tests/peertube.nix +++ b/services/tests/peertube.nix @@ -175,11 +175,6 @@ pkgs.nixosTest { ../vm/interactive-vm.nix ]; - virtualisation = { - memorySize = lib.mkVMOverride 8192; - cores = 8; - }; - environment.systemPackages = with pkgs; [ python3 firefox-unwrapped diff --git a/services/vm/garage-vm.nix b/services/vm/garage-vm.nix index aca295e..32da916 100644 --- a/services/vm/garage-vm.nix +++ b/services/vm/garage-vm.nix @@ -28,7 +28,6 @@ in inherit value; }) (filterAttrs (_: { website, ... }: website) cfg.ensureBuckets); - virtualisation.diskSize = 2048; virtualisation.forwardPorts = [ { from = "host"; diff --git a/services/vm/interactive-vm.nix b/services/vm/interactive-vm.nix index 738f580..033e7fc 100644 --- a/services/vm/interactive-vm.nix +++ b/services/vm/interactive-vm.nix @@ -1,9 +1,19 @@ -# customize nixos-rebuild build-vm to be a bit more convenient -{ pkgs, ... }: +{ pkgs, lib, ... }: + +let + inherit (lib) mkForce; + +in + { - # let us log in - users.mutableUsers = false; - users.users.root.hashedPassword = ""; + users = { + mutableUsers = false; + users.root = { + hashedPassword = ""; + hashedPasswordFile = mkForce null; + }; + }; + services.openssh = { enable = true; settings = { @@ -13,16 +23,11 @@ }; }; - # automatically log in services.getty.autologinUser = "root"; - services.getty.helpLine = '' - Type `C-a c` to access the qemu console - Type `C-a x` to quit - ''; - # access to convenient things + environment.systemPackages = with pkgs; [ - w3m python3 + w3m xterm # for `resize` ]; environment.loginShellInit = '' @@ -32,23 +37,27 @@ extra-experimental-features = nix-command flakes ''; - virtualisation.memorySize = 2048; + virtualisation = { + memorySize = 8192; + diskSize = 2048; + cores = 8; - virtualisation.forwardPorts = [ - { - from = "host"; - host.port = 22222; - guest.port = 22; - } - { - from = "host"; - host.port = 8080; - guest.port = 80; - } - { - from = "host"; - host.port = 8443; - guest.port = 443; - } - ]; + forwardPorts = [ + { + from = "host"; + host.port = 22222; + guest.port = 22; + } + { + from = "host"; + host.port = 8080; + guest.port = 80; + } + { + from = "host"; + host.port = 8443; + guest.port = 443; + } + ]; + }; }