2025-05-08 12:26:01 -06:00
|
|
|
# nix run
|
|
|
|
|
|
|
|
|
|
> Run an application from a Nix flake.
|
2026-02-18 06:55:01 -07:00
|
|
|
> See also: `nix flake`.
|
|
|
|
|
> More information: <https://nix.dev/manual/nix/stable/command-ref/new-cli/nix3-run.html>.
|
2025-05-08 12:26:01 -06:00
|
|
|
|
|
|
|
|
- Run the default application in the flake in the current directory:
|
|
|
|
|
|
|
|
|
|
`nix run`
|
|
|
|
|
|
|
|
|
|
- Run a command whose name matches the package name from nixpkgs (if you want a different command from that package, see `tldr nix shell`):
|
|
|
|
|
|
|
|
|
|
`nix run nixpkgs#{{pkg}}`
|
|
|
|
|
|
|
|
|
|
- Run a command with provided arguments:
|
|
|
|
|
|
|
|
|
|
`nix run nixpkgs#{{vim}} -- {{path/to/file}}`
|
|
|
|
|
|
|
|
|
|
- Run from a remote repository:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`nix run {{remote_name}}:{{owner}}/{{repository}}`
|
2025-05-08 12:26:01 -06:00
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
- Run from a remote repository using a specific tag, revision, or branch:
|
2025-05-08 12:26:01 -06:00
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`nix run {{remote_name}}:{{owner}}/{{repository}}/{{reference}}`
|
2025-05-08 12:26:01 -06:00
|
|
|
|
|
|
|
|
- Run from a remote repository specifying a subdirectory and a program:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`nix run "{{remote_name}}:{{owner}}/{{repository}}?dir={{dir_name}}#{{app}}"`
|
2025-05-08 12:26:01 -06:00
|
|
|
|
|
|
|
|
- Run the flake of a GitHub pull request:
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`nix run github:{{owner}}/{{repository}}/pull/{{number}}/head`
|