Fediversity/services/vm/interactive-vm.nix

55 lines
1.1 KiB
Nix
Raw Normal View History

# customize nixos-rebuild build-vm to be a bit more convenient
2024-11-11 17:25:42 +01:00
{ pkgs, ... }:
{
# let us log in
users.mutableUsers = false;
users.users.root.hashedPassword = "";
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "yes";
PermitEmptyPasswords = "yes";
UsePAM = false;
};
};
# 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
xterm # for `resize`
];
environment.loginShellInit = ''
eval "$(resize)"
'';
nix.extraOptions = ''
extra-experimental-features = nix-command flakes
'';
2024-11-16 19:40:47 +01:00
virtualisation.memorySize = 2048;
virtualisation.forwardPorts = [
2024-10-30 19:38:39 +01:00
{
from = "host";
host.port = 22222;
guest.port = 22;
}
{
from = "host";
host.port = 8080;
2024-11-16 19:40:47 +01:00
guest.port = 80;
}
{
from = "host";
host.port = 8443;
2024-11-16 19:40:47 +01:00
guest.port = 443;
}
];
}