Skip to content

Make sandbox-settings better typed, get globals.hh out of other headers#13799

Merged
Ericson2314 merged 6 commits intoNixOS:masterfrom
obsidiansystems:typed-sandbox-paths
Aug 20, 2025
Merged

Make sandbox-settings better typed, get globals.hh out of other headers#13799
Ericson2314 merged 6 commits intoNixOS:masterfrom
obsidiansystems:typed-sandbox-paths

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

Motivation

The first part was my original goal: I saw there was some settings parsing ad-hoc included in DerivationBuilder, and so I wanted to properly make Settings do that instead, and use PathsInChroot on Settings in order to do that (making Settings::sandboxPaths well-typed).

I did that by flipping the the header order so that derivation-builder.hh was used by globals.hh, and then this caused a bunch of include order issues. I could have fixed this by making a new header, but I instead showed to do some "deferred maintenance" and and get globals.hh only directly included in *.cc files. I think this is good for eventually migrating away from global variable settings (make using globals more "pay if and only if you use" than "oh, you are already including them, so whatever"). So that is now part of this PR too.

Context


Add 👍 to pull requests you find important.

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

@github-actions github-actions bot added new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store fetching Networking with the outside (non-Nix) world, input locking labels Aug 20, 2025
@edolstra edolstra changed the title Make sandbox-settings better typed, get globsals.hh out of other headers Make sandbox-settings better typed, get globals.hh out of other headers Aug 20, 2025
I rather use designated initializers.
That is where it should be.
Will want these for settings in a moment.
We'll neeed some definitions elsewhere
This is needed to rearrange include order, but I also think it is a good
thing anyways, as we seek to reduce the use of global settings variables
over time.
Parsing logic is moved from `DerivationBuilder`, where is doesn't
belong, to `Settings` itself, where it does.
@Ericson2314 Ericson2314 merged commit ca86d34 into NixOS:master Aug 20, 2025
14 checks passed
@Ericson2314 Ericson2314 deleted the typed-sandbox-paths branch August 20, 2025 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetching Networking with the outside (non-Nix) world, input locking new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants