Add qvm clean; make rebuild produce VM runner; default qvm run to shell
This commit is contained in:
parent
e766c8466d
commit
601b4ab15e
7 changed files with 395 additions and 249 deletions
|
|
@ -40,7 +40,7 @@
|
|||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
|
||||
inputs.ros_neovim.nixosModules.default
|
||||
# inputs.ros_neovim.nixosModules.default
|
||||
inputs.common.nixosModules.essentials
|
||||
inputs.common.nixosModules.git
|
||||
inputs.common.nixosModules.zsh
|
||||
|
|
@ -76,20 +76,21 @@
|
|||
useGlobalPkgs = true;
|
||||
backupFileExtension = "bak";
|
||||
|
||||
sharedModules = [
|
||||
inputs.common.homeManagerModules.atuin
|
||||
inputs.common.homeManagerModules.git
|
||||
inputs.common.homeManagerModules.postgres_cli_options
|
||||
inputs.common.homeManagerModules.starship
|
||||
inputs.common.homeManagerModules.zoxide
|
||||
inputs.common.homeManagerModules.zsh
|
||||
inputs.common.homeManagerModules.tmux
|
||||
inputs.common.homeManagerModules.direnv
|
||||
({ programs.direnv.config.whitelist.prefix = [ "/" ]; })
|
||||
];
|
||||
|
||||
users.root = {
|
||||
home.stateVersion = stateVersion;
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
sharedModules = [
|
||||
inputs.common.homeManagerModules.atuin
|
||||
inputs.common.homeManagerModules.git
|
||||
inputs.common.homeManagerModules.postgres_cli_options
|
||||
inputs.common.homeManagerModules.starship
|
||||
inputs.common.homeManagerModules.zoxide
|
||||
inputs.common.homeManagerModules.zsh
|
||||
inputs.common.homeManagerModules.tmux
|
||||
inputs.common.homeManagerModules.direnv
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -164,6 +165,18 @@
|
|||
];
|
||||
};
|
||||
|
||||
fileSystems."/root/.config/opencode" = {
|
||||
device = "opencode_config";
|
||||
fsType = "9p";
|
||||
options = [
|
||||
"trans=virtio"
|
||||
"version=9p2000.L"
|
||||
"msize=104857600"
|
||||
"_netdev"
|
||||
"nofail"
|
||||
];
|
||||
};
|
||||
|
||||
# Environment variables for cache directories
|
||||
environment.variables = {
|
||||
CARGO_HOME = "/cache/cargo";
|
||||
|
|
@ -209,7 +222,7 @@
|
|||
╚════════════════════════════════════════╝
|
||||
'';
|
||||
|
||||
# 35GB disk size
|
||||
# GB disk size
|
||||
virtualisation.diskSize = 40 * 1024;
|
||||
|
||||
system.stateVersion = stateVersion;
|
||||
|
|
@ -217,20 +230,33 @@
|
|||
|
||||
in
|
||||
let
|
||||
qcow2Image = nixos-generators.nixosGenerate {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
# Use standard NixOS VM builder instead of nixos-generators
|
||||
# nixos-generators qcow format has a 100MB RAM build VM that OOMs with large closures
|
||||
baseVm = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
format = "qcow";
|
||||
modules = [ vmModule ];
|
||||
};
|
||||
in
|
||||
{
|
||||
# Export the qcow2 image
|
||||
nixosConfigurations.base = baseVm;
|
||||
|
||||
# Runnable VM script (./result/bin/run-qvm-dev-vm)
|
||||
packages.${system} = {
|
||||
qcow2 = qcow2Image;
|
||||
default = qcow2Image;
|
||||
vm = baseVm.config.system.build.vm;
|
||||
default = baseVm.config.system.build.vm;
|
||||
};
|
||||
|
||||
apps.${system}.default = {
|
||||
type = "app";
|
||||
program = "${baseVm.config.system.build.vm}/bin/run-qvm-dev-vm";
|
||||
};
|
||||
|
||||
devShells.${system}.default = pkgs.mkShellNoCC {
|
||||
QEMU_NET_OPTS = "hostfwd=tcp::2222-:22";
|
||||
};
|
||||
|
||||
# Export the module for reuse
|
||||
nixosModules.default = vmModule;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue