Skip to content

Commit

Permalink
Better test of when to include outputs option
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Oct 18, 2024
1 parent b6ccbf7 commit 2365ff6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions nix/choose-meta.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
contents:

let
hasNontrivialOutputs = (contents.outputs or null) != null;
# Test if the derivation has a single output
hasSimpleOutputs =
lib.hasAttr "outputName" contents
&& lib.hasAttr "outputs" contents
&& [contents.outputName] == contents.outputs;

includeOutputsOption = !hasSimpleOutputs && ((contents.outputs or null) != null);

in

Expand Down Expand Up @@ -38,10 +44,10 @@ in
has_packages = contents.meta.hasPackages;
}) // (lib.optionalAttrs (lib.hasAttrByPath ["meta" "lessCommon"] contents) {
less_common = contents.meta.lessCommon;
}) // (lib.optionalAttrs ((contents ? "settingsSchema") || hasNontrivialOutputs) {
}) // (lib.optionalAttrs ((contents ? "settingsSchema") || includeOutputsOption) {
settings_schema =
(contents.settingsSchema or {})
// lib.optionalAttrs hasNontrivialOutputs {
// lib.optionalAttrs includeOutputsOption {
outputs = {
title = "Outputs";
description = "Package outputs to include.";
Expand Down

0 comments on commit 2365ff6

Please sign in to comment.