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

feat: allow pip drvs to access config from their parent drv #746

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Oct 17, 2023

I'm doing custom builds from editable installs in a meta-repo.

To get the dirty editable path of a dependency drv, I'd need this patch, to be able to do something like:

{config, ...}:
let
  inherit (config.mkDerivation.passthru) topConfig;
  fullRelPath = topConfig.lock.content.fetchPipMetadata.sources.${config.name}.path;
in ...

@moduon MT-1075

I'm doing custom builds from editable installs in a meta-repo.

To get the dirty editable path of a dependency drv, I'd need this patch, to be able to do something like:

```nix
{config, ...}:
let
  inherit (config.mkDerivation.passthru) topConfig;
  fullRelPath = topConfig.lock.content.fetchPipMetadata.sources.${config.name}.path;
in ...
```

@moduon MT-1075
@DavHau
Copy link
Member

DavHau commented Oct 17, 2023

Can't you just access the config attribute of the parent directly from your nix expression?

@yajo
Copy link
Contributor Author

yajo commented Oct 19, 2023

Yeah, I can do that, and that's currently my workaround.

However, my parent nix epression is using pip and the value needed to pass in pip.drvs.* is quite complex, so I refactored it out to different files that define reusable drv-parts.

I can call those parts, but it seemed more ergonomic to just declare a module and be able to access its parent config directly.

@DavHau
Copy link
Member

DavHau commented Oct 23, 2023

Hm, I wonder if there is a cleaner solution to this than passing the full parent config to the child module. Maybe we could support the editable use case directly or alternatively pass the path of the package via meta.relPath or such?

I'm happy to look into this. It would help if you could provide a reproducer of your use case so I can plan around with it.

@phaer phaer added the python label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants