Skip to content

Infer devShell deps, provide smaller one#14489

Merged
Ericson2314 merged 3 commits intoNixOS:masterfrom
roberth:shell-a-la-carte
Nov 11, 2025
Merged

Infer devShell deps, provide smaller one#14489
Ericson2314 merged 3 commits intoNixOS:masterfrom
roberth:shell-a-la-carte

Conversation

@roberth
Copy link
Member

@roberth roberth commented Nov 6, 2025

Motivation

For contributors with slow connections, small disks, or high standards, provide a smaller shell.

Uses carousel pattern with overrideAttrs/passthru (easy to apply locally, single fixpoint) but that could be refactored to work differently, e.g. package function arguments.
Usage:

nix develop .#native-clangStdenv.small

This makes the packages simpler, but loses a tiny little bit in eval laziness by having to evaluate all components to figure out the devShell, instead of just the ones listed. Not significant.

Context

  • Would benefit asymptotically, but possibly not significantly from lib.linkedLists: init nixpkgs#452088
  • The helpers seem upstreamable into Nixpkgs lib (like I've done for the cross rename helpers)

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@roberth roberth requested a review from edolstra as a code owner November 6, 2025 00:44
@roberth roberth added the contributor-experience Developer experience for Nix contributors label Nov 6, 2025
@github-actions github-actions bot added documentation with-tests Issues related to testing. PRs with tests have some priority labels Nov 6, 2025
Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

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

Thank you so much, @roberth! This is the exact sort of thing I was hoping for during the meeting. Glad you understood me.

I will leave this up a bit for the others to see also, but I hope we can merge it very soon.

@Mic92
Copy link
Member

Mic92 commented Nov 6, 2025

Can we document this? Also which devshell do we want to recommend here?

@Ericson2314
Copy link
Member

Can we document this?

FWIW ultimately I hope the functionality can go in Nixpkgs, as I think better multi-package dev shells is a very useful thing I've wanted there for years.

@roberth
Copy link
Member Author

roberth commented Nov 7, 2025

Can we document this?

So far I treat this as an internal refactor that adds an unimportant .small devShell feature and some new knobs for generic devShell machinery that should go into Nixpkgs at some point.

Also which devshell do we want to recommend here?

The usual one. The .small is for picky users who dig through code and care a lot about closure size ;)

can go in Nixpkgs

Get rid of some manual package set resolution in favor of splicing
again, too.

Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
@Ericson2314
Copy link
Member

Ericson2314 commented Nov 7, 2025

other parts need generalization to be useful for other projects.

I think the way it should work is that the shell would generate the root meson.build with all the subprojects, so subprojects are opt-in rather than opt-out.

For me a very good sign is if one can use the hypothetical generalized version to easily also develop on Hydra at the same time, and skip building nix just because hydra depends on it.

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

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

Fixed the two things that @xokdvium found

@Ericson2314 Ericson2314 added this pull request to the merge queue Nov 11, 2025
Merged via the queue into NixOS:master with commit 918c1a9 Nov 11, 2025
16 checks passed
@Ericson2314 Ericson2314 mentioned this pull request Dec 3, 2025
13 tasks
github-merge-queue bot pushed a commit to NixOS/nixpkgs that referenced this pull request Dec 3, 2025
This is a port of
NixOS/nix@cb5b0c3
from NixOS/nix#14489 but adopted to preserve
dependency order, and this not cause rebuilds.

We only need the one commit of that PR because we don't care about a dev
shell for Nix in Nixpkgs.
nixpkgs-ci bot pushed a commit to NixOS/nixpkgs that referenced this pull request Dec 3, 2025
This is a port of
NixOS/nix@cb5b0c3
from NixOS/nix#14489 but adopted to preserve
dependency order, and this not cause rebuilds.

We only need the one commit of that PR because we don't care about a dev
shell for Nix in Nixpkgs.

(cherry picked from commit 8f72b28)
@edolstra edolstra mentioned this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor-experience Developer experience for Nix contributors documentation with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants