Kathryn<'u1f338>

@sakurakat.systems
3

trying to make a hyperv VM with nixos so i can rice my laptop without turning it on

i already have a wsl vhdx so i trying to use that directly while creating a vm

it doesnt even show a tty, maybe because of nixos-wsl module

i used my laptop's config flake by using the `--flake` option

it keeps saying `nixos/modules/virtualisation/disk-size-option.nix` is missing

cant figure out how to add the option to my flake

time to copy directly from the website ig

it started building.... something, ig i need to wait now

its creating the thingy ig but i just realized its creating the thingy using the wsl config and not my laptop config, oh well, atleast i now know that it works, gotta redo it once the image or whatever is built

ofc as soon as i make the changes i want, it errors, time to copy again... pain

the error was in the laptop's config part, ig ill just comment it out lol

aaaaaaaand it says that nixosConfigurations is missing, time to bash my head against the wall

.....fine ill just copy it one to one again

oh i forgot to mention the system name, the system name for wsl is nixos (default), since i didnt mention the system name while giving the flake as input, it assumed i wanted to build the thing using the system's system name, the fix was `--flake .#kats-laptop`

finally got it to stop complaining about stuff, time to wait 30 minutes again

i wonder if 20gb is going to be enough for the vm, i kinda doubt it but i can hope

it works! and it took 46m12s to build. I chose `install-iso-hyperv` as target out of curiosity and it always loads into the live iso, ig time to remake it with `hyperv` target

Quota mode: disabled random cringe init done

i increased the image size from 20gb to 40gb and it keeps failing because it keeps running out of disk space, my guess is that wsl's disk size is too small to store 40gb

gonna switch back to 20gb and hope it works now, if it doesnt then ill switch to something very small, like 5gb, and then see if i can increase the vdhx size in hyperv

might also be a good candidate to see if i can use disko can format and do stuff for me instead of manually increasing the partition size and then reformatting and stuff

all of this effort just because i dont want to turn on my laptop lol

oh right, i didnt have the "out of space" problem before is because the target `install-iso-hyperv` as the name implies creates an iso, and the iso is ~2.6gb big

20gb is too small for the thing 🙃

Model: (file) Disk /build/nixos.raw: 4295MB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 8389kB 269MB 261MB fat32 ESP boot, esp 2 269MB 4294MB 4024MB ext4 primary

wait, does it think 35*1024 means 35mb???

i changed it to 200*1024 but it still gave the same error, maybe this line will help > [ 1.407725] virtio_blk virtio0: [vda] 8388608 512-byte logical blocks (4.29 GB/4.00 GiB)

maybe the build sandbox is running out of space, and not wsl

i can pass options to the nix build system via `--option` nix.dev and then, man.archlinux.org

nix.dev
nix-build - Nix Reference Manual

FINALLY A DIFFERENT ERROR error: builder for '/nix/store/vvs9swrc5k75hbapav7wvshlsh1i5kgw-nixos-hyperv-hyperv-25.05.20250330.52faf48-x86_64-linux.drv' failed with exit code 1

but thats not an exit code in :/ nix.dev

nix.dev
nix-build - Nix Reference Manual

and the build-dir is empty

it also says nixos-hyperv-hyperv> error: creating file '"/build/root/nix/store/gmj0qvnh5mhiz4hilis41snbmz0sz6k1-linux-pam-1.6.1-man/share/man/man8/pam.8.gz"': File exists

lets gc the store and start the build again

error: builder for '/nix/store/viir73fa9wxrbp4y18yad03nzp82bhjr-hwdb.bin.drv' failed with exit code 1

error: 1 dependencies of derivation '/nix/store/7hmp6slgwlca392jg4lp329l9c7wwxi3-etc.drv' failed to build

error: 1 dependencies of derivation '/nix/store/ivrmw34kdm8p417kbihdjw83xxrkrwja-nixos-system-kats-laptop-hyperv-25.05.20250330.52faf48.drv' failed to build

error: 1 dependencies of derivation '/nix/store/ivrmw34kdm8p417kbihdjw83xxrkrwja-nixos-system-kats-laptop-hyperv-25.05.20250330.52faf48.drv' failed to build

*sigh* idk anymore

i remember there was a module for some hardware optimisation for t480, maybe i turned it on? github.com

github.com
nixos-hardware/lenovo/thinkpad/t480/default.nix at master · NixOS/nixos-hardware

nope, i dont see any of those options :/

maybe its this line? `boot.extraModprobeConfig = "options kvm_intel nested=1";` lets just disable all the boot related option

nope, lets turn on the option `--option keep-failed true` which saves failed artifacts and also `--show-trace` to see more detailed output

note: keeping build directory '/mnt/d/build-dir/nix-build-perl-5.40.0-env.drv-0/build' note: keeping build directory '/mnt/d/build-dir/nix-build-initrd-linux-6.12.21.drv-0/build'

build-dir\nix-build-initrd-linux-6.12.21.drv-0\build\root\etc\modprobe.d has 3 files `debian.conf` `nixos.conf` `ubuntu.conf` and all of them are empty

but initrd stuff is in hardware-configuration :/ and i commented out the code which would import it maybe the `inherit system` in the code i copied from website is causing problem?

nope, something else

since initrd seems to be part of the problem, lets turn on ` boot.loader.systemd-boot.enable = true;`

didnt do anything theres `format = "raw"` in the flake, lets change raw to hyperv

nope, that didnt help either the mdadm files are also empty, i remember the name but i dont remember where

www.man7.org AH, i used that command when i was preparing for RHCSA, but why is it having problems there?

www.man7.org
mdadm(8) - Linux manual page

trying to make a basic hyperv vm instead of using my laptop's config

lets just point to the config for now instead of flake...

it failed again 🙃

idk, maybe it needs hardware-config.nix - nope! conflicting definitions lets try with the filesystem config commented out

failed again

ok, i just ran it without the build directory options and it works 🙃

now lets try it with my laptop's config...

oh right click file>properties>advanced>uncheck Compress contents to save disk space lets try now

oh, had to turn off secure boot in vm settings

huh, whys my user not here

maybe its the basic image?

it created the same file, lets gc

i removed the sudo and im back to this error error: path '/nix/store/7a2rzcz3mjaq6ni71nn3zv6v3kxk8zab-nixpkgs/nixpkgs/nixos/modules/virtualisation/disk-size-option.nix' does not exist

i had an extra closing bracket....?

ok finally got it to start building im not sure what i changed ;-;

wait, if you use flake then does it build using the the nixos config just as `nixos rebuild --flake` does?

i expect to get the error that the container is too small

yup, go tit nixos-hyperv-hyperv> ERROR: cptofs failed. diskSize might be too small for closure. error: builder for '/nix/store/25wmmv6gscass1wmxan78npl169znd56-nixos-hyperv-hyperv-25.05.20250330.52faf48-x86_64-linux.drv' failed with exit code 1;

DIFFERENT HASH

the vm takes more ram than i assigned

huh, thats weird, why isnt it accepting the password?

maybe it needs an initial password since /etc/passwd wont have the password hash or smt?

"If none of the password options are set, then no password is assigned to the user, and the user will not be able to do password-based logins." mynixos.com.

mynixos.com
users.users.<name>.initialPassword - MyNixOS

mynixos.com "To generate a hashed password run mkpasswd."

mynixos.com
users.users.<name>.hashedPassword - MyNixOS

bsky.app Model: (file) Disk /build/nixos.raw: 21.5GB Sector size (logical/physical): 512B/512B [...] Number Start End Size File system Name Flags 1 8389kB 269MB 261MB fat32 ESP boot, esp 2 269MB 21.5GB 21.2GB ext4 primary

YES my suspicion was correct

some stats because i want to post them it takes ~6m30s to rebuild the image and ~50s to copy the file to windows

size of the vhdx file is 9.00 GB (9,672,065,024 bytes)

HELL YEAH

lets try to remove the errors from the config

i did nix flake update which updated all the packages, so the vm is different compared to my laptop

i guess i can just download the flake.lock file and then update it so its in sync with my laptop

....huh? where are the config files?

oh, i guess i made the image directly and didn't run the installer, so the config files arent present

well, thats kinda annoying

lets recreate the default config files first

........ or i can just clone the repo and make the changes, i guess i need to change the hardware config, lets see what tools i can use

`nixos-generate-config` looks promising

yup! it works

determinate nix made the VM run out of memory ^^; maybe determinate nix isnt worth the trouble? lets just remove it for now and try again

uh oh, out of space already!? running `df -h` says 100% used on `/`

well, thats easy to solve as this is a vm

file > settings > hard drive > edit > aaaand expand disk after a reboot it should automatically detect the new space, and it does, i know because i'm writing this after doing it lol

no errors now C:

i guess the glitchiness is from hyprland struggling under VM which is expected

two generations after restart! yippie!

lets see whats the problem with deterministic nix now...

the vm has 10G of ram, so im not sure why the compilation failed

huh? isnt it supposed to say deterministic nix? oh well, theres a 3rd boot entry and the compilation didnt fail

determinate-nix says hello 🐱

Share this page