Skip to content

Add gzip support for channel unpacking - #115

Closed
errge wants to merge 1 commit into
NixOS:masterfrom
errge:master
Closed

errge wants to merge 1 commit into
NixOS:masterfrom
errge:master

Conversation

@errge

@errge errge commented May 14, 2013

Copy link
Copy Markdown
Contributor

I need this, because in my pet project ceh (http://github.com/errge/ceh) I download nixpkgs snapshots from github instead of http://nixos.org/releases/nixpkgs/...

At nixos.org, old snapshots are continuously garbage collected, while github has the whole history of the project and I'd like to have old versions installable too.

Unfortunately github only offers gzip and zip compression for archive downloads. I think this is because, both bzip2 and xz is a bit expensive to compress.

Currently I have a big hack to first download the gzip, then recompress to bzip2 on the client side. That of course is a big performance hit for my users.

@edolstra

Copy link
Copy Markdown
Member

Applied with a fix.

@edolstra edolstra closed this Jul 15, 2013
zolodev pushed a commit to zolodev/nix that referenced this pull request Jan 1, 2024
ConnorBaker pushed a commit to ConnorBaker/nix that referenced this pull request Jul 25, 2025
…he-hashes

fetchToStore() cache: Use content hashes instead of store paths
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 23, 2026
`deleteGenerations`, `deleteGenerationsGreaterThan`,
`deleteOldGenerations`, and `deleteGenerationsOlderThan` (in
`libstore/profiles.cc`) all open with the same five-line prelude
`PathLocks lock; lockProfile(lock, profile); auto [gens, curGen] =
findGenerations(profile);` before walking `gens` with their
function-specific predicate.

Lift the prelude into a file-static helper. The four entry points
each reduce to a one-call wrapper around `withLockedProfileGenerations(profile, [&](Generations &
gens, std::optional<GenerationNumber> curGen) { ... })`. Their
per-function iteration is preserved verbatim inside the body lambda.

Per the candidate body's note, `switchGeneration` is structurally
distinct (picks one target via `switchLink`) and is not folded in.

The helper was originally proposed as `forEachGenerationToDelete`,
which suggested iteration; renamed to `withLockedProfileGenerations`
because the function does not iterate — it acquires the lock, loads
the generations, and hands them to the body callback.

The body parameter is a forwarding reference (`Body && body`) and
is invoked via `std::forward<Body>(body)(...)` to preserve value
category in the single invocation; this satisfies clang-tidy's
`cppcoreguidelines-missing-std-forward` and keeps the door open for
callers that pass an rvalue lambda.

Refs candidate NixOS#115.

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

Adds **Branch:** lines to the 30 catalog entries that landed as commits
on the four cleanup shard branches (libexpr, libstore, libutil,
nix-cli) over the previous batch.

Per-shard tally (commits on each branch beyond the previously-pushed
tip):

- libexpr (HEAD 437eea9 -> +10): NixOS#64, NixOS#66, NixOS#68, NixOS#106, NixOS#107, NixOS#109,
  NixOS#110, NixOS#112, NixOS#196, NixOS#199. Two of the original twelve were skipped on
  rule grounds: NixOS#194 (LookupPath::Elem flatten) — the candidate
  framing claimed the types were internal, but search-path.hh ships
  via install_headers, so collapsing is a public-ABI break, not a
  trivial flatten; NixOS#197 (one-arg findFile drop) — EvalState::lookupPath
  is a private member, so the candidate's "have callers pass it
  explicitly" prescription cannot apply.

- libstore (HEAD 5f5b815 -> +12): NixOS#4, NixOS#5, NixOS#6, NixOS#14, NixOS#47, NixOS#82, NixOS#114,
  NixOS#115, NixOS#119, NixOS#157, NixOS#159, NixOS#165. Several departures from the literal
  prescription, recorded in each commit body and in the per-candidate
  Branch line: NixOS#14 lifted only getRemoteFSAccessor with a
  getLocalNarCacheDir hook (left the trivial getFSAccessor overrides
  per-class); NixOS#115 extracted only the prelude (lockProfile +
  findGenerations) since two callers use stateful reverse iteration;
  NixOS#119 confirmed init's setDefault is a different shape and stayed
  out; NixOS#159 dropped the assert(!childEOF) defensive check after walking
  Goal::handleEOF producers; NixOS#165 used option (b) of the prescription
  (a new derivation-output-fwd.hh) because option (a) would have
  introduced an include cycle.

