3 ms·
https://wiki.archlinux.org/index.php/Systemd-nspawn#Examples https://wiki.archlinux.org/index.php/Systemd-nspawn#Examples I don't see a Nix example there, but
by newnewpdro 7y ago
https://wiki.archlinux.org/index.php/Systemd-nspawn#Examples https://wiki.archlinux.org/index.php/Systemd-nspawn#Examples
I don't see a Nix example there, but the NixOS github looks to have some issues already surrounding provisioning Nix for use in containers.
Containers are a great way to explore a distro without messing with your host, you can at least check out their user space, filesystem layout, and package tooling. The main shortcoming is you don't get to see any kernel-specific features, since you're essentially chrooting into the other distro's rootfs.
There's always VMs too...
- takeda 7y agoI haven't used NixOS outside of VirtualBox, but plan to use it for my next Linux setup. I believe the reason for build-vm is that systemd is central part of NixOS and you can't test it by starting it inside of a container (I don't think systemd even allows it). The nixos-rebuild command actually creates a path with a new configuration, so you could similarly use nspawn and go there. When you use "nixos-rebuild switch" it updates "/run/current-system" symlink to that new location.
- newnewpdro 7y agosystemd is container-aware, you should be able to directly "boot" nix containers then using tooling like systemd-nspawn, and login/manage using machinectl. It will all "just work" with systemd on both sides.
- takeda 7y agoI see, was not aware of it, although perhaps it might be possible to do it now: https://github.com/NixOS/nixpkgs/pull/67232 https://github.com/NixOS/nixpkgs/pull/67232