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

flake/dev: add nixvim-init command (under 'init' shell command) #2468

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

Conversation

GaetanLepage
Copy link
Member

@GaetanLepage GaetanLepage commented Oct 29, 2024

A small helper to quickly add a new plugin.
This is inspired from nix-init.

It will be a small interactive program that prompts the name of the plugin, the package name and that will initialize the module and test files.

  • Information prompting
  • Generation of the module file plugins/by-name/<NAME>/default.nix
    • mkVimPlugin support
    • mkNeovimPlugin support
  • Generation of the test file tests/test-sources/plugins/by-name/<NAME>/default.nix

@GaetanLepage GaetanLepage changed the title flake/dev: add nixvim-command (under 'init' shell command) flake/dev: add nixvim-init command (under 'init' shell command) Oct 29, 2024
@GaetanLepage GaetanLepage force-pushed the init branch 2 times, most recently from b62ef90 to 7ab035c Compare October 29, 2024 15:51
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh we doin rust now :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a huge noob, but I just want to do a simple nix-init clone for nixvim.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not opposed to learning a bit of rust for this, just conscious I already have to improve my python to properly be capable of maintaining our other in-tree scripts... 😅

@GaetanLepage GaetanLepage marked this pull request as draft October 29, 2024 16:00
pname = "nixvim-init";
version = "nightly";

src = ./.;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, src = ./. is a bad idea because default.nix itself will also be considered a "source" of the derivation.

This means if default.nix is modified, the derivation needs to be rebuilt. Even if no source actually changed and the change to the nix file wouldn't actually need a rebuild.

Usually, you'd do something like src = ./src. I think you could also use a fileset or filtered source to filter out nix files, but those options seem a little overkill.

That said, this is a minor issue and we're already doing this in most of our other derivations, so it shouldn't block the PR if you'd rather keep it as-is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, very good to know.
Considering the simplicity of this application, I don't think that we should overthink it.
Neither the rust code itself or the default.nix will be modified too often.
Also, I expect the build time to be ridiculously short.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still prefer having sources and nix files separate, (I don't think it has any downsides?), but I won't press on the issue.

edition = "2021"

[dependencies]
clap = "4.5.20"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using clap = { version = "4.5.20", features = ["derive"] }, it's quite a bit more ergonomic

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks ! Actually, I don't even think that we will need clap at all.
Good to know though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I don't even think that we will need clap at all.

I think we'll probably end wanting some decent argument parsing and help-text at some point...

Even if we have a mostly interactive UX it'd still be nice to be able to do things via CLI args.

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 this pull request may close these issues.

4 participants