nixpkgs/nixos/modules/profiles
Winter 747c55e702 nixos/profiles/nix-builder-vm: allow the system derivation to be substituted
Consider a user wanting to set up the Linux builder for the first time,
but with a slightly more generous allocation of resources compared to
the default. They'll do something like this:

```
{
  virtualisation.cores = 3;
  virtualisation.darwin-builder = {
    diskSize = 40 * 1024;
    memorySize = 4 * 1024;
  };
}
```

This will fail with an error like this:

```
error: a 'aarch64-linux' with features {} is required to build '/nix/store/3acpgmwqwnk8g2gc5r05ar2lvmn01b8a-builder.pl.drv', but I am a 'aarch64-darwin' with features {apple-virt, benchmark, big-parallel, nixos-test}
```

But why would they have to rebuild the NixOS system?! All they did was
change the arguments passed to QEMU, and nothing those options control
would affect the NixOS configuration itself... right?

`config.system.build.toplevel` is defined with `allowSubstitutes` set to
`false` by default, which makes it so that the toplevel can't be
substituted if Nix is trying to use it "directly." So because the above
example would have to rebuild the VM runner, which references toplevel
directly, Nix refuses to substitute it, unless `always-allow-substitutes
= true` is set as a Nix option. (In the case where the QEMU options
aren't changed at all, Nix just substitutes the runner, which sidesteps
this issue as the runner itself doesn't use toplevel as an input.)
2025-05-16 13:00:15 -04:00
..
keys
all-hardware.nix nixos: add option hardware.enableAllHardware 2024-12-12 16:45:25 +07:00
base.nix nixos/iso-image: Include latest kernel specialisation. 2025-03-16 01:38:37 -04:00
clone-config.nix treewide: format all inactive Nix files 2024-12-10 20:26:33 +01:00
docker-container.nix treewide: format all inactive Nix files 2024-12-10 20:26:33 +01:00
graphical.nix treewide: format all inactive Nix files 2024-12-10 20:26:33 +01:00
hardened.nix Revert "nixos/profiles/hardened: don't enable by default" 2025-02-19 19:53:15 +03:00
headless.nix treewide: format all inactive Nix files 2024-12-10 20:26:33 +01:00
image-based-appliance.nix nixos/profiles: add image-based-appliance profile 2023-10-28 13:26:39 +02:00
installation-device.nix treewide: Format all Nix files 2025-04-01 20:10:43 +02:00
macos-builder.nix treewide: format all inactive Nix files 2024-12-10 20:26:33 +01:00
minimal.nix Remove with lib from minimal profile; group config 2024-12-14 15:13:26 -05:00
nix-builder-vm.nix nixos/profiles/nix-builder-vm: allow the system derivation to be substituted 2025-05-16 13:00:15 -04:00
perlless.nix nixos/perlless: only disable installer tools that introduce perl 2025-03-09 23:24:20 +00:00
qemu-guest.nix treewide: format all inactive Nix files 2024-12-10 20:26:33 +01:00