Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nix: Compile Vim with Ruby

Tags:

vim

ruby

nix

I am using the Nix package manager on OS X. Let's say for the sake of argument I have a config.nix file that uses a pattern like so, allowing me to install the vimEnv no problem.

# ~/.nixpkgs/config.nix

{ pkgs }: {

  # Looking around I have seen overrides something along these lines...

  # nixpkgs.config.packageOverrides = pkgs: rec {
  #   vim = pkgs.vim_configurable.override {
  #     ruby = true;
  #    };
  #  };

  packageOverrides = super: let pkgs = super.pkgs; in with pkgs; rec {

    myEnv = pkgs.buildEnv {
      name = "myEnv";
      paths = [
        # ...snip
        vim
        # ...snip
      ];
    };

  };
}

I know that there are elaborate options available for maintaining a .vimrc and vim plugins using Nix and by overriding vim_configurable options and so forth (for example), and it would be nice to find the time to do that at some point. However, all I want to do for now is to install via Nix a version of Vim which is compiled with Ruby support.

What would be the easiest or most concise way for me to achieve this in my config.nix?

like image 833
jhrr Avatar asked Jul 27 '26 10:07

jhrr


1 Answers

And, after some hacking, here is the simplest solution I have found:

# ~/.nixpkgs/config.nix

{ pkgs }: {

  packageOverrides = super: let pkgs = super.pkgs; in with pkgs; rec {

    myVim = pkgs.vim_configurable.override {
      config.vim = {
        ruby = true;
      };
      ruby = ruby;
    };

    myEnv = pkgs.buildEnv {
      name = "myEnv";
      paths = [
        myVim
      ];
    };

  };
}

And install it with nix-env -i myEnv.

like image 199
jhrr Avatar answered Jul 29 '26 22:07

jhrr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!