# Legacy ruby version

**URL:** https://discourse.nixos.org/t/legacy-ruby-version/3683
**Category:** Development
**Created:** [August 11, 2019, 8:03am UTC](https://discourse.nixos.org/t/legacy-ruby-version/3683 "2019-08-11T08:03:58Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![manveru](https://discourse.nixos.org/user_avatar/discourse.nixos.org/manveru/32/23_2.png) [@manveru](https://discourse.nixos.org/u/manveru)
#### Post date: [August 11, 2019, 1:17pm UTC](https://discourse.nixos.org/t/legacy-ruby-version/3683/2 "2019-08-11T13:17:27Z")

</div>

> [@mradke](#):
>
> So my question is: what am I doing wrong? Do I have to target an older nixpkgs version in order to get my desired results?

That’s correct, you’re using the default “nixpkgs” channel on your system by using the `<nixpkgs>` import. You can get the older ruby by using something like this:

```auto
import (builtins.fetchTarball {
  name = "nixos-unstable-2018-09-12";
  url = https://github.com/nixos/nixpkgs/archive/ca2ba44cab47767c8127d1c8633e2b581644eb8f.tar.gz;
  # Hash obtained using `nix-prefetch-url --unpack <url>`
  sha256 = "1jg7g6cfpw8qvma0y19kwyp549k1qyf11a5sg6hvn6awvmkny47v";
}) {}

```

Looking at [https://hydra.nixos.org/search?query=ruby\_2\_2](https://hydra.nixos.org/search?query=ruby_2_2) we never had a `2.2.4` version in nixpkgs, so you’ll have to use either `2.2.3` or `2.2.5`.

There are other ways, like building it yourself by modifying the version/hash in nixpkgs, but I think 2.2.5 should be fully compatible with 2.2.4 so I’d instead recommend that first.

Getting the nixpkgs revision for the version you want is also easy by looking at Hydra (not sure which OS you’re using so I’ll just assume a x86\_64-linux:  
[https://hydra.nixos.org/job/nixos/release-17.03/nixpkgs.ruby\_2\_2\_5.x86\_64-linux#tabs-status](https://hydra.nixos.org/job/nixos/release-17.03/nixpkgs.ruby_2_2_5.x86_64-linux#tabs-status)  
Click on the last successful build and from there go to the “Inputs” tab, which shows you which version of nixpkgs it was built with.

It is also easy to mix two versions of nixpkgs for different packages, so you only have to take Ruby from this ancient checkout and the rest of the packages can be more recent by simply assigning it to a different variable than `pkgs`.

Hope this helps.

---

_[View the full topic](https://discourse.nixos.org/t/legacy-ruby-version/3683)._
