From 66b29137978dcca809ffdfba8d9d7d7f7f6a114b Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 19 Nov 2023 20:56:15 +0100 Subject: [PATCH 1/3] darwin.linux-builder: Disable evaluation A remote builder does not need to evaluate anything, so let's trim it down to (eventually) save some space, and make the purpose of the builder clear. Users should evaluate on the host instead. --- nixos/modules/profiles/macos-builder.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nixos/modules/profiles/macos-builder.nix b/nixos/modules/profiles/macos-builder.nix index d48afed18f7ea..5454b29f2eb9f 100644 --- a/nixos/modules/profiles/macos-builder.nix +++ b/nixos/modules/profiles/macos-builder.nix @@ -103,6 +103,16 @@ in # server that QEMU provides (normally 10.0.2.3) networking.nameservers = [ "8.8.8.8" ]; + # The linux builder is a lightweight VM for remote building; not evaluation. + nix.channel.enable = false; + # remote builder uses `nix-daemon` (ssh-ng:) or `nix-store --serve` (ssh:) + # --force: do not complain when missing + # TODO: install a store-only nix + # https://github.com/NixOS/rfcs/blob/master/rfcs/0134-nix-store-layer.md#detailed-design + environment.extraSetup = '' + rm --force $out/bin/{nix-instantiate,nix-build,nix-shell,nix-prefetch*,nix} + ''; + nix.settings = { auto-optimise-store = true; From 64b587e3e22dc078cd4c73d2d8f5331d8321ae65 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 19 Nov 2023 21:21:16 +0100 Subject: [PATCH 2/3] nixos/system.disableInstallerTools: Do define options without effect These won't cause anything to appear in toplevel. --- nixos/modules/installer/tools/tools.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nixos/modules/installer/tools/tools.nix b/nixos/modules/installer/tools/tools.nix index 15e10128ac9a4..9ccc76a82c95a 100644 --- a/nixos/modules/installer/tools/tools.nix +++ b/nixos/modules/installer/tools/tools.nix @@ -130,7 +130,7 @@ in ''; }; - config = lib.mkIf (config.nix.enable && !config.system.disableInstallerTools) { + config = lib.mkMerge [ (lib.mkIf (config.nix.enable && !config.system.disableInstallerTools) { system.nixos-generate-config.configuration = mkDefault '' # Edit this configuration file to define what should be installed on @@ -257,10 +257,13 @@ in documentation.man.man-db.skipPackages = [ nixos-version ]; + }) + + # These may be used in auxiliary scripts (ie not part of toplevel), so they are defined unconditionally. + ({ system.build = { inherit nixos-install nixos-generate-config nixos-option nixos-rebuild nixos-enter; }; - - }; + })]; } From f3e9d7f84bfc569b5bf85c43d1b25d8770b0d7b4 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 19 Nov 2023 21:24:27 +0100 Subject: [PATCH 3/3] darwin.linux-builder: Disable installer tools --- nixos/modules/profiles/macos-builder.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/profiles/macos-builder.nix b/nixos/modules/profiles/macos-builder.nix index 5454b29f2eb9f..6c2602881d6b5 100644 --- a/nixos/modules/profiles/macos-builder.nix +++ b/nixos/modules/profiles/macos-builder.nix @@ -112,6 +112,9 @@ in environment.extraSetup = '' rm --force $out/bin/{nix-instantiate,nix-build,nix-shell,nix-prefetch*,nix} ''; + # Deployment is by image. + # TODO system.switch.enable = false;? + system.disableInstallerTools = true; nix.settings = { auto-optimise-store = true;