News for hackers. Stuff that matters.
Re:Lightweight Alpine VMs on macOS by nickcox on Monday November 28, 2022 @01:18AM (#33770345)
To be fair, you'll run into issues with Docker Desktop too though. I've found Rancher Desktop to be as reliable or better than Docker for my needs.
Re:Lightweight Alpine VMs on macOS by nextos on Monday November 28, 2022 @09:31AM (#33774011)
Why not using Nix? No container needed, so it's much simpler, and the software selection for aarch64 (i.e. M1) is enormous.
Re:Lightweight Alpine VMs on macOS by behnamoh on Monday November 28, 2022 @10:56AM (#33775171)
Doesn't NixOS require reboot after each software install? I don't remember the last time I restarted my Mac or even PC.
Re:Lightweight Alpine VMs on macOS by e44858 on Monday November 28, 2022 @11:12AM (#33775381)
No
Re:Lightweight Alpine VMs on macOS by geofft on Monday November 28, 2022 @12:39PM (#33776651)
I believe NixOS does not (there's a "nixos-rebuild switch" command that sounds vaguely like it requires a reboot, and NixOS does aim for declarative confgs, but it knows how to restart services etc. without rebooting your whole machine - see chapter 3 of the NixOS manual: https://nixos.org/manual/nixos/stable/index.html#sec-changin...)

But the proposal here isn't about running NixOS as your OS, since we're talking about macOS. It's about using Nix as an additional package/environment manager on top of another OS/kernel, in this case macOS, though of course Linux is well-supported too.

Each file in Nix is stored in a path that's computed based on the hash of the relevant source code, and depends on other files (e.g., libraries) via their hash-based paths, too. So you can straightforwardly have multiple execution environments with their own dependencies that don't interfere. It's an alternative approach to the container approach for the same problem: containers leave paths alone, but create a new root filesystem for each container. Nix programs all share one root filesystem, but modify the paths so nothing uses e.g. /usr/bin or /usr/lib.

Precisely because Nix binaries isolate themselves from /usr and carry their own dependencies, the Nix packaging repo "nixpkgs" can be used on any Linux machine, not just NixOS ones. And the Nix folks also build nixpkgs for macOS, so most software in nixpkgs can be installed on a macOS machine too. This gets you a solution to the dependency problem on macOS itself (because there are no Linux-style containers on macOS). If you want, it also gets you a relatively consistent dev environment for applications that will be eventually deployed on Linux: although the kernel is different and of course the binaries are compiled for different kernels, the entire userspace can be the same on macOS and Linux.

Re:Lightweight Alpine VMs on macOS by nextos on Monday November 28, 2022 @07:24PM (#33781926)
nixos-rebuild switch does not require a reboot. In fact, you'd typically use nixos-rebuild boot if you don't want immediate changes.

For very complicated reconfigurations, it might be advisable to reboot if that involves changes to services that are only started during boot time. But that's the case for nearly any OS...

Re:Lightweight Alpine VMs on macOS by nextos on Monday November 28, 2022 @07:21PM (#33781893)
I mean Nix on a Mac, as a package manager, not full NixOS. Linux is still not totally ready on M1 machines.

And of course it does not require a reboot.