NixOS virtual machines on macOS: Difference between revisions

Thu (talk | contribs)
Document how to install Nix, nix-darwin, and direnv on a macOS system
Thu (talk | contribs)
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
The [https://github.com/LnL7/nix-darwin nix-darwin] project aims to bring the convenience of a declarative system approach to macOS. nix-darwin is built up around Nixpkgs, quite similar to NixOS.
NixOS is based on Linux, but a lot of developers are using MacBooks. The [https://github.com/LnL7/nix-darwin nix-darwin] project aims to bring the convenience of a declarative system approach to macOS and it is built around Nixpkgs (much like NixOS). After installing Nix, <code>nix-darwin</code> will help us with the following goals:
 
== Getting started ==
To install Nix-darwin, first install Nix on the fresh macOS machine.
 
Then run:
 
<syntaxhighlight lang="console">
$ nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
$ ./result/bin/darwin-installer
</syntaxhighlight>
 
== NixOS virtual machines on macOS ==
 
NixOS is based on Linux, but a lot of developers are using MacBooks.
 
With Nix on macOS, we can do these things:


# Build a complete NixOS (Linux) system.
# Build a complete NixOS (Linux) system.
Line 38: Line 22:
that the Linux builder is actually such a virtual machine.
that the Linux builder is actually such a virtual machine.


Point 4 is similar to point 3, but since the tests are _built_ using virtual
Point 4 is similar to point 3, but since the tests are '''built''' using virtual
machines, it means that these virtual machines are running inside the Linux
machines, it means that these virtual machines are running inside the Linux
builder. This is not a problem if our environment supports nested
builder. This is not a problem if our environment supports nested
Line 306: Line 290:


* "Build and Deploy Linux Systems from macOS" on the [https://nixcademy.com/posts/macos-linux-builder/ Nixcademy Blog].
* "Build and Deploy Linux Systems from macOS" on the [https://nixcademy.com/posts/macos-linux-builder/ Nixcademy Blog].
[[Category:macOS]]
[[Category:nix-darwin]]
[[Category:Tutorial]]