Skip to content

Fix nix-shell for derivation with multiple outputs - #230

Closed
redbaron wants to merge 1 commit into
NixOS:masterfrom
redbaron:fix-nix-shell-for-multioutput
Closed

redbaron wants to merge 1 commit into
NixOS:masterfrom
redbaron:fix-nix-shell-for-multioutput

Conversation

@redbaron

Copy link
Copy Markdown
Contributor

If derivation declares multiple outputs and first (default) output
if not "out", then "nix-instantiate" calls return path with output
names appended after "!". Than suffix must be stripped before
ant path checks are done.

If derivation declares multiple outputs and first (default) output
if not "out", then "nix-instantiate" calls return path with output
names appended after "!". Than suffix must be stripped before
ant path checks are done.
@edolstra

Copy link
Copy Markdown
Member

Applied!

@edolstra edolstra closed this Mar 29, 2014
@redbaron
redbaron deleted the fix-nix-shell-for-multioutput branch March 30, 2014 07:05
zolodev pushed a commit to zolodev/nix that referenced this pull request Jan 1, 2024
Set up dev env RITZA language edit
P-E-Meunier pushed a commit to P-E-Meunier/nix that referenced this pull request Feb 26, 2025
…kspace/generic-array-0.12.4

Bump generic-array from 0.12.3 to 0.12.4 in /sample_workspace
CertainLach pushed a commit to deltarocks/nix that referenced this pull request Nov 4, 2025
…211-evaluator-may-hang-when-using-builtinsparallel

printValueAsJSON(): Don't wait for futures
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 24, 2026


Seven candidates filed across six section files, raising the
catalog total to 233 + 44:

- NixOS#227 EvalProfiler NVI cache + default no-op virtuals dead
  post-NixOS#204                                  → 20-eval-core-cache-attrset-profiler.md
- NixOS#228 bitAnd/bitOr/bitXor twin family adjacent to
  primNumeric<NumOp>                         → 08-duplicated-parsers.md
- NixOS#229 SeenSet = set<const void *> widening
  type-erasure regression                    → 13-libexpr-extras.md
- NixOS#230 GitArchive subclass DRY-ing post-NixOS#51
  trim                                       → 03-repeated-boilerplate.md
- NixOS#231 nix-env --priority hand-rolled
  getArg+string2Int pattern                  → 11-legacy-cli.md
- #232 ignoreExceptionInDestructor
  non-destructor audit (~17 libstore sites)  → 07-dead-stale-code.md
- NixOS#233 schema-migration-style scaffolding
  thrice (cross-shard)                       → 17-cross-cutting.md

