Neovim-nightly and emacs-pgtk-nativecomp overlays

I was learning how to use cachix with github actions and am now maintaining two overlays: neovim-nightly and pure gtk emacs with native compilation. The latter, a pure gtk port of the emacs gui, is not available in the nix-community overlay, as the pure gtk port of emacs has not yet been merged upstream (and it also is based on a branch that merges pure gtk and native compilation feature branches). I provide binaries via cachix for neovim-nightly for both mac and linux, and binaries for emacs-pgtk-nativecomp for linux.

5 Likes

thanks for providing this. I never managed to share my neovim-master derivation like you did. Do you run niv update or a cronjob ? I find the repo a bit overwhelming for a change that can be done by just overriding the src with builtins.fetchGit https://github.com/neovim/neovim.git; .
I plan to setup a sr.ht job as part of neovim’s upstream tests, which may come in handy too.

The repo is a bit huge, most of that is overhead from cachix/CI/CD/github actions/niv.

The update of the repo is done via niv with a cronjob using a github action:

name: Update niv

on:
  schedule:
    # every day at 8am UTC
    - cron: '0 8 * * *'

jobs:
  update-dependencies:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2.3.2
    - uses: cachix/install-nix-action@v10
    - run: nix-shell --run "niv update"
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v3
      with:
        commit-message: "chore: update niv dependencies"
        title: "chore: update niv dependencies"
        branch: "chore/update-niv-dependencies"

This automatically makes a PR, which I merge (triggering the CI which builds for linux and macos and pushes to cachix).

The other source of overhead is I version nixpkgs itself in the overlay with niv,


let
  sources = import ./nix/sources.nix;
  nixpkgs = sources."nixpkgs-unstable";
  pkgs = import nixpkgs {};
in
_: _:
  {
    neovim-nightly = pkgs.neovim-unwrapped.overrideAttrs (
      _: {
        version = "master";
        src = pkgs.fetchFromGitHub {
          inherit (sources.neovim) owner repo rev sha256;
        };
      }
    );
  }

There are two main reason I did this; I wanted to ensure that if you use the overlay, you are guaranteed not to have a nixpkgs-unstable hash mismatch and always hit my cachix cache. The second reason, is I wanted anyone who uses the overlay to be able to easily rollback to prior commits of neovim/nixpkgs, should there be a breaking change (which you don’t get when you replace the source with master) such as that which has happened surrounding lua/libluv.

The majority of the repository is taken straight from https://github.com/nix-dot-dev/getting-started-nix-template, but I’m happy to simplify or align with best practices!

Edit: Also, I think you helped me on IRC when I first started using nix and wanted to use neovim builds from master!

For those interested, I’ve added a flake.nix to neovim repository (not on master but in the flake branch:
https://github.com/neovim/neovim/blob/6b2ff65f3b12fe0cae8f5c6266816a7e63981f7e/flake.nix).

1 Like

Thanks @teto! On a separate note, I should also mention I am now providing binaries for nativecomp emacs on macOS via cachix in the emacs-pgtk-nativecomp overlay (not using pgtk of course).

@teto any chance you’re going to take a crack at getting tree-sitter working on aarch64? (sorry, this was a bit off-topic of me, feel free to ignore)

@colemickens nope sry, but I am sure big distribs like debian will contribute to this.