Skip to content

Declarative nix path - #250

Closed
shlevy wants to merge 9 commits into
NixOS:masterfrom
shlevy:declarative-nix-path
Closed

shlevy wants to merge 9 commits into
NixOS:masterfrom
shlevy:declarative-nix-path

Conversation

@shlevy

@shlevy shlevy commented May 7, 2014

Copy link
Copy Markdown
Member

This adds a builtins.importWithSettings primop that allows specifying settings (as an attrset) for the import. The only currently recognized setting is nix-path, which is a list of attrsets with an optional prefix attr and a required value attr. It also adds a __curSettings symbol to access the settings associated with the current parse.

In order to propagate the settings properly, import was changed from a primop to syntax sugar. This will break usage of builtins.import, so we can add a dummy primop that fails to propagate the settings (perhaps with a warning printed) if this is a problem (but I doubt anyone actually uses this).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why such a verbose syntax? E.g. this would be nicer:

nix-path = { this = ./test-nix-path.nix; nix = nixDir; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Well, the path must be a list because the order matters.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm forgot about that. Still unfortunate that it comes with such a high price ;)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Order matters, plus there are the prefix-less entries.

@edolstra

edolstra commented May 8, 2014

Copy link
Copy Markdown
Member

A while back I implemented a scopedImport primop that could probably be extended to support a declarative Nix search path. Not convinced it's a good idea though.

@shlevy

shlevy commented May 8, 2014

Copy link
Copy Markdown
Member Author

Together with NixOS/nixpkgs#2563 and my forthcoming solution to NixOS/nixops#78 this will let us have our modules specify almost all of the stateless bits of our deployments (the only bits out of that control are the nix and nixops versions used) without having to put constraints on future work in nixops, nixpkgs, or our own modules (i.e. we can freely use nix path) and while letting us easily test with our local nix-path in development. Is there another solution that is as good? If not, what aspects of this solution are problematic enough to warrant choosing a worse one?

@rbvermaa

rbvermaa commented May 8, 2014

Copy link
Copy Markdown
Member

@shlevy Could you perhaps write up a small piece of documentation about the different ways of managing nix-paths, especially using this?

@shlevy

shlevy commented May 8, 2014

Copy link
Copy Markdown
Member Author

@rbvermaa done

@shlevy

shlevy commented May 30, 2014

Copy link
Copy Markdown
Member Author

Superceded by 62a6eeb

@shlevy shlevy closed this May 30, 2014
P-E-Meunier pushed a commit to P-E-Meunier/nix that referenced this pull request Feb 26, 2025
Try pinning the macOS version in github action base image
employee-64c7dcd530593118dcccc3fb pushed a commit to employee-64c7dcd530593118dcccc3fb/nix that referenced this pull request Nov 21, 2025
Git fetcher: Restore progress indication
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 29, 2026
…OS#259, fixes ledger

Independent whole-branch audit (22 agents -> dedup -> per-finding
adversarial verify): 70 findings, 63 confirmed, 7 refuted.

Catalog corrections (counts/claims re-derived against master):
  - NixOS#65: recorded grep was malformed (anchored `builtins\."` returns 2,
    not 79); restored the unanchored form, noted the 87-name-anchored
    alternative is a different set (F014).
  - NixOS#18: B3's grep returns 24 lines / 23 hand-written, not 17; added the
    six omitted names (F016).
  - NixOS#169/NixOS#217/N33: friend count is 11 Expr* lines / 10 distinct, not
    "10 / 9" (F013).
  - NixOS#103/N6 + verified/05: RewritingSink no longer "tracks match
    positions"; matches is dead and HashModuloSink::finish's loop is
    inert since 3ebe134 (F019).
  - NixOS#138: eval.cc read-site is copyPathToStore, not the nonexistent
    "addToStore" (F006).
  - NixOS#218 + STATUS: placeholder inventory undercounted (6 -> 7-8); the
    wire-marker is the BuildResult compat StringMap, not a DrvOutput
    serialisation; nix-store.cc misfiled as a "legitimate constant"
    (F007-F011).
  - README U7b/U7c + N1: migratable cache count and per-site exclusion
    reasons (F017/F018).
  - verified/19: nix_get_external is a functional bug, not a "quirk";
    nix_store_path_hash missing-preamble outlier (F003/F052).
  - verified/17: tree glyphs live in libutil util.hh, not "libcmd
    headers" (F035).
  - NixOS#11-legacy NixOS#222/NixOS#231 + FOLLOWUPS: --max-freed mechanism and the
    --priority getArg mis-recommendation (F001/F002).

New candidates NixOS#241-NixOS#259 filed into their topical sections (per the
catalog's group-by-symptom principle): 03 (NixOS#244), 07 (NixOS#246), 08 (NixOS#243),
10 (NixOS#253,NixOS#255), 12 (NixOS#241,NixOS#242,NixOS#259), 13 (NixOS#248,NixOS#249,NixOS#251), 16
(NixOS#245,NixOS#247), 17 (NixOS#254,NixOS#256), 20 (NixOS#250,NixOS#252), 23 (NixOS#257,NixOS#258).

NixOS#122: re-verified the stackOverflowHandler symbol-mangle caveat is
correct as written (F062).

The audit is recorded as a STATUS.md "Recently completed" event (it
subsumes the per-finding report; no standalone report file is kept).
The corresponding code fixes are uncommitted on the cleanup worktrees.
Also converted the macOS /Users/cbaker2 paths in HANDOFF.md/STATUS.md to
the Linux /home/cbaker2 paths used on this machine.

Co-Authored-By: Claude Opus 4.8 (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.

3 participants