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

Import a sub-path of a niv-managed package? #252

Closed
antifuchs opened this issue Jul 23, 2020 · 4 comments · Fixed by #253
Closed

Import a sub-path of a niv-managed package? #252

antifuchs opened this issue Jul 23, 2020 · 4 comments · Fixed by #253

Comments

@antifuchs
Copy link
Contributor

antifuchs commented Jul 23, 2020

I'm stuck trying to use https://github.com/Mic92/sops-nix: The readme indicates that to use the sops module as a library, you have to add <sops-nix/modules/sops> to your imports here; but since I pinned the package to my project with niv, nix-build can't find this module.

I've made a ~minimal repo that, when checked out, fails to build in the way I describe: https://github.com/antifuchs/niv-module-import-question/blob/master/configuration.nix#L3 is the place where I try to import that sops-nix module, but am failing. Feel free to check it out and run nix-build in it. It errors with:

error: file 'sops-nix/modules/sops' was not found in the Nix search path (add it using $NIX_PATH or -I), at /Users/asf/Mess/current/sops-sobs/configuration.nix:3:15
(use '--show-trace' to show detailed location information)

Things I've tried:

  • Using sources.sops-nix: that gets me the top-level definition of sops-nix, packages.

  • I tried finding out how to change the nix-path to add niv-managed sources, but couldn't find out how to do that. Is that something that's supported?

Anyway, I'm stumped. Something tells me this should work, but none of the examples or bits of documentation I found have made it clear to me what I need to do to make it work.

@Mic92
Copy link

Mic92 commented Jul 23, 2020

This is how you do it:

  imports = [ "${(import ./nix/sources.nix).sops-nix}/modules/sops" ];

@Mic92
Copy link

Mic92 commented Jul 23, 2020

Could be added to niv documentation though as a general information on how to solve this.

@antifuchs
Copy link
Contributor Author

Thank you! This does indeed work! :D

@nmattia
Copy link
Owner

nmattia commented Jul 23, 2020

As @Mic92 said! Yeah, good point. Let me do that right now.

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 a pull request may close this issue.

3 participants