neovim-nightly-overlay
neovim-nightly-overlay copied to clipboard
Instructions on how to use with nix
Hi.
The current instructions are for home-manager and nixos.
Could some instructions be added for how to use this with just nix?
I’ve read the nixpkgs documentation on overlays, many GitHub issues, and Google search results, but I just can’t figure out how to use this overlay.
Thanks in advance!
Past Attempt
Trying to put (https://discourse.nixos.org/t/solved-overlay-for-neovim-nightly-builds/5573/11):
$ cat neovim-nightly.nix
self: super: {
neovim-unwrapped = super.neovim-unwrapped.overrideAttrs (oldAttrs: {
version = "master";
src = builtins.fetchGit {
url = https://github.com/neovim/neovim.git;
};
nativeBuildInputs = super.neovim-unwrapped.nativeBuildInputs ++ [ super.tree-sitter ];
});
}
at ${HOME}/.config/nixpkgs/overlays/neovim.nix
yields:
Step 18/47 : ENV PATH=$HOME/.nix-profile/bin:$PATH NIXPKGS_ALLOW_UNFREE=1
Step 19/47 : RUN curl -L https://nixos.org/nix/install | sh && nix-channel --update
Step 20/47 : COPY --chown=$UID:$GID ["neovim-nightly.nix", "${HOME}/.config/nixpkgs/overlays/neovim.nix"]
Step 21/47 : RUN nix-env -iA nixpkgs.neovim nixpkgs.nodePackages.neovim nixpkgs.nodePackages.pyright
installing 'neovim-master'
installing 'node_neovim-4.10.0'
installing 'node_pyright-1.1.134'
...
so it actually installs nightly, but the luajit is old thus neovim doesn't work as per https://github.com/neovim/neovim/issues/14246.
This is a dead end (I'm not sure how to expand this to change the luajit version) and so I'm now trying your overlay.
Generally imperative package management on nix is discouraged. There's nothing different about this overlay than any other overlay. I believe you can just copy/paste the following in ~/.config/nix/overlays/nvim.nix
(import (builtins.fetchTarball {
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
}))
Thanks for the response! That's got me closer, but I now hit a infinite recursion
snag. Here's what I've tried thus far:
Attempt A
Trying to put
$ cat neovim-nightly.nix
(import (builtins.fetchTarball {
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
}))
at ${HOME}/.config/nix/overlays/neovim-nightly.nix
yields:
Step 18/47 : ENV PATH=$HOME/.nix-profile/bin:$PATH NIXPKGS_ALLOW_UNFREE=1
Step 19/47 : RUN curl -L https://nixos.org/nix/install | sh && nix-channel --update
Step 20/47 : COPY --chown=$UID:$GID ["neovim-nightly.nix", "${HOME}/.config/nix/overlays/neovim-nightly.nix"]
Step 21/47 : RUN nix-env -iA nixpkgs.neovim-nightly nixpkgs.nodePackages.neovim nixpkgs.nodePackages.pyright
error: attribute 'neovim-nightly' in selection path 'nixpkgs.neovim-nightly' not found
The command '/bin/sh -c nix-env -iA nixpkgs.neovim-nightly nixpkgs.nodePackages.neovim nixpkgs.nodePackages.pyright' returned a non-zero code: 1
I think that path is wrong.
Attempt B
Trying to put
$ cat neovim-nightly.nix
(import (builtins.fetchTarball {
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
}))
at ${HOME}/.config/nixpkgs/overlays.nix
yields:
Step 18/47 : ENV PATH=$HOME/.nix-profile/bin:$PATH NIXPKGS_ALLOW_UNFREE=1
Step 19/47 : RUN curl -L https://nixos.org/nix/install | sh && nix-channel --update
Step 20/47 : COPY --chown=$UID:$GID ["neovim-nightly.nix", "${HOME}/.config/nixpkgs/overlays.nix"]
Step 21/47 : RUN nix-env -iA nixpkgs.neovim-nightly nixpkgs.nodePackages.neovim nixpkgs.nodePackages.pyright
unpacking 'https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz'...
error: value is a function while a list was expected, at /nix/store/zn0vxcbn65bpjnvwr0pdb0yavvzn8c47-nixpkgs-21.11pre292293.84aa23742f6/nixpkgs/pkgs/top-level/stage.nix:263:8
The command '/bin/sh -c nix-env -iA nixpkgs.neovim-nightly nixpkgs.nodePackages.neovim nixpkgs.nodePackages.pyright' returned a non-zero code: 1
That's a dead end.
Attempt C
Trying to put
$ cat neovim-nightly.nix
(import (builtins.fetchTarball {
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
}))
at ${HOME}/.config/nixpkgs/overlays/neovim-nightly.nix
yields:
Step 18/48 : ENV PATH=$HOME/.nix-profile/bin:$PATH NIXPKGS_ALLOW_UNFREE=1
Step 19/48 : RUN curl -L https://nixos.org/nix/install | sh && nix-channel --update
Step 20/48 : COPY --chown=$UID:$GID ["neovim-nightly.nix", "${HOME}/.config/nixpkgs/overlays/neovim-nightly.nix"]
Step 21/48 : RUN nix-env -iA nixpkgs.neovim-nightly --show-trace
unpacking 'https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz'...
unpacking 'https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz'...
unpacking 'https://api.github.com/repos/neovim/neovim/tarball/3cd688ff775a50808eb7d260e540038cc32b4a40'...
unpacking 'https://api.github.com/repos/numtide/flake-utils/tarball/3982c9903e93927c2164caa727cd3f6a0e6d14cc'...
unpacking 'https://api.github.com/repos/nixos/nixpkgs/tarball/6933d068c5d2fcff398e802f7c4e271bbdab6705'...
error: while evaluating the attribute 'packages.x86_64-linux.neovim' at /nix/store/axbg7jbxvf91378zxsj1arf16chj6rqg-source/contrib/flake.nix:98:18:
while evaluating the attribute 'neovim-unwrapped.overrideAttrs' at /nix/store/bqj0vl2ikgkzj02n740alg7hmy5ym93h-source/flake.nix:15:9:
while evaluating the attribute 'packages.x86_64-linux.neovim' at /nix/store/axbg7jbxvf91378zxsj1arf16chj6rqg-source/contrib/flake.nix:98:18:
infinite recursion encountered, at /nix/store/axbg7jbxvf91378zxsj1arf16chj6rqg-source/contrib/flake.nix:98:18
The command '/bin/sh -c nix-env -iA nixpkgs.neovim-nightly --show-trace' returned a non-zero code: 1
It's unpacking the overlay so that's progress, but gets infinite recursion
. Not sure yet if this is a flake issue or something with the overlay.
Same. I would also appreciate the ability to use the overlay imperatively. There are still many things I don't quite understand about how nixpkgs works; but if I can help test anything, let me know please.
There's a very low probability I'm going to look into this/fix it, but I'll happily accept a patch to the flake in neovim core we're wrapping, or to the flake used here
Spent a few hours trying to get this overlay to work with nix on an Ubuntu system, had no luck. I am using the appimage for now, unless anyone with more nix experience can bring some ideas.
It works fine with home-manager, so I can recommend that.
This is what I'm using in ~/.config/nixpkgs/overlays/neovim-nightly.nix
:
let
neovim-nightly-overlay = import (builtins.fetchTarball {
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
});
in
self: super:
{
inherit (neovim-nightly-overlay self super) neovim-nightly;
}
then I install with:
$ nix-env -iA nixpkgs.neovim-nightly
note: you may need to uninstall the existing neovim
before this will be picked up in the path (I did!)
The problem appears to be with neovim-unwrapped
- if I include that in the inherit
, I also get the infinite recursion
error, as above.
This is what I'm using in
~/.config/nixpkgs/overlays/neovim-nightly.nix
:let neovim-nightly-overlay = import (builtins.fetchTarball { url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz; }); in self: super: { inherit (neovim-nightly-overlay self super) neovim-nightly; }
then I install with:
$ nix-env -iA nixpkgs.neovim-nightly
note: you may need to uninstall the existing
neovim
before this will be picked up in the path (I did!)The problem appears to be with
neovim-unwrapped
- if I include that in theinherit
, I also get theinfinite recursion
error, as above.
this worked, thanks! questions:
- is it actually install
neovim-unwrapped
? - how can I upgrade neovim? should I uninstall it first, or
nix-env -u
is enough?
thank you again
I'm actually not using nix-env
any more, having migrated to nix profile
(be warned - this is a "one-way" trip, and you'll probably want to migrate all of your existing environment, or reinstall everything from scratch - nix-env
will not work after using nix profile
!) and since migrating, I don't actually need this overlay trick any more.
I just do:
$ nix registry add flake:neovim-nightly github:nix-community/neovim-nightly-overlay
$ nix profile install "neovim-nightly#neovim"
and keep it up to date with:
$ nix profile upgrade 'packages.x86_64-linux.neovim'
It might be beneficial to add this to the README (with the caveat that nix profile
is somewhat experimental, though I am very happy since migrating)
That said, prior to migrating I would just do nix-env --upgrade --always
and it worked for me :)
I also believe that it was installing neovim-unwrapped
but I can't verify that any more.
That explains, thank you very much! I did use the (fortunately reversible) one way trip of nix profile
, and for now I decide to keep using bare bone stable nix because currently using it for research for my personal and team usage
Regards, Bandung.
On 30 Apr 2022, at 11.50, Josh Bode @.***> wrote:
I'm actually not using nix-env any more, having migrated to nix profile (be warned - this is a "one-way" trip, and you'll probably want to migrate all of your existing environment, or reinstall everything from scratch) and since migrating, I don't actually need this overlay trick any more.
I just do:
$ nix registry add flake:neovim-nightly github:nix-community/neovim-nightly-overlay $ nix profile install "neovim-nightly#neovim" and keep it up to date with:
$ nix profile upgrade 'packages.x86_64-linux.neovim' It might be beneficial to add this to the README (with the caveat that nix profile is somewhat experimental, though I am very happy since migrating)
That said, prior to migrating I would just do nix-env --upgrade --always and it worked for me :) I also believe that it was installing neovim-unwrapped but I can't verify that any more.