forked from Exafunction/codeium.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
101 lines (93 loc) · 2.73 KB
/
flake.nix
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
96
97
98
99
100
101
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
nixpkgs,
flake-utils,
...
}
: let
systems = {
"aarch64-linux" = "linux_arm";
"aarch64-darwin" = "macos_arm";
"x86_64-linux" = "linux_x64";
"x86_64-darwin" = "macos_x64";
};
in
flake-utils.lib.eachSystem (builtins.attrNames systems) (
system: let
ls-system = systems.${system};
versions = builtins.fromJSON (builtins.readFile ./lua/codeium/versions.json);
pkgs = import nixpkgs {
inherit system;
};
in rec {
formatter = pkgs.alejandra;
packages = with pkgs; {
codeium-lsp = stdenv.mkDerivation {
pname = "codeium-lsp";
version = "v${versions.version}";
src = pkgs.fetchurl {
url = "https://github.com/Exafunction/codeium/releases/download/language-server-v${versions.version}/language_server_${ls-system}";
sha256 = versions.hashes.${system};
};
sourceRoot = ".";
phases = ["installPhase" "fixupPhase"];
nativeBuildInputs =
[
stdenv.cc.cc
]
++ (
if !stdenv.isDarwin
then [autoPatchelfHook]
else []
);
installPhase = ''
mkdir -p $out/bin
install -m755 $src $out/bin/codeium-lsp
'';
};
vimPlugins.codeium-nvim = vimUtils.buildVimPlugin {
pname = "codeium";
version = "v${versions.version}-main";
src = ./.;
buildPhase = ''
cat << EOF > lua/codeium/installation_defaults.lua
return {
tools = {
language_server = "${packages.codeium-lsp}/bin/codeium-lsp"
};
};
EOF
'';
};
nvimWithCodeium = neovim.override {
configure = {
customRC = ''
lua require("codeium").setup()
'';
packages.myPlugins = {
start = [packages.vimPlugins.codeium-nvim vimPlugins.plenary-nvim vimPlugins.nvim-cmp];
};
};
};
};
overlays.default = self: super: {
vimPlugins =
super.vimPlugins
// {
codeium-nvim = packages.vimPlugins.codeium-nvim;
};
};
apps.default = {
type = "app";
program = "${packages.nvimWithCodeium}/bin/nvim";
};
devShell = pkgs.mkShell {
packages = [];
};
}
);
}