feat: better vm doc, remove init options

This commit is contained in:
Florian Schmitt 2024-09-30 16:52:30 +03:00
parent 1ee1b8e07b
commit 2c0e68ef9c
3 changed files with 14 additions and 10 deletions

View file

@ -1,10 +1,19 @@
# Build a virtual machine based on your generated configurations
# Build images based on your generated configurations
Your Nix configurations are located in the `inventory` folder you can build and run the configuration file you want by running from the NixiN root folder, for example for the demo configuration file:
Your Nix configurations are located in the `inventory` folder you can build and run the configuration file you want by running nixos-generate from the NixiN root folder. If the build succeeds, the last output is a command located in your nix store to run your vm.
## Images formats
Check <https://github.com/nix-community/nixos-generators?tab=readme-ov-file#supported-formats> to find available formats.
For example, for qemu-kvm runner
```bash
nix-build '<nixpkgs/nixos>' -A vm -I nixpkgs=channel:nixos-24.05 -I nixos-config=./inventory/demo-configuration.nix
./result/bin/run-nixos-vm
nixos-generate -c inventory/demo-configuration.nix -f vm
```
(nixos-generate is installed by nix-shell, check `shell.nix` to see the packages added)
## Cross compile
Check <https://github.com/nix-community/nixos-generators?tab=readme-ov-file#cross-compiling>.

View file

@ -87,9 +87,6 @@ export default {
./hardware-configuration.nix
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking = {
hostName = "{{ networkingHostname }}";
domain = "{{ networkingDomain }}";

View file

@ -1,7 +1,5 @@
{ config, pkgs, ... }:
{
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
virtualisation.vmVariant.virtualisation.forwardPorts = [
{ from = "host"; host.port = 8001; guest.port = 8001; }
];