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

Example for extending the flake module #664

Open
sagikazarmark opened this issue Jun 15, 2023 · 8 comments
Open

Example for extending the flake module #664

sagikazarmark opened this issue Jun 15, 2023 · 8 comments
Labels
documentation Improvements or additions to documentation

Comments

@sagikazarmark
Copy link
Contributor

I'm trying to add custom features to the flake module that would help with some deduplication across a few environments:

{
    tools.kubectl.enable = true;
    tools.helm.enable = true;
}

I'm also using flake-parts.

Can someone point me in a direction for extending the devenvType?

@domenkozar
Copy link
Member

@roberth maybe you can help here, how can additional devenv modules be specified?

@sagikazarmark
Copy link
Contributor Author

After staring at the code for quite some time, I believe the only way I could achieve this is by adding modules here somehow:

modules = [{

I'm not sure how I could do that though.

@roberth any pointers would be greatly appreciated.

@thenonameguy
Copy link
Contributor

All NixOS modules can be extended further with the 'imports' key (array of files containing modules).

Have you tried doing that already?

@sagikazarmark
Copy link
Contributor Author

@thenonameguy I haven't, but the challenge I see is that I don't want to extend the flake-parts module, I want to extend devenv directly. It's possible I'm missing something obvious though.

@roberth
Copy link
Contributor

roberth commented Jul 11, 2023

Not sure exactly in which way you want to extend it, but here's one:

I think that's what @thenonameguy wanted to suggest.

If the import needs to reference another repo, I could write something for the case where both repos are flake based. Otherwise I have to ask:

@domenkozar Can devenv.yaml import a devenv module from a flake attribute?

@sagikazarmark
Copy link
Contributor Author

sagikazarmark commented Jul 11, 2023

Thanks @roberth , I believe that's exactly what I was looking for.

If the import needs to reference another repo, I could write something for the case where both repos are flake based.

In my case, I'd like to reuse a set of modules across a number of repos, so yeah, I'm thinking something like this:

{
  inputs = {
    # ...
  }

  outputs = inputs@{ ... }: {
    devenvModules = {
      default = {};
    };
  }
}

And then import that module in a shell.

Let me give this a try and get back to you.

@domenkozar
Copy link
Member

Does that work? :)

@sagikazarmark
Copy link
Contributor Author

It does: https://github.com/sagikazarmark/xdevenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants