diff --git a/nix/cgnix/default.nix b/nix/cgnix/default.nix index 0a253b7..c28bd00 100644 --- a/nix/cgnix/default.nix +++ b/nix/cgnix/default.nix @@ -3,6 +3,9 @@ , pkgs , ... }: +let + luaExpr = val: if val == null then "nil" else "[[${val}]]"; +in { imports = [ ./jvm.nix @@ -21,7 +24,7 @@ name = "nix.lua"; text = '' 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)} } ''; }; diff --git a/nix/cgnix/nvim-plugins.nix b/nix/cgnix/nvim-plugins.nix index a91b2f9..623e133 100644 --- a/nix/cgnix/nvim-plugins.nix +++ b/nix/cgnix/nvim-plugins.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, stdenv, ... }: +{ config, pkgs, lib, stdenvNoCC, ... }: let plugin = name: fetchGit { url = "https://git.mzte.de/nvim-plugins/${name}.git"; }; @@ -67,7 +67,7 @@ let in if (builtins.pathExists path) then # This derivation exists to patch a potentially mismatched dynamic linker. - stdenv.mkDerivation + stdenvNoCC.mkDerivation { name = "mzte-nv-compiler-patched"; nativeBuildInputs = [ pkgs.autoPatchelfHook ]; @@ -82,27 +82,51 @@ in options.cgnix.nvim-plugins = lib.mkOption { }; config.cgnix.nvim-plugins = plugins; - config.cgnix.entries.nvim_plugins = pkgs.linkFarm "nvim-plugins" - (lib.mapAttrsToList - (name: src: { - name = name; - path = stdenv.mkDerivation { - name = "${name}-compiled"; - inherit src; + config.cgnix.entries.nvim_plugins = stdenvNoCC.mkDerivation { + name = "nvim-plugins"; - nativeBuildInputs = with pkgs; [ luajit luajitPackages.fennel ]; + nativeBuildInputs = with pkgs; [ luajit luajitPackages.fennel ]; - buildPhase = '' - # Compile source with mzte-nv-compile - ${if mzte-nv-compiler != "" then "${mzte-nv-compiler} ." else ""} - ''; + unpackPhase = '' + # Copy plugins sources here + ${builtins.concatStringsSep "\n" (lib.mapAttrsToList + (name: src: "cp -r ${src} ${name}") + config.cgnix.nvim-plugins)} + chmod -R +rw . + ''; - installPhase = '' - mkdir -p "$out" - mv * .* "$out" - ''; - }; - }) - config.cgnix.nvim-plugins - ); + buildPhase = '' + # Compile + ${if mzte-nv-compiler != "" then "${mzte-nv-compiler} ." else ""} + ''; + + installPhase = '' + 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 + # ); }