Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using a specific nixpkgs version to install a package
{ pkgs ? (import <nixpkgs> {}) }:
rec {
# import nixpkgs from a specific commit hash
oldNixpkgs = pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
# here goes the commit hash
rev = "c2268175651c4aa1da23c1b84ecebc0a0df56633";
sha256 = "0asjhmzwgipbmv3l58l4g4miw6mhywpzzviirys1r33ykbacvjkf";
};
# import the "old" packages
oldPkgs = import "${oldNixpkgs}" {};
# use the oldPkgs and use the "ripgrep" package
myRipgrep = oldPkgs.ripgrep;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment