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

How to reuse a devenv across multiple projects? #1662

Open
scotttrinh opened this issue Jan 6, 2025 · 2 comments
Open

How to reuse a devenv across multiple projects? #1662

scotttrinh opened this issue Jan 6, 2025 · 2 comments
Labels
question Further information is requested

Comments

@scotttrinh
Copy link

I'm trying out devenv for use at my work, coming from direnv + use flake with a custom flake.nix. Previously, I had two flakes, one for TypeScript projects, and one for Python projects. Most of the different projects used the same tooling, so this had two advantages: fewer places to update when updating tooling; and the individual projects didn't know anything about direnv or flakes. I stuck .envrc in my global ignore, and no one else on the team had to worry about the fact that I was using nix to manage the dev-time dependencies.

I tried a similar approach with devenv, but it looks like use devenv ../nix-python only partially works: it successfully finds the files to watch, but the devenv assemble call does not know how to specify this flake_dir as the devenv root to the CLI, so it errors out. Is this a limitation of the current implementation, or am I holding it wrong?


For more context, one of the workflows I have to do often is a make clean in my project which doesn't know how to avoid clobbering the ignored devenv.* files. No big deal when it was just the .envrc file since that was trivially backed up.

@scotttrinh scotttrinh added the question Further information is requested label Jan 6, 2025
@clotodex
Copy link
Contributor

clotodex commented Jan 6, 2025

afaik:

  • parts are still being built but you can import other devenv files (which does not help with amount of file but does help with deduplication)
  • parts are still being designed and debated - see e.g. monorepo importing #998
  • parts are blocked by nix/other dependencies (like yaml importing)

i see a few options currently

  • use devenv in a flake - so nothing should change for your existing workflow
  • use one monorepo devenv that just loads ALL tooling (or if not monorepo a parent folder of the projects)
  • use a devenv per project importing from others (this might require them to all share one git repo - but not sure about that actually)
  • probably more i cant think of in the moment

Hope this helps to get you started

@scotttrinh
Copy link
Author

Thanks for the context, I'll report back on what I find that might work. I'm not able to do a simple monorepo, since my work involves work across a number of different monorepos already 😅 Maybe the parent-directory approach would work where I'd make a separate parent directory for each flavor of repo I need to work with (ts vs python vs rust). Maybe the simplest first approach is trying to import from other projects since there are definitely "anchor" projects that could "own" the devenv definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants