From 5fb2184bd333d8ea72ebb452539955ee2b347835 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 25 Sep 2017 14:24:01 +0200 Subject: [PATCH 1/2] vim-plugins: add {pre,post}Install hooks to `buildVimPlugin` --- pkgs/misc/vim-plugins/vim-utils.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/misc/vim-plugins/vim-utils.nix b/pkgs/misc/vim-plugins/vim-utils.nix index 87b2f9d3e18..b659266ace7 100644 --- a/pkgs/misc/vim-plugins/vim-utils.nix +++ b/pkgs/misc/vim-plugins/vim-utils.nix @@ -383,6 +383,8 @@ rec { unpackPhase ? "", configurePhase ? "", buildPhase ? "", + preInstall ? "", + postInstall ? "", path ? (builtins.parseDrvName name).name, addonInfo ? null, ... @@ -390,9 +392,11 @@ rec { addRtp "${rtpPath}/${path}" (stdenv.mkDerivation (a // { name = namePrefix + name; - inherit unpackPhase configurePhase buildPhase addonInfo; + inherit unpackPhase configurePhase buildPhase addonInfo preInstall postInstall; installPhase = '' + runHook preInstall + target=$out/${rtpPath}/${path} mkdir -p $out/${rtpPath} cp -r . $target @@ -401,6 +405,8 @@ rec { if [ -n "$addonInfo" ]; then echo "$addonInfo" > $target/addon-info.json fi + + runHook postInstall ''; })); From 67a42ae2a12676376c44e0b3134475ca3a2c2443 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 25 Sep 2017 14:24:36 +0200 Subject: [PATCH 2/2] vim-plugins: document `nix-shell -I` usage for `vim-plugin-names-to-nix` usage I use my own fork for NixOS development/testing, but `nixos-unstable` for my system configuration. Whenever I add a new plugin and I regenerate the expressions I need to change the `NIX_PATH` variable to my own fork. As this is something I tend to forget I think it's better to document this. --- pkgs/misc/vim-plugins/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix index 7944533c112..0bfa6c89a15 100644 --- a/pkgs/misc/vim-plugins/default.nix +++ b/pkgs/misc/vim-plugins/default.nix @@ -16,7 +16,7 @@ in # TL;DR # Add your plugin to ./vim-plugin-names -# Regenerate via `nix-shell -p vimPlugins.pluginnames2nix --command "vim-plugin-names-to-nix"` +# Regenerate via `nix-shell -I nixpkgs=/path/to/your/local/fork -p vimPlugins.pluginnames2nix --command "vim-plugin-names-to-nix"` # Copy the generated expression(s) into this file. # If plugin is complicated then make changes to ./vim2nix/additional-nix-code