summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 37c8ebc4e921768a610f8786840898058036b2d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
  description = "getchoo's neovim config";

  inputs.nixpkgs.url = "nixpkgs/nixos-unstable";

  outputs = {
    self,
    nixpkgs,
    ...
  }: let
    inherit (nixpkgs) lib;
    version = builtins.substring 0 8 self.lastModifiedDate or "dirty";

    systems = [
      "x86_64-linux"
      "aarch64-linux"
      "x86_64-darwin"
      "aarch64-darwin"
    ];

    forAllSystems = fn: lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys});
  in {
    checks = forAllSystems (pkgs: {
      stylua = pkgs.runCommand "stylua-check" {nativeBuildInputs = [pkgs.stylua];} ''
        stylua -c ${self}
        touch $out
      '';
    });

    devShells = forAllSystems (pkgs: {
      default = import ./shell.nix {inherit pkgs;};
    });

    formatter = forAllSystems (pkgs: pkgs.alejandra);

    packages = forAllSystems (pkgs: let
      p = self.overlays.default pkgs pkgs;
    in {
      inherit (p.vimPlugins) getchvim;
      default = p.vimPlugins.getchvim;
    });

    overlays.default = final: prev: {
      vimPlugins = prev.vimPlugins.extend (_: _: {
        getchvim = prev.callPackage ./default.nix {
          inherit (final.vimUtils) buildVimPluginFrom2Nix;
          inherit self version;
        };
      });
    };
  };
}