Installing a single stable package when on unstable?

I’m on unstable for newer package versions. In my flake I have nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";. A PR to fix rust-analyzer got merged but its not up yet so it fails to build for me right now.

I looked up how to install a single stable package and found this solution for a single unstable package which I copied below. If I were to use this then how would I get the tarball URL for a specific nixpkgs version, like 25.05 for example? or is there another (possible better) way to do this?

# configuration.nix
{ config, pkgs, ... }:
let
  unstable = import
    (builtins.fetchTarball https://github.com/nixos/nixpkgs/tarball/<branch or commit>)
    # reuse the current configuration
    { config = config.nixpkgs.config; };
in
{
  environment.systemPackages = with pkgs; [
    nginx
    unstable.certbot
  ];
}

The PR did not reach the nixos-unstable channel yet. You can track the progress using nixpk.gs: Nixpkgs PR #433196 ("rust-analyzer-unwrapped: fix source hash") progress

Edit: to be more specific, here, for this particular one, you can use the nixos-unstable-small branch to get the fix.

No, it’s reached, that tracker is just behind. I prefer to use @ocfox’s as it uses github apis directly: https://nixpkgs-tracker.ocfox.me/?pr=433196

2 Likes