Found all these from nix-repl
. Use builtins.fetchTarball
for nixpkgs pinning!
builtins.fetchurl
builtins.fetchTarball
pkgs.fetchFromBitbucket
pkgs.fetchFromGitHub
pkgs.fetchFromGitLab
pkgs.fetchFromRepoOrCz
pkgs.fetchFromSavannah
pkgs.fetchHex
pkgs.fetchMavenArtifact
pkgs.fetchNuGet
pkgs.fetchadc
pkgs.fetchbower
pkgs.fetchbzr
pkgs.fetchcvs
pkgs.fetchdarcs
pkgs.fetchegg
pkgs.fetchfossil
pkgs.fetchgit
pkgs.fetchgitLocal
pkgs.fetchgitPrivate
pkgs.fetchgitrevision
pkgs.fetchgx
pkgs.fetchhg
pkgs.fetchmail
pkgs.fetchmtn
pkgs.fetchpatch
pkgs.fetchsvn
pkgs.fetchsvnrevision
pkgs.fetchsvnssh
pkgs.fetchurl
pkgs.fetchurlBoot
pkgs.fetchzip
In order to use the above easily, make use of these convenience shell commands:
nix-prefetch-bzr
nix-prefetch-git
nix-prefetch-svn
nix-prefetch-cvs
nix-prefetch-hg
nix-prefetch-url
For example:
nix-prefetch-git https://github.com/iterative/dvc --rev 0.24.3
You should be able to do this:
# use the resulting hash for fetchTarball
nix-prefetch-url --unpack https://github.com/NixOS/nixpkgs-channels/archive/00e56fbbee06088bf3bf82169032f5f5778588b7.tar.gz
Then in your shell.nix
:
{
pkgs ? import (fetchTarball {
url = https://github.com/NixOS/nixpkgs-channels/archive/00e56fbbee06088bf3bf82169032f5f5778588b7.tar.gz;
sha256 = "15pl5p3f14rw477qg316gjp9mqpvrr6501hqv3f50fzlcxn9d1b4";
}) {}
}:
with pkgs;
stdenv.mkDerivation {
name = "my-pinned-project";
}
And how do you find the right hash to use? Just do this: http 'https://api.github.com/repos/NixOS/nixpkgs-channels/branches?per_page=100'
. It will show you all the latest commit hash from each released channel (including the unstable channel).
This NixOS discourse thread may also be helpful to get the right tarball URL for
fetchTarball
... and thanks a lot for this write-up! Had no clue that there are so manyfetch...
functions...