https://github.com/nh2/nixos-vm-building
Example of how to iterate on a NixOS config in a local VM.
https://github.com/nh2/nixos-vm-building
Last synced: 3 months ago
JSON representation
Example of how to iterate on a NixOS config in a local VM.
- Host: GitHub
- URL: https://github.com/nh2/nixos-vm-building
- Owner: nh2
- Created: 2021-01-13T04:25:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-13T04:29:19.000Z (over 4 years ago)
- Last Synced: 2025-01-13T00:26:23.099Z (5 months ago)
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nixos-vm-building
Example of how to iterate on a NixOS config in a local VM.
Useful if:
* You want to try out NixOS and how to configure/use it.
* You want to develop a new NixOS module.Originally based on this blog post: http://blog.patapon.info/nixos-local-vm/
## Usage
Run in order:
* `build-vm.sh` - Builds the VM. Read it to see how to customise the nixpkgs version to use.
* `run-vm.sh` - Runs the VM
* `ssh-vm.sh` - SSHs into the VMModify `configuration.nix` as you please, and rerun.
These scripts are very simple, usually one-liner `nix` CLI invocations that you could run yourself.
But they have added explanations; read their contents and the blog post to understand what's going on.### In-place redeployment for fast iteration
With the VM running, run:
* `./deploy-to-running-vm.sh`
## Troubleshooting
* **`error: preallocating file of 54420 bytes: No space left on device`**
Your VM's disk is too small.
Increase the `diskSize` in `vm.nix`, delete the VM state and rebuild using: `rm vm1.qcow2 && ./build-vm.sh`.