diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2023-10-19 13:26:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 13:26:22 +0200 |
commit | 4b5b27c7ca864ab7984b26ddc6f6ac6fdccb3626 (patch) | |
tree | ce618d633b73f5116a33bafdf3120972227a0f6a | |
parent | 6be2c349a30fcb489a3153dd331e9df387ab6449 (diff) | |
parent | 508c310222b7f07ad9cf6752fdd5c1af59a37061 (diff) | |
download | nixpkgs-4b5b27c7ca864ab7984b26ddc6f6ac6fdccb3626.tar nixpkgs-4b5b27c7ca864ab7984b26ddc6f6ac6fdccb3626.tar.gz nixpkgs-4b5b27c7ca864ab7984b26ddc6f6ac6fdccb3626.tar.bz2 nixpkgs-4b5b27c7ca864ab7984b26ddc6f6ac6fdccb3626.tar.lz nixpkgs-4b5b27c7ca864ab7984b26ddc6f6ac6fdccb3626.tar.xz nixpkgs-4b5b27c7ca864ab7984b26ddc6f6ac6fdccb3626.tar.zst nixpkgs-4b5b27c7ca864ab7984b26ddc6f6ac6fdccb3626.zip |
Merge pull request #260770 from hercules-ci/darwin-builder-observable
`darwin.linux-builder`: Make more observable
-rw-r--r-- | doc/builders/special/darwin-builder.section.md | 14 | ||||
-rw-r--r-- | nixos/modules/profiles/macos-builder.nix | 8 |
2 files changed, 21 insertions, 1 deletions
diff --git a/doc/builders/special/darwin-builder.section.md b/doc/builders/special/darwin-builder.section.md index 13d01a0e3af..e37fabe01a3 100644 --- a/doc/builders/special/darwin-builder.section.md +++ b/doc/builders/special/darwin-builder.section.md @@ -157,3 +157,17 @@ in the example below and rebuild. You may make any other changes to your VM in this attribute set. For example, you could enable Docker or X11 forwarding to your Darwin host. +## Troubleshooting the generated configuration {#sec-darwin-builder-troubleshoot} + +The `linux-builder` package exposes the attributes `nixosConfig` and `nixosOptions` that allow you to inspect the generated NixOS configuration in the `nix repl`. For example: + +``` +$ nix repl --file ~/src/nixpkgs --argstr system aarch64-darwin + +nix-repl> darwin.linux-builder.nixosConfig.nix.package +«derivation /nix/store/...-nix-2.17.0.drv» + +nix-repl> :p darwin.linux-builder.nixosOptions.virtualisation.memorySize.definitionsWithLocations +[ { file = "/home/user/src/nixpkgs/nixos/modules/profiles/macos-builder.nix"; value = 3072; } ] + +``` diff --git a/nixos/modules/profiles/macos-builder.nix b/nixos/modules/profiles/macos-builder.nix index cc01b16960c..d48afed18f7 100644 --- a/nixos/modules/profiles/macos-builder.nix +++ b/nixos/modules/profiles/macos-builder.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, options, ... }: let keysDirectory = "/var/keys"; @@ -163,9 +163,15 @@ in in script.overrideAttrs (old: { + pos = __curPos; # sets meta.position to point here; see script binding above for package definition meta = (old.meta or { }) // { platforms = lib.platforms.darwin; }; + passthru = (old.passthru or { }) // { + # Let users in the repl inspect the config + nixosConfig = config; + nixosOptions = options; + }; }); system = { |