Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim-plugins: add overrideAttrs support for buildVimPluginFrom2Nix #29871

Merged
merged 1 commit into from Oct 8, 2017

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Sep 27, 2017

Motivation for this change

Some days ago I packaged xptemplate for VIM.
However according to the docs the recommended approach to use custom snippets is to copy them into the personal/ directory (https://github.com/drmingdrmer/xptemplate#extend-xptemplate-write-new-snippets)

The easiest approach is to override the plugin and add a postInstall script, however until now it wasn't possible to override VIM plugins.

I confirmed the change using the following expressions for a test VM:

{
  vim = { pkgs, ... }: {
    environment.systemPackages = let
      vim = with pkgs; vim_configurable.customize {
        name = "xptemplatetest";
        vimrcConfig.vam.knownPlugins = vimPlugins;
        vimrcConfig.vam.pluginDictionaries = [
          { name = "xptemplate"; }
        ];
      };
    in [ vim ];

    nixpkgs.config.packageOverrides = super: {
      vimPlugins = super.vimPlugins // {
        xptemplate = super.vimPlugins.xptemplate.overrideAttrs(_: {
          postInstall = ''
            cp -R ${../nixos-config/apps/vim-snippets} $out/share/vim-plugins/xptemplate/personal/ftplugin
          '';
        });
      };
    };

    users.extraUsers.vm = {
      isNormalUser = true;
      password = "vm";
    };
  };
}
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@Ma27 Ma27 force-pushed the vim-utils/override-capability branch from 1b9ae4b to acf0ee6 Compare October 1, 2017 09:33
@Ma27
Copy link
Member Author

Ma27 commented Oct 8, 2017

anything else to be done?

@LnL7 LnL7 merged commit 64a9483 into NixOS:master Oct 8, 2017
@Ma27 Ma27 deleted the vim-utils/override-capability branch October 12, 2017 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants