mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-13 21:53:01 +01:00
optimize nix-based nvim plugins
This commit is contained in:
parent
9dd246d4d9
commit
f0d49bc838
2 changed files with 50 additions and 23 deletions
|
@ -3,6 +3,9 @@
|
||||||
, pkgs
|
, pkgs
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
luaExpr = val: if val == null then "nil" else "[[${val}]]";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./jvm.nix
|
./jvm.nix
|
||||||
|
@ -21,7 +24,7 @@
|
||||||
name = "nix.lua";
|
name = "nix.lua";
|
||||||
text = ''
|
text = ''
|
||||||
return {
|
return {
|
||||||
${builtins.concatStringsSep "\n " (lib.mapAttrsToList (k: v: ''["${k}"] = "${v}",'') config.cgnix.entries)}
|
${builtins.concatStringsSep "\n " (lib.mapAttrsToList (k: v: ''["${k}"] = ${luaExpr v},'') config.cgnix.entries)}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, lib, stdenv, ... }:
|
{ config, pkgs, lib, stdenvNoCC, ... }:
|
||||||
let
|
let
|
||||||
plugin = name: fetchGit { url = "https://git.mzte.de/nvim-plugins/${name}.git"; };
|
plugin = name: fetchGit { url = "https://git.mzte.de/nvim-plugins/${name}.git"; };
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ let
|
||||||
in
|
in
|
||||||
if (builtins.pathExists path) then
|
if (builtins.pathExists path) then
|
||||||
# This derivation exists to patch a potentially mismatched dynamic linker.
|
# This derivation exists to patch a potentially mismatched dynamic linker.
|
||||||
stdenv.mkDerivation
|
stdenvNoCC.mkDerivation
|
||||||
{
|
{
|
||||||
name = "mzte-nv-compiler-patched";
|
name = "mzte-nv-compiler-patched";
|
||||||
nativeBuildInputs = [ pkgs.autoPatchelfHook ];
|
nativeBuildInputs = [ pkgs.autoPatchelfHook ];
|
||||||
|
@ -82,27 +82,51 @@ in
|
||||||
options.cgnix.nvim-plugins = lib.mkOption { };
|
options.cgnix.nvim-plugins = lib.mkOption { };
|
||||||
config.cgnix.nvim-plugins = plugins;
|
config.cgnix.nvim-plugins = plugins;
|
||||||
|
|
||||||
config.cgnix.entries.nvim_plugins = pkgs.linkFarm "nvim-plugins"
|
config.cgnix.entries.nvim_plugins = stdenvNoCC.mkDerivation {
|
||||||
(lib.mapAttrsToList
|
name = "nvim-plugins";
|
||||||
(name: src: {
|
|
||||||
name = name;
|
|
||||||
path = stdenv.mkDerivation {
|
|
||||||
name = "${name}-compiled";
|
|
||||||
inherit src;
|
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [ luajit luajitPackages.fennel ];
|
nativeBuildInputs = with pkgs; [ luajit luajitPackages.fennel ];
|
||||||
|
|
||||||
buildPhase = ''
|
unpackPhase = ''
|
||||||
# Compile source with mzte-nv-compile
|
# Copy plugins sources here
|
||||||
${if mzte-nv-compiler != "" then "${mzte-nv-compiler} ." else ""}
|
${builtins.concatStringsSep "\n" (lib.mapAttrsToList
|
||||||
'';
|
(name: src: "cp -r ${src} ${name}")
|
||||||
|
config.cgnix.nvim-plugins)}
|
||||||
|
chmod -R +rw .
|
||||||
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
buildPhase = ''
|
||||||
mkdir -p "$out"
|
# Compile
|
||||||
mv * .* "$out"
|
${if mzte-nv-compiler != "" then "${mzte-nv-compiler} ." else ""}
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
})
|
installPhase = ''
|
||||||
config.cgnix.nvim-plugins
|
mkdir -p "$out"
|
||||||
);
|
mv * .* "$out"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
#pkgs.linkFarm "nvim-plugins"
|
||||||
|
# (lib.mapAttrsToList
|
||||||
|
# (name: src: {
|
||||||
|
# name = name;
|
||||||
|
# path = stdenv.mkDerivation {
|
||||||
|
# name = "${name}-compiled";
|
||||||
|
# inherit src;
|
||||||
|
|
||||||
|
# nativeBuildInputs = with pkgs; [ luajit luajitPackages.fennel ];
|
||||||
|
|
||||||
|
# buildPhase = ''
|
||||||
|
# # Compile source with mzte-nv-compile
|
||||||
|
# ${if mzte-nv-compiler != "" then "${mzte-nv-compiler} ." else ""}
|
||||||
|
# '';
|
||||||
|
|
||||||
|
# installPhase = ''
|
||||||
|
# mkdir -p "$out"
|
||||||
|
# mv * .* "$out"
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
# })
|
||||||
|
# config.cgnix.nvim-plugins
|
||||||
|
# );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue