-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
vimPlugins.markdown-preview: init at 2020-09-09 #97781
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
Conversation
Thanks for putting this together, @iclanzan! I'm not a maintainer of nixpkgs vim plugins, but I am interested in using this plugin, so I gave this a try. I got the error |
Nice catch! It was working for me because I have Node installed globally. I wonder if we should specify |
@iclanzan I don't think that adding |
This is correct, buildInputs will only make it available during build time, but not during runtime. You will want to either add nodejs to the propagatedBuildInputs, or patch the source so that finds the nix store path |
Yeah I think I've wanted some way to automate this for quite a while. We could specify inputs for plugins, and then generate some vimscript to set up |
I tried |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't really speak to the best practices of derivations for Yarn packages, but I can confirm that this approach works for me (Neovim on Mac OS) and that this is a useful plugin. 👍
Edit: it looks like there is an unsuccessful PR check though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you forgot to add the lock file
cannot read '/nix/store/mx7qc6dlazvkgmmpji315y6pih7jkmhx-source/app/package.json', since path '/nix/store/j4xpz54q58kk3m4xgw7lbrf24iypa7iz-source.drv' is not valid, at /var/lib/ofborg/checkout/repo/38dca4e3aa6bca43ea96d2fcc04e8229/mr-est/packet-spot-eval-3/lib/trivial.nix:282:24
Also, do you mind squishing all the node commits into a single one:
vimPlugins.markdown-preview: enable node support
My understanding is that both nixpkgs/pkgs/development/tools/yarn2nix-moretea/yarn2nix/default.nix Lines 226 to 227 in 75ee187
Locally I have not had to add any of them as argument. Can you help me understand why I need to manually add them here? And do I need to add them both?
Will do 👍 |
I'm not entirely sure either (little experience with node packaging), but it looks like it expects for the file to be available locally |
ddf4c81
to
a2911bd
Compare
I have committed both the nixpkgs/pkgs/development/tools/yarn2nix-moretea/yarn2nix/default.nix Lines 389 to 391 in 75ee187
|
I see that other projects using So I guess I have to commit the generated |
pkgs/misc/vim-plugins/overrides.nix
Outdated
src = "${src}/app"; | ||
packageJSON = ./plugins/markdown-preview/package.json; | ||
yarnLock = ./plugins/markdown-preview/yarn.lock; | ||
yarnNix = ./plugins/markdown-preview/yarn.nix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that you need to add separate package.json
and yarn.lock
files to this repo. They are both included in the markdown-preview.nvim
repo. I think that you just need to do something like:
packageJSON = src + "/package.json";
yarnLock = src + "/package.json";
And since the yarn.lock
should ensure stable results, you shouldn't need to check in a yarn.nix
with this PR; yarn2nix
should be able to generate one itself.
At least this is my understanding. I could definitely be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the ofborg checks in this PR fail when any of the 3 files are not local to the nixpkgs
repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that the original problem was that it was trying to look in app/package.json
because of its default relative to the src
that was defined as src + "/app"
. Because of the squashing it's tough for me to see the history of what failed. Was there a commit where you fixed that but it still complained that the files weren't local?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I had incrementally added those files and watched ofborg fail. At @jonringer’s recommendation I squashed the commits into 1 so all that history is lost.
In reality all 3 files can be omitted and the plugin builds fine. It’s only these ofborg tests that fail. If you look at other usages of mkYarnPackage
in nixpkgs
you will notice that they have these 3 files commited:
https://github.com/NixOS/nixpkgs/tree/75ee18766ac52a97df1dc55a11a2d44cb0e68d0e/pkgs/servers/web-apps/codimd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly likely due to "Import from derivation" or IFD. Ofborg doesn't like you creating one derivation, then re-using outputs of that derivation to create another. Which is why you need to check-in the deps file, which eliminates one of the links in the import chain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oxalica you've done some node work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we put this under nodePackages?
There's an discussion in #83499 about making a shared Anyway, I'm not in favor of importing from derivation. But if so, we currently need to keep |
I would love for this plugin to get added to nixpkgs. Any way I can help? |
In case it's helpful to anyone else, I noticed that the nixpkgs unstable branch now includes vim-markdown-composer which seems to be a good replacement for markdown-preview written in Rust. |
Motivation for this change
Added the markdown-preview (neo)vim plugin.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)