!lheuhImcToQZYTQTuI:nixos.org

Nix on macOS

1099 Members
“There are still many issues with the Darwin platform but most of it is quite usable.” — http://yves.gnu-darwin.org171 Servers

Load older messages


SenderMessageTime
11 Jul 2025
@prince213:matrix.orgprince213So I just switched to Lix15:02:09
@prince213:matrix.orgprince213 And now it says error: Nix daemon disconnected unexpectedly (maybe it crashed?) 15:02:15
@prince213:matrix.orgprince213Okay I think I know why15:06:57
@prince213:matrix.orgprince213And Lix did help by showing a better SSH error message15:07:35
@prince213:matrix.orgprince213I have the keys in my home directory (for testing)15:08:16
@prince213:matrix.orgprince213And macOS Sandbox will kill ssh because it tries to access my home directory15:08:42
@cpick:matrix.orgcpick

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:zhaofeng.liZhaofeng 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:matrix.orgcpick 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:zhaofeng.liZhaofeng Lithe entrypoint is here https://github.com/NixOS/nixpkgs/blob/9807714d6944a957c2e036f84b0ff8caf9930bc0/pkgs/top-level/darwin-packages.nix#L182-L20818:39:26
@zhaofeng:zhaofeng.liZhaofeng Li virtualization.host gives it the darwin pkgs for qemu and stuff 18:40:00
@zhaofeng:zhaofeng.liZhaofeng LiI think the easiest way is to just override it, depending on how bespoke you want your setup to be18:40:46
@cpick:matrix.orgcpick 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:zhaofeng.liZhaofeng Liyeah, if you just want a builder it works okay-ish18:44:52
@cpick:matrix.orgcpick I'm a bit partial to this one ;) 18:45:25
@cpick:matrix.orgcpick (I actually had been sshing 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:matrix.orgJoelMcCracken so would these be, like, actual nixos vms? 20:00:22
@JoelMcCracken:matrix.orgJoelMcCrackenI was trying to find a docker container that ran nixos at one point and it was very hard20:01:41
@antifuchs:asf.computerantifuchsYup, they’re aarch64-linux on an apple silicon Mac20:31:31
@antifuchs:asf.computerantifuchs(The Rosetta builder is an x86-64)20:31:44
12 Jul 2025
@ihar.hrachyshka:matrix.orgIhar Hrachyshkayou 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:matrix.orgcommiterateRedacted or Malformed Event05:31:20
@commiterate:matrix.orgcommiterate 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@fractivore:cyberia.club left the room.05:32:47
@commiterate:matrix.orgcommiterate

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:matrix.orgcommiterate * 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:matrix.orgcommiterate * 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.martinez:matrix.orgRommel Martínez changed their profile picture.05:54:43
@rommel.martinez:matrix.orgRommel Martínez changed their profile picture.05:58:44
@commiterate:matrix.orgcommiterate *

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

Show newer messages


Back to Room ListRoom Version: 6