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_configurable: enable overrides #34703

Merged
merged 1 commit into from Feb 9, 2018

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Feb 7, 2018

Motivation for this change

Sometimes it's needed to override parts of vim_configurable, for
instance when using ENSIME (http://ensime.github.io/), in this case you
need a Python interpreter and the modules sexpdata and
websocket_client.

However overriding vim_configurable is quite hard as we run
vimUtils.makeCustomizable over the default comming from
configurable.nix. Therefore it's necessary to copy the code from
all-packages.nix and alter the parts you need: https://nixos.org/nix-dev/2017-April/023364.html

In order to simplify overriding vim_configurable I added an
override and an overrideAttrs function to vimutils.makeCustomizable
to ensure that the customization capabilities won't be lost after
altering the derivation.

Now it's possible to write expressions like this without evaluation
failures:

with pkgs;

let
  vimPy3 = vim_configurable.override {
    python = python3;
  };
in vimPy3.customize { ... }
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
    • other Linux distributions
  • 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.

Sometimes it's needed to override parts of `vim_configurable`, for
instance when using ENSIME (http://ensime.github.io/), in this case you
need a Python interpreter and the modules `sexpdata` and
`websocket_client`.

However overriding `vim_configurable` is quite hard as we run
`vimUtils.makeCustomizable` over the default comming from
`configurable.nix`. Therefore it's necessary to copy the code from
`all-packages.nix` and alter the parts you need: https://nixos.org/nix-dev/2017-April/023364.html

In order to simplify overriding `vim_configurable` I added an
`override` and an `overrideAttrs` function to `vimutils.makeCustomizable`
to ensure that the customization capabilities won't be lost after
altering the derivation.

Now it's possible to write expressions like this without evaluation
failures:

```
with pkgs;

let
  vimPy3 = vim_configurable.override {
    python = python3;
  };
in vimPy3.customize { ... }
```
@Ma27
Copy link
Member Author

Ma27 commented Feb 7, 2018

$ nox-review pr 34703
=== Reviewing PR 34703 : vim_configurable: enable overrides
==> We're in a git repo, trying to fetch it
==> Fetching base (master)
==> Fetching PR
==> Fetching extra history for merging
==> Merging PR into base
Nothing changed

@Mic92
Copy link
Member

Mic92 commented Feb 9, 2018

yeah, vim_configurable is way to over-engineered.

@Mic92 Mic92 merged commit 76a08d4 into NixOS:master Feb 9, 2018
@Ma27 Ma27 deleted the make-overriding-vim-configurable-easier branch February 9, 2018 08:32
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

4 participants