How to run arbitrary packages from nixpkgs from my flake

Is there a pattern where I can test what a particular program from the nixpkgs of my flake is ?

I’d like to somehow just expose the whole nixpkgs for my flake so I can pick arbitrary packages similar to nix run nixpkgs#X

A little more context might help here. What kind of flake are we talking about here? Something packaging a program? A nixos configuration? What, exactly, about “the nixpkgs for your flake” do you need replicated? The commit of nixpkgs? The configuration like unfree settings and overlays? Both?

Do you mean something like this?

{

  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

  outputs = inputs: {
    nixpkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
    packages = inputs.nixpkgs.legacyPackages;
  };

}
nix run .#hello -- --version
nix run .#.nixpkgs.hello -- --version # assuming we are on linux

Definitely better to just:

nix run --inputs-from . nixpkgs#hello
3 Likes

Okay yes I missed “inputs-from”. I scanned the doc but didn’t see it :sob:

Thank you