Skip to content

Commit

Permalink
feat: move neovim flake into the overlay itself
Browse files Browse the repository at this point in the history
Maintaing the flake in the official neovim repository became too much of
a burden so we are moving it out to a nix-community repository.

This is the opportunity to do more and add automation so that the neovim
nix overlay doesnt ever break !

Co-authored-by: Riley Bruins <ribru17@hotmail.com>
Co-authored-by: Matthieu Coudron <886074+teto@users.noreply.github.com>
Co-authored-by: Will Ruggiano <wmruggiano@gmail.com>
  • Loading branch information
4 people committed May 23, 2024
1 parent 7b5ca24 commit d659352
Show file tree
Hide file tree
Showing 16 changed files with 407 additions and 84 deletions.
1 change: 0 additions & 1 deletion .envrc

This file was deleted.

1 change: 1 addition & 0 deletions .envrc.developer.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake . --override-input neovim-src /path/to/neovim
1 change: 1 addition & 0 deletions .envrc.minimal.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake .#minimal
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# nix
# direnv
/.direnv
/.envrc

# neovim-developer
/runtime/

# nix
result
result-*
.pre-commit-config.yaml
Expand Down
11 changes: 6 additions & 5 deletions flake-compat.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{
src = ./.;
}).defaultNix
})
.defaultNix
111 changes: 67 additions & 44 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 26 additions & 33 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,34 @@
description = "Neovim flake";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; };
hercules-ci-effects = { url = "github:hercules-ci/hercules-ci-effects"; inputs.nixpkgs.follows = "nixpkgs"; };
flake-compat = { url = "github:edolstra/flake-compat"; flake = false; };
neovim-flake = { url = "github:neovim/neovim?dir=contrib"; inputs.nixpkgs.follows = "nixpkgs"; };
nixpkgs.url = "github:NixOS/nixpkgs/3305b2b25e4ae4baee872346eae133cf6f611783";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
hercules-ci-effects = {
url = "github:hercules-ci/hercules-ci-effects";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
neovim-src = {
url = "github:neovim/neovim";
flake = false;
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs";
};
};

outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } ({ config, ... }: {
inputs.flake-parts.lib.mkFlake
{inherit inputs;}
({config, ...}: {
systems = [
"x86_64-linux"
"x86_64-darwin"
Expand All @@ -19,33 +38,7 @@
];

imports = [
inputs.flake-parts.flakeModules.easyOverlay
inputs.hercules-ci-effects.flakeModule
./flake
];

perSystem = { inputs', system, config, lib, pkgs, ... }: {
packages = {
neovim = inputs'.neovim-flake.packages.neovim // (lib.optionalAttrs pkgs.stdenv.isDarwin { ignoreFailure = true; });
default = config.packages.neovim;
};
overlayAttrs = lib.genAttrs [ "neovim-unwrapped" "neovim-nightly" ] (_: config.packages.neovim);
};

flake = {
defaultPackage = inputs.nixpkgs.lib.genAttrs config.systems (system: inputs.self.packages.${system}.default);
overlay = inputs.self.overlays.default;
};

hercules-ci.flake-update = {
enable = true;
baseMerge.enable = true;
baseMerge.method = "rebase";
autoMergeMethod = "rebase";
# Update everynight at midnight
when = {
hour = [ 0 ];
minute = 0;
};
};
});
}
22 changes: 22 additions & 0 deletions flake/checks.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{inputs, ...}: {
perSystem = {
pkgs,
config,
...
}: {
checks = {
# TODO: not working: remove ?
# shlint = pkgs.runCommand "shlint" {
# nativeBuildInputs = [pkgs.shellcheck];
# preferLocalBuild = true;
# } "make -C ${inputs.neovim-src} shlint > $out";

inherit
(config.packages)
neovim
neovim-debug
neovim-developer
;
};
};
}
17 changes: 17 additions & 0 deletions flake/ci.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{inputs, ...}: {
imports = [
inputs.hercules-ci-effects.flakeModule
];

hercules-ci.flake-update = {
enable = true;
baseMerge.enable = true;
baseMerge.method = "rebase";
autoMergeMethod = "rebase";
# Update everynight at midnight
when = {
hour = [0];
minute = 0;
};
};
}
20 changes: 20 additions & 0 deletions flake/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{inputs, ...}: {
imports = [
./checks.nix
./ci.nix
./devshells.nix
./overlays.nix
./packages
inputs.pre-commit-hooks.flakeModule
];

perSystem = {pkgs, ...}: {
formatter = pkgs.alejandra;
pre-commit.settings.hooks.alejandra.enable = true;

# Neovim uses lua 5.1 as it is the version which supports JIT
_module.args = {
lua = pkgs.lua5_1;
};
};
}
Loading

0 comments on commit d659352

Please sign in to comment.