aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: af59dc8702d837132e5678824a08fce827e26faa (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
{
  description = "My Completely Inelegant Neovim Flake";

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

  outputs = { self, nixpkgs }:
  let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
      overlays = [
        (self: super: {
          vale = super.callPackage ./nix/vale.nix { };
          flake8-isort = super.python3Packages.callPackage ./nix/flake8-isort.nix { };
          mypython = super.python3Packages.callPackage ./nix/mypython.nix { };
        })
      ];
    };
  in rec {
    # For nix < 2.7
    # For nix >= 2.7 they should grab from:
    #     apps.${system}.default
    #     packages.${system}.default
    # automatically
    defaultApp.${system} = apps.${system}.default;
    defaultPackage.${system} = packages.${system}.default;

    apps.${system} = rec {
      nvim = {
        type = "app";
        program = "${packages.${system}.default}/bin/nvim";
      };
      default = nvim;
    };
    packages.${system} = with pkgs; rec {
      default = neovimCH;
      neovimCH = symlinkJoin {
        name = "neovim";
        paths = [ pkgs.neovim ];
        buildInputs = [ pkgs.makeWrapper ];
        postBuild = with pkgs; ''
          rm $out/bin/nvim
          BINPATH=${lib.makeBinPath [
            nodejs
            mypython
            pyright
            vale
            tree-sitter
            nodePackages.bash-language-server
            shellcheck
            hadolint
          ]}
          makeWrapper ${neovim}/bin/nvim $out/bin/nvim --prefix PATH : $BINPATH
        '';
      };
    };
  };
}