1
0
Fork 0

feat: Add minimal VM without autologin

This commit is contained in:
lwad 2024-05-18 19:27:48 +01:00
parent db51f201e9
commit 7af6140b43
2 changed files with 68 additions and 0 deletions

View File

@ -48,6 +48,11 @@
inputs.home-manager.nixosModules.default
];
};
zenitsu = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [ ./zenitsu ];
};
};
};
}

63
zenitsu/default.nix Normal file
View File

@ -0,0 +1,63 @@
{ lib, modulesPath, pkgs, ... }:
{
boot = {
initrd.postDeviceCommands = "mke2fs /dev/vdb";
loader = {
grub.enable = false;
systemd-boot.enable = lib.mkForce false;
};
};
environment.etc = {
"profile" = {
enable = true;
group = "root";
mode = "0755";
text = "${pkgs.xorg.xinit}/bin/startx";
user = "root";
};
"X11/xinit/xinitrc" = {
enable = true;
group = "root";
mode = "0755";
text = "${pkgs.alacritty}/bin/alacritty";
user = "root";
};
};
imports = [
"${modulesPath}/virtualisation/qemu-vm.nix"
"${modulesPath}/profiles/qemu-guest.nix"
];
networking.hostName = "zenitsu";
services = {
logrotate.enable = false;
xserver = {
displayManager.startx.enable = true;
enable = true;
};
};
system.stateVersion = "23.11";
users.users."zenitsu" = {
isNormalUser = true;
password = "zenitsu";
};
virtualisation = {
diskImage = "/dev/null";
emptyDiskImages = [ (64 * 1024) ];
fileSystems."/" = lib.mkForce {
device = "/dev/vdb";
fsType = "ext4";
};
qemu.options = [
"-vga virtio"
''-smp "$(nproc)"''
''
-m "$(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / (1024 ** 2) * 3 / 4))"''
"-display gtk,grab-on-hover=yes"
];
resolution = {
x = 1280;
y = 1080;
};
};
}