From edef4868982e5a1ca3226231fb1a7eb292b4c96a Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 4 Jul 2023 20:46:42 +1000 Subject: [PATCH] darwin.linux-builder: rename from `darwin.builder` --- doc/builders/special/darwin-builder.section.md | 10 +++++++--- nixos/modules/profiles/macos-builder.nix | 2 +- pkgs/top-level/darwin-packages.nix | 6 +++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/builders/special/darwin-builder.section.md b/doc/builders/special/darwin-builder.section.md index 7c5c38bf85ee..13d01a0e3af8 100644 --- a/doc/builders/special/darwin-builder.section.md +++ b/doc/builders/special/darwin-builder.section.md @@ -1,9 +1,13 @@ -# darwin.builder {#sec-darwin-builder} +# darwin.linux-builder {#sec-darwin-builder} -`darwin.builder` provides a way to bootstrap a Linux builder on a macOS machine. +`darwin.linux-builder` provides a way to bootstrap a Linux builder on a macOS machine. This requires macOS version 12.4 or later. +The builder runs on host port 31022 by default. +You can change it by overriding `virtualisation.darwin-builder.hostPort`. +See the [example](#sec-darwin-builder-example-flake). + You will also need to be a trusted user for your Nix installation. In other words, your `/etc/nix/nix.conf` should have something like: @@ -14,7 +18,7 @@ extra-trusted-users = To launch the builder, run the following flake: ```ShellSession -$ nix run nixpkgs#darwin.builder +$ nix run nixpkgs#darwin.linux-builder ``` That will prompt you to enter your `sudo` password: diff --git a/nixos/modules/profiles/macos-builder.nix b/nixos/modules/profiles/macos-builder.nix index 554115705b64..83a849956182 100644 --- a/nixos/modules/profiles/macos-builder.nix +++ b/nixos/modules/profiles/macos-builder.nix @@ -177,7 +177,7 @@ in Please inspect the trace of the following command to figure out which module has a dependency on stateVersion. - nix-instantiate --attr darwin.builder --show-trace + nix-instantiate --attr darwin.linux-builder --show-trace ''); }; diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index a583b84b430d..f1d48814ebe2 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -3,6 +3,7 @@ , generateSplicesForMkScope, makeScopeWithSplicing , stdenv , preLibcCrossHeaders +, config }: let @@ -229,7 +230,7 @@ impure-cmds // appleSourcePackages // chooseLibs // { discrete-scroll = callPackage ../os-specific/darwin/discrete-scroll { }; # See doc/builders/special/darwin-builder.section.md - builder = lib.makeOverridable ({ modules }: + linux-builder = lib.makeOverridable ({ modules }: let toGuest = builtins.replaceStrings [ "darwin" ] [ "linux" ]; @@ -247,4 +248,7 @@ impure-cmds // appleSourcePackages // chooseLibs // { in nixos.config.system.build.macos-builder-installer) { modules = [ ]; }; + +} // lib.optionalAttrs config.allowAliases { + builder = throw "'darwin.builder' has been changed and renamed to 'darwin.linux-builder'. The default ssh port is now 31022. Please update your configuration or override the port back to 22. See https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder"; # added 2023-07-06 })