nixos/documentation: Allow specifying extraSources #81557
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because there was absolutely no way of setting this without rewriting parts of the module otherwise.
Motivation for this change
When using https://github.com/DBCDK/morph with NixOS machines specifying
documentation.nixos.includeAllModules = true;
, the manuals of NixOS instantations were impure & repeatedly rebuilding due to both morph's use of temporary directories & Nixpkgs modules and the normal location of the morph network's repository being in a user's home directory along with our definition of Nixpkgs modules. Some examples from these manual builds:NixOS's documentation machinery has a configuration option to deal with this,
extraSources
, but it's not exposed, and the expressions aren't structured in a way to allow sneaky, underhanded configuration either. You can't get around this without patching Nixpkgs. (This PR has been tested so far on our repository via applyingpkgs.applyPatches { src = nixpkgs.outPath; patches = [ ./nixpkgs-nixos-expose-extrasources.patch ]; }
before importing Nixpkgs. (Whee.))With this change in place, the repository-directory impurity demonstrated can be eliminated with
nixos.extraSources = [ ./. ];
from the repository root, and the morph impurity with an (approximate) patch to/data/eval-machines.nix
of:Sorry for the delay on PRing this; I know this should have been in way earlier for 20.03's sake. If possible, I'd like to get this backported to 20.03 for sanity in situtations like morph when
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)This change is