Nix channels and pinning

Where do the packages come from?

nix repl

nix-repl> :l <nixpkgs>
opencv
echo $NIX_PATH

List channels:

nix-channel --list

nixos https://nixos.org/channels/nixos-23.11
nixos-unstable https://nixos.org/channels/nixos-unstable
sops-nix https://github.com/Mic92/sops-nix/archive/master.tar.gz

Load a specific channel:

nix-repl> :l <nixos-unstable>

Mix channels in your environment:

{ pkgs ? import <nixos> { }
, pkgs-unstable ? import <nixos-unstable> {}
}:

pkgs.mkShell {
  packages = [
    pkgs.vlc
    pkgs-unstable.vlc
  ];
}

Pin your dependencies:

https://nix.dev/tutorials/first-steps/towards-reproducibility-pinning-nixpkgs.html

{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/5f5210aa20e343b7e35f40c033000db0ef80d7b9.tar.gz") {}
}:

pkgs.mkShell {
  packages = [
    pkgs.vlc
  ];
}

Picking the commit can be done via status.nixos.org, which lists all the releases and the latest commit that has passed all tests.