Skip to content

Add MANPATH handling to nix-profile - #229

Closed
redbaron wants to merge 1 commit into
NixOS:masterfrom
redbaron:profile-manpath
Closed

redbaron wants to merge 1 commit into
NixOS:masterfrom
redbaron:profile-manpath

Conversation

@redbaron

Copy link
Copy Markdown
Contributor

It makes man pages from installed nix packages available to host's
man utility.

It makes man pages from installed nix packages available to host's
man utility.
@edolstra

Copy link
Copy Markdown
Member

This is actually distribution-dependent. Some man implementations will automatically search in ../share/man relative to every $PATH directory, so you don't need to set $MANPATH. But I gues it doesn't hurt to set it explicitly.

@redbaron

Copy link
Copy Markdown
Contributor Author

yes it does, but only if MANPATH isn't set already. Some host packages can set it explicitly (like openpmi on my OpenSUSE system) and then access to nixpkgs man pages is lost

@redbaron

Copy link
Copy Markdown
Contributor Author

ping

@vcunat

vcunat commented Mar 18, 2014

Copy link
Copy Markdown
Member

On nixos this is set correctly by https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/environment.nix

In fact, I think in future it might be nice if each user/system environment exposed the variable values it expects to be set (perhaps a script that sets them). Practically each variable is triggered by some specific package/framework, so it seems better to modularize this.

@redbaron

Copy link
Copy Markdown
Contributor Author

nixpkgs can be used on other linux systems, this profile file is the only way to integrate it to host environment. If PATH is set there, why don't set MANPATH too

@vcunat

vcunat commented Mar 18, 2014

Copy link
Copy Markdown
Member

Yes, my meaning is that there are dozens of other similar variables.

@domenkozar

Copy link
Copy Markdown
Member

This was done in 76f985b and can be closed

@redbaron

redbaron commented Jul 1, 2015

Copy link
Copy Markdown
Contributor Author

thx

@redbaron redbaron closed this Jul 1, 2015
@edolstra

edolstra commented Jul 1, 2015

Copy link
Copy Markdown
Member

Eh. I didn't notice that commit. I'll revert - setting MANPATH is actually a bad idea, because it breaks systems that have an implicit default derived from $PATH.

@domenkozar

Copy link
Copy Markdown
Member

It "breaks" how exactly?

@fhaust

fhaust commented Nov 23, 2015

Copy link
Copy Markdown

Problem is that this is a thing if the MANPATH isn't set properly:

$ nix-env
error: no operation specified
Try ‘nix-env --help’ for more information.
$ nix-env --help
No manual entry for nix-env
See 'man 7 undocumented' for help when manual pages are not available.

@vcunat

vcunat commented Nov 23, 2015

Copy link
Copy Markdown
Member

@fhaust: it should be, at least on NixOS.

@fhaust

fhaust commented Nov 23, 2015

Copy link
Copy Markdown

@vcunat Probably, but I am not on NixOS but on a "nix on Ubuntu as non-root via proot" installation :)

@redbaron

Copy link
Copy Markdown
Contributor Author

@fhaust same for me, without patch it wasn't working currectly in that setup. Partially because by default on my distro (opensuse) I already have MANPATH setup, therefore manpath autodetection based on PATH var doesn't work, hence my change to add it there explicitly

@fhaust

fhaust commented Nov 24, 2015

Copy link
Copy Markdown

So this is probably a won't fix case? For me setting the MANPATH manually is fine.

@redbaron

Copy link
Copy Markdown
Contributor Author

I wonder if they accept patch with conditional assignment. If MANPATH is present, then modify it, if not, then rely on man to try to find man pages relative to PATH

@edolstra

Copy link
Copy Markdown
Member

@redbaron Yeah, I think that would work.

@domenkozar

Copy link
Copy Markdown
Member

Anyone up for fixing this?

Comment thread scripts/nix-profile.sh.in
fi

export PATH=$NIX_LINK/bin:$NIX_LINK/sbin:$PATH
export MANPATH=$NIX_LINK/share/man:$MANPATH

@sanscore sanscore Aug 23, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if [ -n "$MANPATH" ]; then
  export MANPATH=$NIX_LINK/share/man:$MANPATH
fi

@sanscore

Copy link
Copy Markdown

I'm using NIX on OS X -- NIX as a OS X Package Manager -- and I am experiencing this issue. Having read the conversation, the workaround is MANPATH=; nix-env --help.

