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

Adding commands to devenv #117

Open
domenkozar opened this issue Nov 23, 2022 · 8 comments · May be fixed by #1320
Open

Adding commands to devenv #117

domenkozar opened this issue Nov 23, 2022 · 8 comments · May be fixed by #1320
Labels
enhancement New feature or request

Comments

@domenkozar
Copy link
Member

domenkozar commented Nov 23, 2022

It would be interesting if there was a way to extend devenv commands. This would allow for some kind of concept of plugins.

{ ... }:
{
  subcommands.mysubcommand.exec = ''
    echo hello
  '';
}

And running it:

$ devenv mysubcommand
hello

Could be used with #103 for cli parsing.

@karantan
Copy link
Contributor

I think this feature would completely eliminate the need for a Makefile.

@thenonameguy
Copy link
Contributor

thenonameguy commented Nov 23, 2022

What is the benefit of the subcommand over the already existing script support?

It seems the only difference is whether the script is on the PATH vs. the subcommand is built-in the devenv script.

@sayanarijit
Copy link
Contributor

I think I'd prefer it to be a global config in configuration.nix or home.nix.

I'd use it like devenv someplugin someargument.

E.g.

devenv bettersearch mypackage

@sayanarijit
Copy link
Contributor

Inspiration: gh.

@bobvanderlinden
Copy link
Contributor

I do like that something like up can become a subcommands this way. I also found that a setup command is often useful, which currently is a script.

I also like that this makes the configuration less dependent on the devenv executable. Being able to run some of these commands without devenv will allow better usage of them when using devenv in a flake.

That said, the distinction between subcommands and scripts is not clear. There probably needs to be docs on when to use one or the other.

@sayanarijit having them configurable globally will make the the environment not reproducible anymore. You'd have to communicate to any users which plugins they need to install/enable.

@rickynils
Copy link

I've been using this approach successfully for years, using infranix. infranix is using the same module-based approach as climod, but it is generating a Makefile behind the scenes while climod is just generating bash code.

Anyway, I just wanted to say that the "plugin experience" you get from this (especially when you're using the module system directly, I don't know if end users will do that in devenv) is really nice. I also gave a talk about this at NixCon London 2018.

If you haven't seen just, I recommend you look into it. It is a very nice alternative to Makefiles, and could either be useful behind the scenes in devenv, or even exposed directly to users.

Also, if you ever find yourself implementing auto completion, compleat is a very useful DSL for it.

@domenkozar
Copy link
Member Author

See #1362

@domenkozar
Copy link
Member Author

We need to explore different ways how we can make plugins hook as a subcommand, Cargo itself does this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
6 participants