Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derivation untangle #10760

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open

Derivation untangle #10760

wants to merge 39 commits into from

Conversation

haenoe
Copy link
Contributor

@haenoe haenoe commented May 22, 2024

Motivation

This is a first effort to reduce the usage of ParsedDerivation by putting the relevant configuration options into BasicDerivation (see DerivationOptions, link).

Context

#9866 (regarding the "magic values" env field that are used as options) #9846 (regarding the reduction of ParsedDerivation)

Priorities and Process

Add 👍 to pull requests you find important.

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

@@ -289,6 +362,8 @@ struct BasicDerivation
StringPairs env;
std::string name;

DerivationOptions options;
Copy link
Member

Choose a reason for hiding this comment

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

It seems that having this field in BasicDerivation "denormalizes" it, since information like the value of __impureEnvVars is now stored in both drv.env and drv.options.impureEnvVars, which could get out of sync and would therefore be error-prone to use. Wouldn't it be better to have methods like BasicDerivation::{get,set}ImpureEnvVars()?

Copy link
Member

Choose a reason for hiding this comment

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

@edolstra the goal is, via the JSON format, to allow that stuff to not exist in the env. Then only the legacy decoding results looks like denormalization — but actually I prefer the perspective that there is no denormalization and rather the legacy format simply lacks the expressive power to set one without setting the other.

Does that make sense? It is some subtle philosophical perspective-shifting.

Copy link
Member

Choose a reason for hiding this comment

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

Philisophical doesn't do it justice. It's anticipating a design improvement.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah philosophical before the new feature (better JSON format as input), practical with it.

@Ericson2314 Ericson2314 force-pushed the derivation-untangle branch from 2b0ffc1 to 5d08553 Compare June 24, 2024 03:17
We'll move out the parsing code following this.
src/libstore/derivations.cc Outdated Show resolved Hide resolved
@fricklerhandwerk fricklerhandwerk added contributor-experience Developer experience for Nix contributors store Issues and pull requests concerning the Nix store labels Jun 24, 2024
@haenoe haenoe force-pushed the derivation-untangle branch from b06017d to 5fab050 Compare June 24, 2024 21:18
@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Jun 24, 2024
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-06-24-nix-team-meeting-minutes-155/47739/1

@@ -2,11 +2,24 @@
///@file

#include <cstdint>
#include <nlohmann/json.hpp>
Copy link
Member

Choose a reason for hiding this comment

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

There is json_fwd we should use in headers

Comment on lines +68 to +69
AdditionalAttributes attrs;

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this should go here, but replacing env in BasicDerivation

Copy link
Contributor Author

@haenoe haenoe Jul 15, 2024

Choose a reason for hiding this comment

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

Ah yes oopsie, should it still be named env though?

And should I put it in derivations.{cc,hh}?

Copy link
Member

Choose a reason for hiding this comment

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

name doesn't matter, since call sites need to be updated either way.

Yes probably should go there.

Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Jan 20, 2025
This is a first step towards PR NixOS#10760, and the issues it addresses.
See the Doxygen for details.

Thanks to these changes, we are able to drastically restrict how the
rest of the code-base uses `ParseDerivation`.

Co-Authored-By: HaeNoe <[email protected]>
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Jan 20, 2025
This is a first step towards PR NixOS#10760, and the issues it addresses.
See the Doxygen for details.

Thanks to these changes, we are able to drastically restrict how the
rest of the code-base uses `ParseDerivation`.

Co-Authored-By: HaeNoe <[email protected]>
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Jan 20, 2025
This is a first step towards PR NixOS#10760, and the issues it addresses.
See the Doxygen for details.

Thanks to these changes, we are able to drastically restrict how the
rest of the code-base uses `ParseDerivation`.

Co-Authored-By: HaeNoe <[email protected]>
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Jan 20, 2025
This is a first step towards PR NixOS#10760, and the issues it addresses.
See the Doxygen for details.

Thanks to these changes, we are able to drastically restrict how the
rest of the code-base uses `ParseDerivation`.

Co-Authored-By: HaeNoe <[email protected]>
Ericson2314 added a commit to obsidiansystems/nix that referenced this pull request Jan 20, 2025
This is a first step towards PR NixOS#10760, and the issues it addresses.
See the Doxygen for details.

Thanks to these changes, we are able to drastically restrict how the
rest of the code-base uses `ParseDerivation`.

Co-Authored-By: HaeNoe <[email protected]>
@haenoe
Copy link
Contributor Author

haenoe commented Jan 26, 2025

Long time no see ^^'
Tests will fail, at least on my machine due to the unit test here
I tried to debug it, but my tired brain is stuck :D Will try again later this week!

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 store Issues and pull requests concerning the Nix store 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.

6 participants