-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
cliThe old and/or new command line interfaceThe old and/or new command line interfacefeatureFeature request or proposalFeature request or proposalnew-cliRelating to the "nix" commandRelating to the "nix" command
Description
Is your feature request related to a problem?
it would be nice to have a convenient way to run programs from fetch-tree-accessible (potentially remote) repositories.
Proposed solution
a v2-cli-like command nix-run, functioning perhaps not unlike bash aliases like:
- drop-in
nix-runfor use likenix-run github:nixos/nixpkgs?ref=nixos-25.11#hello(i.e. arguments likenix run's):alias nix-run='run() { $(nix-instantiate --raw --impure --eval --expr "(import <nixpkgs> {}).lib.getExe (import (builtins.fetchTree \"$(cut -d "#" -f 1 <<< "$1")\").outPath { }).$(cut -d "#" -f 2 <<< "$1")"); }; run' - version for use like
nix-run github:nixos/nixpkgs?ref=nixos-25.11 hello(so args spaced):alias nix-run='run() { $(nix-instantiate --raw --impure --eval --expr "(import <nixpkgs> {}).lib.getExe (import (builtins.fetchTree \"$1\").outPath { }).$2"); }; run'
Alternative solutions
flakes
Additional context
- in my testing this could also work with
nix registry - while commands like
nix-shellwith saynix-shell -p hellomight similarly use nixpkgs, in that case to build packages from, it's maybe another question whether it makes sense to depend on nixpkgs'lib.getExewithin nix core. i'm not sure how that works fornix-shell- maybe a similar relation to the one taken there could work here as well. maybe.nix runseems prior art ongetExe-like considerations.
Checklist
- checked latest Nix manual (source)
- checked open feature issues and pull requests for possible duplicates
Add 👍 to issues you find important.
Metadata
Metadata
Assignees
Labels
cliThe old and/or new command line interfaceThe old and/or new command line interfacefeatureFeature request or proposalFeature request or proposalnew-cliRelating to the "nix" commandRelating to the "nix" command