I've, also, contributed a comment to PR which should be an amicable fix. Simply, check if MANPATH is set before append+export.

I'll give @redbaron time to amend and to contribute the fix. If not, then I'll create a new PR.

@sanscore

sanscore commented Aug 23, 2016 •

Copy link
Copy Markdown

Actually, it's already been fixed, but the current release must not have it; I just installed in the past hour. #1005

$ nix-env --version
nix-env (Nix) 1.11.2

cvogt added a commit to cvogt/fish that referenced this pull request May 21, 2017
zolodev pushed a commit to zolodev/nix that referenced this pull request Jan 1, 2024
…ook-theme-0.2.0

chore(deps): bump sphinx-book-theme from 0.1.10 to 0.2.0
P-E-Meunier pushed a commit to P-E-Meunier/nix that referenced this pull request Feb 26, 2025
…jects/with_problematic_crates/actix-http-2.2.2

Bump actix-http from 2.2.0 to 2.2.2 in /sample_projects/with_problematic_crates
CertainLach pushed a commit to deltarocks/nix that referenced this pull request Nov 4, 2025
…1073-nix-flake-clone-doesnt-understand-urls

nix flake clone: Support all input types
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 24, 2026
The May 2026 whole-branch review pass surfaced ~45 follow-up items
across the seven cleanup branches: correctness amends, doc-branch
corrections, in-source doc staleness, missing rl-next entries, new
catalog candidates, and compound-win cleanups. Track them in a
single in-tree ledger so the work can't slip across context
compactions or agent handoffs. Wire entries into STATUS.md
"Currently in flight" and HANDOFF.md "Step 1 — read in order".

Five batches, sequenced A → B → C → D → E:
- A: orphan-ref + stale-commit-body amends on cleanup branches
- B: doc-branch Branch line + catalog-scope corrections
- C: in-source doc staleness + missing rl-next entries
- D: file new catalog candidates NixOS#227-NixOS#233
- E: implementation of NixOS#227-NixOS#229 plus NixOS#167/NixOS#124 cross-shard
  extensions (deferred until A-D land)

Push policy unchanged: explicit-only, per-commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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 24, 2026
…ification

Batch E shipped three implementation commits on libexpr:

- f452e2d NixOS#227: drop dead EvalProfiler NVI cache + default no-op
  virtuals; mark hooks pure; rl-next entry added.
- d6f0904 NixOS#228: extend NumOp to BitAnd/BitOr/BitXor (`isIntOnly<Op>`
  arm in primNumeric); banner comment + static_assert in arithmetic-
  result lambda for the implicit `Op ∈ {Add,Sub,Mul}` invariant.
- 76b6808 NixOS#229: parameterise SeenSet (`TypedSeenSet<T>`); migrate
  the two single-pointer-kind walkers (`forceValueDeep`,
  `getDerivations::Done`) to `TypedSeenSet<Value>` /
  `TypedSeenSet<Bindings>`; switch underlying container to
  `boost::unordered_flat_set` per the project's strong preference
  for boost flat containers over STL ordered/unordered.

All three reviewed via the full Pass A/B/C/D chain:
- Pass A (adversarial): 4 fixes amended (rl-next, banner, public/
  private symmetry, Bindings forward-decl)
- Pass B (/code-review): 1 fix amended (static_assert in primNumeric);
  1 efficiency follow-up folded into NixOS#229 (boost-flat container)
- Pass C (clang-tidy, sequential per shard): no regressions; all
  seven shards exhibit only the 5 known pre-existing master errors
  (4× rapidcheck/Gen.hpp, 1× libcmd/network-proxy.cc)
- Pass D (`nix build -L .`): green