Each entry carries a verdict, effort, and cross-refs back to its
parent candidate (NixOS#67 / NixOS#110 / NixOS#51 / NixOS#128 / NixOS#58 / NixOS#55 etc.) so the
discovery context survives.

Catalog header tables and INVENTORY/STATUS totals updated to
reflect the 226 → 233 bump. FOLLOWUPS.md Batch D struck.

No code change; doc-branch only.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 25, 2026
…itArchiveInputScheme

After NixOS#51 trimmed RefInfo down to a single Hash field and removed the
abandoned tree-hash propagation, the duplication across the three
GitArchive-derived schemes (GitHubInputScheme, GitLabInputScheme,
SourceHutInputScheme) became legible. Four shapes recurred without a
shared helper:

  (a) Host default: maybeGetStrAttr(input.attrs, "host").value_or(...)
      — repeated 7+ times across the three subclasses, each spelling
      its own forge default ("github.com" / "gitlab.com" / "git.sr.ht").
  (b) Owner / repo lookups: getStrAttr(input.attrs, "owner") /
      getStrAttr(input.attrs, "repo") — extracted as helpers only on
      GitHubInputScheme; GitLab and SourceHut inlined the call 4-6×
      each.
  (c) clone() body: identical shape across all three subclasses —
      "git+https://%s/%s/%s[.git]" with applyOverrides + .clone() —
      differing only in the host default (covered by (a)) and whether
      the URL has a ".git" suffix (GitHub/GitLab keep it; SourceHut
      omits).
  (d) getDownloadUrl shape: each subclass had its own
      maybeGetStrAttr/value_or call before the URL fmt(...).

Promote `getHost(Input)`, `getOwner(Input)`, `getRepo(Input)`, and a
defaulted-virtual `cloneUrlSuffix()` (default ".git", overridden to
"" by SourceHut) onto GitArchiveInputScheme. Promote `clone()` from
the three subclasses to a single base-class implementation.
Subclasses now declare only the load-bearing differences:

  - GitHubInputScheme: defaultHost() = "github.com"
  - GitLabInputScheme: defaultHost() = "gitlab.com"
  - SourceHutInputScheme: defaultHost() = "git.sr.ht",
    cloneUrlSuffix() = ""

The three getDownloadUrl bodies still differ structurally (different
URL formats and rate-limiting notes) so they stay per-subclass; they
now read getHost/getOwner/getRepo instead of inlining the
maybeGetStrAttr/getStrAttr calls.

Behavioural change: zero. Every emitted URL string and clone command
matches the pre-batch output for every (subclass, host, owner, repo,
ref, rev) tuple.

Refs candidate NixOS#230.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 25, 2026
After the cross-shard cleanup landed, fan out the post-review
punch-list across single-shard commits. Three trivials (NixOS#183,
NixOS#231, NixOS#235) and three smalls (NixOS#226, NixOS#230, NixOS#234) shipped; three
rejected per body-edit verdicts (NixOS#168 superseded, NixOS#219 dead-code
defence, NixOS#236 declined); one deferred (NixOS#225 needs a libutil
helper that would create a third cross-shard violation if
bundled).

STATUS cleanup-branches table updated with the new tip SHAs:
- libstore   80fd74bca (was ec50b5b)
- libutil    190b08372 (was fdb46ab33)
- libfetchers 12a17bb65 (was d1a856c)
- nix-cli    24ebbcc (was 2a34c31)
plus the new candidate references (NixOS#183, NixOS#231, NixOS#235 on nix-cli;
NixOS#226 on libutil; NixOS#230 on libfetchers; NixOS#234 on libstore).

NixOS#235 carries a user-visible behaviour change: nix-store --realise
now warns about missing --add-root regardless of store type
(matching nix-instantiate's existing behaviour). rl-next entry
ships on the same branch.

Final cross-shard audit: zero true violations. The few remaining
multi-directory commits are either consumer call-site adoption
(libflake/libmain → src/nix/) which is the normal "ripple" pattern,
or internal-api-docs/source pairs which are auto-updated when
public surface changes — neither blocks independent landing.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 25, 2026
…de-off + STATUS

Adversarial review of the Batch H code + the cross-shard cleanup
caught one real bug (NixOS#234 thread-safety, fixed on libstore branch
in commit 689effee2) and several documentation gaps. This commit
records the documentation fixes.

Six shipped candidates were missing **Branch:** lines in their
catalog bodies, leaving a reader of the candidate body unable to
find where each shipped:

  NixOS#183 → 18-daemon-protocol-audit.md (libstore)
  NixOS#226 → 12-libutil-libstore-core-extras.md (libutil)
  NixOS#230 → 03-repeated-boilerplate.md (libfetchers)
  NixOS#231 → 11-legacy-cli.md (nix-cli)
  NixOS#234 → 12-libutil-libstore-core-extras.md (libstore)
  NixOS#235 → 11-legacy-cli.md (nix-cli)

Each Branch line now describes what landed and where, with the
specific implementation choices that diverge from the candidate's
original sketch (e.g., NixOS#235's call-site-only fix versus the
candidate's GcRootNamer-coupling proposal; NixOS#234's std::unique_ptr
values for pointer-stability instead of holding the lock through
the signing call).

NixOS#119 and NixOS#221's Branch lines (already correctly pointing at the
libutil branch post-cross-shard cleanup) gained an explicit
trade-off discussion. The libutil header halves of both
candidates currently have zero in-tree consumers (waiting on
queued NixOS#239/NixOS#240 to land after libutil merges upstream).
Structurally similar to the libutil NixOS#163 revert, but
differentiated by: (a) the consumers are filed and tracked, not
hypothetical; (b) the original implementation was bundled and
shipped before the cross-shard cleanup split it; (c) the gap is
bounded by upstream merge ordering. Decision recorded: accept
the trade-off, ship the libutil header now, land NixOS#239/NixOS#240
immediately after libutil merges. Re-evaluate if libutil fails
to merge upstream within the catalog work's expected lifetime.

A minor information-loss regression in NixOS#230 was caught and
fixed: the GitLab `// FIXME: get username somewhere` comment was
attached to the inline `clone()` body in the original
GitLabInputScheme, and got dropped when `clone()` was hoisted to
the base class. Restored as a class-level comment on
GitLabInputScheme so future readers see the GitLab-specific
concern about clone URLs needing a username for some HTTPS-clone
setups. Amended in libfetchers commit 572e8fd (was 12a17bb65).

STATUS.md updated:
- libstore tip moves from 80fd74bca to 689effee2 (NixOS#234 amend)
- libfetchers tip moves from 12a17bb65 to 572e8fd (NixOS#230 amend)
- libstore row NixOS#234 description tightened to mention pointer-
  stability via std::unique_ptr
- libfetchers row NixOS#230 description mentions the FIXME preservation
- New "Post-batch-H adversarial review" recently-completed entry
  summarising the bug fix + doc-gap closures + trade-off note

Other five cleanup branches unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Ma27 pushed a commit to Ma27/nix that referenced this pull request Oct 4, 2026
Based on `nix-info` and `nix --version` output.

Contributes towards NixOS#230.

Change-Id: I13bb9608b733e10037c6816456b5312e712c18ad
Signed-off-by: Raito Bezarius <[email protected]>
Ma27 pushed a commit to Ma27/nix that referenced this pull request Oct 4, 2026
We try to access to the Flake registry, if we are failing, it's hosed.
Otherwise, let's record some facts we can reuse later.

Towards NixOS#230.

Change-Id: I80dd8272d5c27f7f7ff01052e3487a0496ee29fc
Signed-off-by: Raito Bezarius <[email protected]>
Ma27 pushed a commit to Ma27/nix that referenced this pull request Oct 4, 2026
Some issues are caused by users confused about their ambient search
paths, let's analyze the current configuration and make it awfully
obvious what is going on.

Towards NixOS#230.

Change-Id: I953ef3feaefc56cee68623c5aaa4d568ba1fd034
Signed-off-by: Raito Bezarius <[email protected]>
Ma27 pushed a commit to Ma27/nix that referenced this pull request Oct 4, 2026
Many issues stems from `<nixpkgs>` not resolving anywhere or having the
wrong version, let's make it awfully obvious again here.

Towards NixOS#230.

Change-Id: If630e9616566e77143f028cdcfe0b7f00a1d486d
Signed-off-by: Raito Bezarius <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants