Gabriella439 / nixos-in-production

Source files for the book "NixOS in Production"
Other
485 stars 20 forks source link

VM doesn't build on `x86_64-darwin` #2

Closed wbadart closed 1 year ago

wbadart commented 1 year ago

Hey Gabriella- really excited about this book! Not sure if you're targeting/ supporting Mac for the examples, but if you are, just wanted to report that the VM, with the bare-bones initial module.nix

{ users.users.root.initialPassword = "";
}

doesn't build on my Mac. I see the error:

error: a 'x86_64-linux' with features {} is required to build '/nix/store/y7p5zng5gxxp5hp2wa34amgljjvkwhy5-append-initrd-secrets.drv', but I am a 'x86_64-darwin' with features {benchmark, big-parallel, nixos-test}

I think I'm working off 5c6664e. Here's my system info:

 - system: `"x86_64-darwin"`
 - host os: `Darwin 22.1.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.14.0`
Gabriella439 commented 1 year ago

Yeah, I'm definitely targeting macOS and I commit to making sure that example works on macOS.

I just want to double-check that you first followed the instructions in this section:

https://github.com/Gabriella439/nixos-in-production/blob/main/manuscript/Setup.md#macos-specific-instructions

… which link to here:

https://nixos.org/manual/nixpkgs/stable/#sec-darwin-builder

In other words, there are two virtual machines involved here on macOS:

wbadart commented 1 year ago

Totally missed that bit on darwin.builder 😅 Lemme run through that and get back to you!

Gabriella439 commented 1 year ago

I can make that section more prominent so that people are less likely to miss it

wbadart commented 1 year ago

I mean, the section had a bit of an awkward column break at the width I was reading it, but looking back, I do think the bold subheader "macOS-specific instructions" is sufficient. It's just early for me at the moment!

That all said, I am seeing a new error now:

Failed to find a machine for remote build!
derivation: y7p5zng5gxxp5hp2wa34amgljjvkwhy5-append-initrd-secrets.drv
required (system, features): (x86_64-linux, [])
1 available machines:
(systems, maxjobs, supportedFeatures, mandatoryFeatures)
([x86_64-linux], 8, [], [])

though I'm sure that has more to do with my machine-specific setup than it does with the instructions in the book.

Gabriella439 commented 1 year ago

Does the build still continue when it logs that message? The reason I ask is that there is a known issue where Nix will display that error even though it's benign and doesn't halt the build. See:

https://github.com/NixOS/nix/issues/6263

wbadart commented 1 year ago

Interesting. In my case, it does fail the build:

image

wbadart commented 1 year ago

It's odd to me that the details given for the "1 available machines" seem to meet the derivation's requirements

wbadart commented 1 year ago

Looks like the builder isn't running, even after kickstarting the daemon and rebooting the machine:

$ ssh builder@localhost
ssh: connect to host localhost port 22: Connection refused

$ nc -v localhost 22
nc: connectx to localhost port 22 (tcp) failed: Connection refused
nc: connectx to localhost port 22 (tcp) failed: Connection refused
wbadart commented 1 year ago

(sorry for the spam)

Looks like I'm in the clear if I run nix run nixpkgs#darwin.builder in the background

image

Gabriella439 commented 1 year ago

No worries! This will be helpful context for anyone who runs into a similar issue and it also helps me clarify the instructions