Skip to content

Commit

Permalink
feat: switch from flake-utils to flake-parts
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Aug 16, 2023
1 parent 3912076 commit 1b35d07
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 97 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -10,11 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Luarocks Upload workflow
- Luarocks Upload workflow.

### Changed

- Loosen license restrictions to allow any OSI approved open source derivations.
- Switch from `flake-utils` to `flake-parts`.

### Added

Expand Down
66 changes: 35 additions & 31 deletions flake.lock

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

134 changes: 69 additions & 65 deletions flake.nix
Expand Up @@ -4,12 +4,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";

flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};

flake-utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";

pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
Expand All @@ -27,81 +22,90 @@
};
};

outputs = {
outputs = inputs @ {
self,
nixpkgs,
flake-utils,
flake-parts,
pre-commit-hooks,
neovim-nightly-overlay,
plenary-nvim,
...
}: let
name = "plugin-template.nvim"; # TODO: Choose a name

supportedSystems = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
];
plugin-overlay = import ./nix/plugin-overlay.nix {
inherit name self;
};
in
flake-utils.lib.eachSystem supportedSystems (system: let
ci-overlay = import ./nix/ci-overlay.nix {
inherit
self
plenary-nvim
;
};
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
perSystem = {
config,
self',
inputs',
system,
...
}: let
ci-overlay = import ./nix/ci-overlay.nix {
inherit
self
plenary-nvim
;
};

plugin-overlay = import ./nix/plugin-overlay.nix {
inherit name self;
};
pkgs = import nixpkgs {
inherit system;
overlays = [
ci-overlay
neovim-nightly-overlay.overlay
plugin-overlay
];
};

pkgs = import nixpkgs {
inherit system;
overlays = [
ci-overlay
neovim-nightly-overlay.overlay
plugin-overlay
];
};
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = self;
hooks = {
alejandra.enable = true;
stylua.enable = true;
luacheck.enable = true;
editorconfig-checker.enable = true;
markdownlint.enable = true;
};
};

pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = self;
hooks = {
alejandra.enable = true;
stylua.enable = true;
luacheck.enable = true;
editorconfig-checker.enable = true;
markdownlint.enable = true;
devShell = pkgs.mkShell {
name = "devShell"; # TODO: Choose a name
inherit (pre-commit-check) shellHook;
buildInputs = with pkgs; [
zlib
];
};
in {
devShells = {
default = devShell;
inherit devShell;
};
};

devShell = pkgs.mkShell {
name = "devShell"; # TODO: Choose a name
inherit (pre-commit-check) shellHook;
buildInputs = with pkgs; [
zlib
];
};
in {
devShells = {
default = devShell;
inherit devShell;
};
packages = rec {
default = nvim-plugin;
inherit (pkgs) nvim-plugin;
};

packages = rec {
default = nvim-plugin;
inherit (pkgs) nvim-plugin;
checks = {
formatting = pre-commit-check;
inherit
(pkgs)
nvim-stable-tests
nvim-nightly-tests
;
};
};

checks = {
formatting = pre-commit-check;
inherit
(pkgs)
nvim-stable-tests
nvim-nightly-tests
;
flake = {
overlays.default = plugin-overlay;
};
});
};
}

0 comments on commit 1b35d07

Please sign in to comment.