about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorRaito Bezarius <masterancpp@gmail.com>2022-11-30 18:24:11 +0100
committerCole Helbling <cole.e.helbling@outlook.com>2022-12-08 13:50:05 -0800
commit680369e504e9c241fdbd1d7621a7c3011649edcc (patch)
tree0d914137ffbe8e729018ace38767d576511dec25 /nixos/modules/system
parent11dfbee0a4a2309515608a890e91d4d1a2a43626 (diff)
nixos/activation/bootspec: add some comments to explain the delicate manipulations
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/activation/bootspec.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/system/activation/bootspec.nix b/nixos/modules/system/activation/bootspec.nix
index 170c07e7daf74..2d4f7158dd46e 100644
--- a/nixos/modules/system/activation/bootspec.nix
+++ b/nixos/modules/system/activation/bootspec.nix
@@ -38,6 +38,9 @@ let
         ''
           mkdir -p $out/bootspec
 
+          # Inject toplevel and init in the bootspec.
+          # This can be done only here because we *cannot* depend on $out, except
+          # by living in $out itself.
           ${pkgs.jq}/bin/jq '
             .v1.toplevel = $toplevel |
             .v1.init = $init
@@ -47,7 +50,7 @@ let
             --arg init "$out/init" \
             < ${json} \
             | ${pkgs.jq}/bin/jq \
-              --sort-keys \
+              --sort-keys \ # Slurp all specialisations and inject them as values in .specialisations.{name} = {specialisation bootspec}.
               '.v1.specialisation = ($ARGS.named | map_values(. | first | .v1))' \
               ${lib.concatStringsSep " " specialisationLoader} \
             > $out/bootspec/${filename}