diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2016-01-13 11:49:19 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2016-01-13 12:03:18 +0100 |
commit | b9f6dfe8c5c8da09b6c2d8a8e168bdcf50a0aabd (patch) | |
tree | 497355a44e942909921a8c2e5f76ec211f85d883 /nixos/release.nix | |
parent | 7dba3bafba219ec6dc2c3a1b44f9d574837b5fe5 (diff) |
nixos manuals: allow displaying package references
The manuals are now evaluated with each derivation in `pkgs` (recursively)
replaced by a fake with path "\${pkgs.path.to.the.attribute}".
It isn't perfect, but it seems to cover a vast majority of use cases.
Caveat: even if the package is reached by a different means,
the path above will be shown and not e.g. `${config.services.foo.package}`.
As before, defaults created by `mkDefault` aren't displayed,
but documentation shouldn't (mostly) be a reason to use that anymore.
Note: t wouldn't be enough to just use `lib.mapAttrsRecursive`,
because derivations are also (special) attribute sets.
Diffstat (limited to 'nixos/release.nix')
-rw-r--r-- | nixos/release.nix | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/nixos/release.nix b/nixos/release.nix index 8a502ae2baa1..780ac56edf11 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -92,15 +92,33 @@ let }).config)); + cleanConfig = import ./lib/eval-config.nix { + system = "x86_64-linux"; + modules = [ ]; + pkgs = with pkgs.lib; + let + scrubDerivations = namePrefix: pkgSet: mapAttrs + (name: value: + let wholeName = "${namePrefix}.${name}"; in + if isAttrs value then + scrubDerivations wholeName value + // (optionalAttrs (isDerivation value) { outPath = "\${${wholeName}}"; }) + else value + ) + pkgSet; + in scrubDerivations "pkgs" pkgs; + }; + docs = (import ./doc/manual) { + inherit pkgs version; + revision = versionModule.system.nixosRevision; + inherit (cleanConfig) options; + }; + in rec { channel = import lib/make-channel.nix { inherit pkgs nixpkgs version versionSuffix; }; - manual = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manual); - manualPDF = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manualPDF)).x86_64-linux; - manpages = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.manpages); - options = (buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.manual.optionsJSON)).x86_64-linux; - + inherit (docs) manual manualPDF manpages optionsJSON; # Build the initial ramdisk so Hydra can keep track of its size over time. initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk); |