summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 71f63edaab85a596da61cedc212fddce5da9f84e (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
  description = "getchoo's neovim config";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    flake-checks.url = "github:getchoo/flake-checks";
  };

  outputs =
    {
      self,
      nixpkgs,
      flake-checks,
    }:
    let
      systems = [
        "x86_64-linux"
        "aarch64-linux"
        "x86_64-darwin"
        "aarch64-darwin"
      ];

      forAllSystems =
        fn:
        nixpkgs.lib.genAttrs systems (
          system:
          fn {
            inherit system;
            pkgs = nixpkgs.legacyPackages.${system};
          }
        );
    in
    {
      checks = forAllSystems (
        { pkgs, ... }:
        let
          flake-checks' = flake-checks.lib.mkChecks {
            root = ./.;
            inherit pkgs;
          };
        in
        {
          inherit (flake-checks')
            actionlint
            alejandra
            selene
            statix
            stylua
            ;
        }
      );

      devShells = forAllSystems (
        { pkgs, system }:
        {
          default = pkgs.mkShellNoCC {
            packages = [
              pkgs.actionlint

              # lua
              pkgs.lua-language-server
              pkgs.selene
              pkgs.stylua

              # nix
              self.formatter.${system}
              pkgs.deadnix
              pkgs.nil
              pkgs.statix
            ];
          };
        }
      );

      formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);

      packages = forAllSystems (
        { pkgs, system }:
        let
          packages' = self.packages.${system};
          version = self.shortRev or self.dirtyShortRev or "unknown";
        in
        {
          getchvim = pkgs.callPackage ./neovim.nix {
            inherit version;
            inherit (packages') vimPlugins-getchoo-nvim;
          };

          vimPlugins-getchoo-nvim = pkgs.callPackage ./config { inherit version; };

          default = packages'.getchvim;
        }
      );
    };
}