- libutil (HEAD 784a4f4 -> +3): NixOS#29, NixOS#99, NixOS#117. NixOS#29's commit body
  caveat (XDG_*_HOME / XDG_CONFIG_DIRS reads moved from per-call to
  cached) is recorded on the candidate Branch line.

- nix-cli (HEAD 48524e0 -> +5): NixOS#24, NixOS#77, NixOS#89, NixOS#91, NixOS#187. NixOS#91 shipped
  the GcRootNamer + nameForCurrent consolidation but deferred the
  candidate's addPermRootWithCounter free helper because three
  behavioural differences across call sites (rootNr increment
  position, absPath timing, printGCWarning conditions on store2 null)
  would have either changed user-visible path naming or grown the API.

STATUS.md's cleanup-branches table is updated with each shard's
expanded Addresses list, and the Status column now distinguishes the
already-pushed tips (libfetchers/libflake/libmain remain Pushed since
they got no new commits) from the four shards whose new commits are
local-only.

Push policy is explicit-only — none of the four shard branches has
been pushed past its prior tip.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
ConnorBaker added a commit to ConnorBaker/nix that referenced this pull request May 23, 2026
Final-pass review of the 30 trivial candidates surfaced 20
nits/deferrals; ten of those that produced visible behaviour or
naming changes need their `**Branch:**` lines updated:

- NixOS#6 (GET_PROTOCOL_MAJOR/MINOR): the candidate originally proposed
  hoisting the macros to common-protocol.hh; post-cleanup review
  found zero call sites tree-wide and they were deleted entirely in
  a follow-up commit on cleanup/libstore.
- NixOS#109 (isVarName): the original commit body claimed a behaviour
  change ("printAttributeName now string-quotes...") but the
  predicates were already accepting the same set of identifiers.
  Re-derived from source: old `isVarName`'s per-char loop already
  rejected non-`[a-zA-Z0-9_'-]` bytes from the first position,
  matching the new first-char gate. The Branch line now describes
  the refactor as "promoted... and restructured" rather than
  "tightened... behaviour change."
- NixOS#110 (SeenSet): the alias was applied at five sites in the
  original landing; a follow-up commit migrated EvalState::forceValueDeep
  for consistency, bringing the count to six.
- NixOS#112 (BUG_12899_URL): the original commit picked a `#define`
  because the URL was concatenated into format strings via
  adjacent-string-literal syntax. Post-cleanup review converted to
  `constexpr std::string_view bug12899Url` and routed through
  boost::format `%1%`; the rendered text is byte-identical.
- NixOS#115 (forEachGenerationToDelete): the prelude helper was
  originally proposed under the iteration-implying name
  `forEachGenerationToDelete`; post-cleanup review noted the
  function does not iterate (it acquires the lock, loads the
  generations, and hands them to the body callback) and renamed to
  `withLockedProfileGenerations`.

Also adds catalog candidate NixOS#219 (post-build-hook timeout silently
dropped) — a pre-existing latent bug surfaced by the post-cleanup
adversarial review of NixOS#157's runPostBuildHookCo extraction. Bumps
totals everywhere (INVENTORY.md, candidates/README.md, STATUS.md
"catalog split" entry).

STATUS.md "Recently completed" now records the 30-candidate landing
plus the 12-agent review run and the 20-nit polish pass. The "Local-
only" status of the four shard branches is unchanged; push policy
is explicit-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
`deleteGenerations`, `deleteGenerationsGreaterThan`,
`deleteOldGenerations`, and `deleteGenerationsOlderThan` (in
`libstore/profiles.cc`) all open with the same five-line prelude
`PathLocks lock; lockProfile(lock, profile); auto [gens, curGen] =
findGenerations(profile);` before walking `gens` with their
function-specific predicate.

Lift the prelude into a file-static helper. The four entry points
each reduce to a one-call wrapper around `withLockedProfileGenerations(profile, [&](Generations &
gens, std::optional<GenerationNumber> curGen) { ... })`. Their
per-function iteration is preserved verbatim inside the body lambda.

Per the candidate body's note, `switchGeneration` is structurally
distinct (picks one target via `switchLink`) and is not folded in.

The helper was originally proposed as `forEachGenerationToDelete`,
which suggested iteration; renamed to `withLockedProfileGenerations`
because the function does not iterate — it acquires the lock, loads
the generations, and hands them to the body callback.

The body parameter is a forwarding reference (`Body && body`) and
is invoked via `std::forward<Body>(body)(...)` to preserve value
category in the single invocation; this satisfies clang-tidy's
`cppcoreguidelines-missing-std-forward` and keeps the door open for
callers that pass an rvalue lambda.

Refs candidate NixOS#115.

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.

2 participants