Skip to content

Instantly share code, notes, and snippets.

@matthiasbeyer
Created November 9, 2021 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthiasbeyer/a3879a43e56284595e27c05f92cef24f to your computer and use it in GitHub Desktop.
Save matthiasbeyer/a3879a43e56284595e27c05f92cef24f to your computer and use it in GitHub Desktop.
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