11 Jul 2025 |
prince213 | So I just switched to Lix | 15:02:09 |
prince213 | And now it says error: Nix daemon disconnected unexpectedly (maybe it crashed?) | 15:02:15 |
prince213 | Okay I think I know why | 15:06:57 |
prince213 | And Lix did help by showing a better SSH error message | 15:07:35 |
prince213 | I have the keys in my home directory (for testing) | 15:08:16 |
prince213 | And macOS Sandbox will kill ssh because it tries to access my home directory | 15:08:42 |
cpick | Does anyone have a go-to one-liner or simple way to run a NixOS VM on darwin? I'm imagining something like (but, you know, functional):
$ nix run nixpkgs#nixos.config.system.build.vm
| 18:34:08 |
Zhaofeng Li | it should actually kind of work, with --system aarch64-linux , etc (basically what https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/profiles/nix-builder-vm.nix) does | 18:36:32 |
cpick | I figure there has to be a way to do it, but haven't figured out the exact incantation yet (I think, specifically, I need to find a nixos configuration to call .config.system.build.vm on)? | 18:38:52 |
Zhaofeng Li | the entrypoint is here https://github.com/NixOS/nixpkgs/blob/9807714d6944a957c2e036f84b0ff8caf9930bc0/pkgs/top-level/darwin-packages.nix#L182-L208 | 18:39:26 |
Zhaofeng Li | virtualization.host gives it the darwin pkgs for qemu and stuff | 18:40:00 |
Zhaofeng Li | I think the easiest way is to just override it, depending on how bespoke you want your setup to be | 18:40:46 |
cpick | nix run nixpkgs#darwin.linux-builder is pretty good (it does its hokey SSH-key setup, but that's not too bad). Thanks! | 18:42:35 |
Zhaofeng Li | yeah, if you just want a builder it works okay-ish | 18:44:52 |
cpick | I'm a bit partial to this one ;) | 18:45:25 |
cpick | (I actually had been ssh ing into my rosetta builder VM for all my Linux VM needs, but I wanted a easier way to blow away the image after doing one-off experiments and darwin.linux-builder should do nicely.) | 18:46:24 |
JoelMcCracken | so would these be, like, actual nixos vms? | 20:00:22 |
JoelMcCracken | I was trying to find a docker container that ran nixos at one point and it was very hard | 20:01:41 |
antifuchs | Yup, they’re aarch64-linux on an apple silicon Mac | 20:31:31 |
antifuchs | (The Rosetta builder is an x86-64) | 20:31:44 |
12 Jul 2025 |
Ihar Hrachyshka | you can also try to experiment with nixos-generators if you are interested in building images for alternative hypervisors like virtualbox or vmware... I just started looking into this, but basically a build gives you a .ovf file that you can import wherever and run. (e.g. as experiment I'm taking images to my NAS with crappy OS but that has virtualbox and run there.) | 01:03:38 |
commiterate | Redacted or Malformed Event | 05:31:20 |
commiterate | you can't run NixOS in a container since systemd needs too many privileges (well, unless you used privileged containers which is a security problem). The official nixos/nix container is just a barebones container with just Nix installed. | 05:31:48 |
| @fractivore:cyberia.club left the room. | 05:32:47 |
commiterate | nixos-generators relies on NixOS's make-disk-image which relies on QEMU. It can be a bit slow without KVM.
Building images with systemd-repart is probably preferred and allows for more flexibility: https://nixos.org/manual/nixos/stable/#sec-image-repart
| 05:44:37 |
commiterate | * you can't run NixOS in a container since systemd needs too many privileges (well, unless you used privileged containers which is a security problem). The official nixos/nix container is a barebones container with just Nix installed. | 05:49:20 |
commiterate | * you can't run NixOS in a container since systemd needs too many privileges (well, unless you use privileged containers which is a security problem). The official nixos/nix container is a barebones container with just Nix installed. | 05:50:30 |
| Rommel Martínez changed their profile picture. | 05:54:43 |
| Rommel Martínez changed their profile picture. | 05:58:44 |
commiterate | * nixos-generators relies on NixOS's make-disk-image which relies on QEMU VMs. It can be a bit slow without KVM.
Building images with systemd-repart is probably preferred and allows for more flexibility: https://nixos.org/manual/nixos/stable/#sec-image-repart
| 06:00:15 |