Closed bryaan closed 4 years ago
You can use multiple nixpkgs as inputs. Something like:
{
inputs.nixpkgs-ruby-1-2-3.url = "github:nixos/nixpkgs/release-20.09";
inputs.nixpkgs-ruby-3-2-1.url = "github:nixos/nixpkgs/release-19.09";
outputs = { nixpkgs-ruby-1-2-3, nixpkgs-ruby-3-2-1 }: {
...
ruby-1-2-3 = nixpkgs-ruby-1-2-3.legacyPackages.x86_64.ruby;
ruby-3-2-1 = nixpkgs-ruby-3-2-1.legacyPackages.x86_64.ruby;
...
};
}
However, I find this less than ideal, as you the full derivation will be huge (multiple openssls, glibc, etc).
I still think something like nixpkgs-ruby is a better way to go. Yes, you are not guaranteed the version of Ruby you're trying to use will work with the nixpkgs you are using, but when it does, you lock nixpkgs and nixpkgs-ruby and a next user is guaranteed the build will work.
Whenever you upgrade nixpkgs and the desired Ruby version does not build, then you can make the patches yourself (.override
) or update nixpkgs-ruby
so that the build-script is compatible with nixpkgs again.
I also found this configuration.nix
(via this post), where basically Nixpkgs is pinned multiple times depending on the required package version:
in let
reallyOld = import (pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "083d0890f50c7bff87419b88465af6589faffa2e";
sha256 = "13gldascq0wjifcpd8sh0rq0gx074x1n2ybx5mwq6hinjplgfi50";
}) {};
polybarPin = import (pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "9543e3553719894e71591c5905889fc4ffaa5932";
sha256 = "0x86w7lxhfdchnqfan6fqpj6j09mjz2sq1plmbwchnqfjg37akfa";
}) {};
gMusicPin = import (pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "c1b3b6f8b22fe11b894c236bcfe6522c6a46dc5d";
sha256 = "04i4iy26pa585bwy43487k27arigyrsdh6vv0khz5n58ixswgkfa";
}) {};
(I haven't seen this mentioned explicitly, but this is a long thread, so I will be happy to delete this if wrong.)
I have a project where I've specified a default.nix. I want to install a specific version of sqlite (and other packages) but cannot get it to work in the following manner. What is the correct way of specifying package version?