🚧 wip: progress on p1 + changed provider to virtualbox

Signed-off-by: xtrm <oss@xtrm.me>
This commit is contained in:
xtrm
2025-03-04 19:51:09 +01:00
parent 0fb19bbbe0
commit 8c1eeab749
7 changed files with 108 additions and 13 deletions

View File

@ -12,7 +12,6 @@
];
networking.hostName = hostname;
nixpkgs.config.allowUnfree = true;
# Since `fileSystems` is ignored by nixos-generators, we need to be creative
@ -24,6 +23,7 @@
script = ''
mkdir -p /iot
/run/wrappers/bin/mount -t 9p -o trans=virtio,version=9p2000.L host0 /iot
${pkgs.bindfs}/bin/bindfs --map=1000/0:@100/@0 /iot /iot
'';
wantedBy = [ "multi-user.target" ];
@ -38,11 +38,36 @@
users.users.root = {
password = "toor";
shell = pkgs.zsh;
extraGroups = [ "wheel" "libvirtd" ];
};
services = {
getty.autologinUser = "root";
openssh = {
enable = true;
ports = [ 22 ];
settings = {
PermitRootLogin = "yes";
PasswordAuthentication = true;
AllowUsers = null;
};
};
xserver = {
enable = true;
xkb = {
layout = "fr";
variant = "us";
};
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
};
libinput.enable = true;
};
hardware.graphics = {
enable = true;
enable32Bit = true;
};
virtualisation.virtualbox.host.enable = true;
programs = {
zsh = {
@ -56,6 +81,8 @@
environment = {
systemPackages = with pkgs; [
librewolf
bindfs
vagrant
git
zip

View File

@ -27,17 +27,16 @@
packages = forAllSystems (
system:
let
vm = nixos-generators.nixosGenerate {
inherit system;
specialArgs = {
inherit hostname;
generate-vm = modules:
nixos-generators.nixosGenerate {
inherit system, modules;
specialArgs = {
inherit hostname;
};
format = "vm";
};
modules = [
./configuration.nix
];
format = "vm";
};
in
vm = generate-vm [ ./configuration.nix ];
in
{
inherit vm;
default = vm;
@ -58,7 +57,22 @@
script = pkgs.writeShellScriptBin "${scriptName}" ''
${selfPkgs.vm}/bin/run-${hostname}-vm \
-enable-kvm \
-virtfs local,path=$(${pkgs.coreutils}/bin/pwd)/..,mount_tag=host0,security_model=passthrough,id=host0
-virtfs local,path=$(${pkgs.coreutils}/bin/pwd)/..,mount_tag=host0,security_model=mapped-xattr,id=host0
'';
in
{
type = "app";
program = "${script}/bin/${scriptName}";
};
vm-nodisplay =
let
scriptName = "run-${hostname}-vm-nodisplay";
script = pkgs.writeShellScriptBin "${scriptName}" ''
${selfPkgs.vm}/bin/run-${hostname}-vm \
-enable-kvm \
-nographic \
-virtfs local,path=$(${pkgs.coreutils}/bin/pwd)/..,mount_tag=host0,security_model=mapped-xattr,id=host0
'';
in
{