Two cross-shard items remain blocked on libutil landing upstream
before they can land on libstore (NixOS#167 extension to local-store.cc
and derivations.cc; NixOS#124 extension to daemon.cc). Documented in
FOLLOWUPS.md.

libexpr cleanup-branch tip: `76b6808f0`.

No push.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 24, 2026
The `SeenSet = std::set<const void *>` alias from NixOS#110 widened to
`void *` to share the same set across two consumers with different
pointer kinds (the value-printer family in `print.cc` /
`print-ambiguous.cc` legitimately mixes `Bindings *` and `Value *`
in the same set), but the widening removed compile-time enforcement
for the consumers that visit only one pointer kind.

Add a parameterised template alias `TypedSeenSet<T>`. `SeenSet`
becomes a compatibility alias for `TypedSeenSet<void>` so the
printer family is unchanged. `dedupe` gets a templated overload
alongside the void-typed compatibility form.

Migrate the two consumers that visit a single pointer kind:

- `EvalState::forceValueDeep` → `TypedSeenSet<Value>`
- `getDerivations`'s `Done` alias → `TypedSeenSet<Bindings>`

The mixed-kind printer consumers (`Printer::seen`,
`printAmbiguous`'s out-parameter, `nix-instantiate.cc`'s call site)
continue to use the void-typed `SeenSet` alias unchanged.

Switch the underlying container from `std::set` to
`boost::unordered_flat_set` while at it: every in-tree consumer uses
the set only as a membership probe (insert+report-newness via
`dedupe`), never iterates it, so the deterministic-iteration
property of `std::set` was unused. The flat-set form gives
amortised-O(1) insert/lookup and locality-friendly memory layout —
relevant for `getDerivations`'s `Done` set which grows linearly with
the size of an `nix-env -qaP`-style traversal of nixpkgs (tens to
hundreds of thousands of `Bindings *` entries) and for
`forceValueDeep`'s `seen` which covers every reachable `Value`.

Refs candidate NixOS#229. Compounds with NixOS#110.

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
…S#111 NixOS#76 + NixOS#229 doc-fix + NixOS#156 declined)

Sprint 1 targeted single-shard candidates that don't create
cross-shard dependencies. Five candidates evaluated; three
shipped, one already-shipped doc-fix, one declined-with-reason.

Shipped (three):

NixOS#87 (libexpr) — eager/lazy C-binding accessor pair dedup. The
six public symbols (nix_get_list_byidx{,_lazy},
nix_get_attr_byname{,_lazy}, nix_get_attr_byidx{,_lazy}) become
one-line wrappers around three file-static private impl helpers
selecting force=true or force=false. ABI unchanged.
nix_get_attr_byidx_lazy's "(Nix C API contract violation)"
error-message suffix is threaded through the impl as a parameter
rather than collapsed, preserving both error strings exactly.
libexpr commit 374e9db.

NixOS#111 (libexpr) — withRegex<Body> template helper extracting the
prim_match/prim_split regex-fetch + try/catch scaffold. The two
post-match assemblies (regex_match vs cregex_iterator) stay
inline. Helper takes a RegexCache& by reference rather than
reaching through state.regexCache directly, because that member
is private and the existing prim_match/prim_split friend
declarations cover only those two functions; the friended
primops fetch *state.regexCache and pass it through. A future
public EvalState::compileRegex accessor (alongside NixOS#169's
EvalState friend-cluster reduction) would let the explicit
cache parameter collapse and the two friend declarations go
away. Error wording, positions, and the libstdc++-state-limit
error_space arm preserved exactly. libexpr commit 4182720.

NixOS#76 (nix-cli) — walkClosure template helper deduplicating the
dotgraph/graphml BFS scaffold. New file-local
nix-store/closure-walk.hh; both consumers call walkClosure with
their own per-path and per-edge callbacks. Helper kept in
nix-store/ rather than promoted to libstore's store-api.hh per
the candidate's original sketch — that promotion would be a
cross-shard libstore change. Header-only template means no
meson.build edit. Output is byte-for-byte identical pre/post
for both formats. nix-cli commit 705114e.

Already shipped, doc-fix only:

NixOS#229 — parameterised SeenSet<T> on libexpr. Already shipped in
Batch E as commit 76b6808 ("libexpr/print: parameterise
SeenSet by element pointer type (NixOS#229)"). Branch line was
missing from the candidate body — same gap as Pass-1's six
missed Branch lines. Added.

Declined-with-reason:

NixOS#156 (libstore fan-out idiom dedup) — re-read in Sprint 1
showed the "shared" block is ~6 lines before two structurally
different doneFailure overload shapes diverge:
gaveUpOnSubstitution passes BuildError(Failure::DependencyFailed,
msg); resolveDerivation passes (ecFailed, BuildResult::Failure
struct). Extraction would be cosmetic — saves ~10 lines net but
doesn't unlock anything else. Skip-with-reason recorded; re-
evaluate when doneFailure's overloads unify or a third caller
adopts the same shape.

STATUS.md cleanup-branches table:
- libexpr tip moves to 4182720 (was 76b6808)
- nix-cli tip moves to 705114e (was 24ebbcc)
- Sprint-1 candidates appended to both row narratives
Current tip SHAs block also updated.

New "Sprint 1" recently-completed entry. Five other branches
unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <[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.

7 participants