2023-04-26 09:45:00 +01:00
|
|
|
# nix run
|
|
|
|
|
|
|
|
> Run an application from a Nix flake.
|
2024-06-03 21:21:58 +01:00
|
|
|
> See also: `nix3 flake` for information about flakes.
|
2023-04-26 09:45:00 +01:00
|
|
|
> More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-run.html>.
|
|
|
|
|
2023-08-22 15:56:24 +01:00
|
|
|
- Run the default application in the flake in the current directory:
|
|
|
|
|
|
|
|
`nix run`
|
|
|
|
|
2023-04-26 09:45:00 +01:00
|
|
|
- Run a command whose name matches the package name from nixpkgs (if you want a different command from that package, see `tldr nix3 shell`):
|
|
|
|
|
|
|
|
`nix run nixpkgs#{{pkg}}`
|
|
|
|
|
2023-08-22 15:56:24 +01:00
|
|
|
- Run a command with provided arguments:
|
2023-04-26 09:45:00 +01:00
|
|
|
|
2023-08-22 15:56:24 +01:00
|
|
|
`nix run nixpkgs#{{vim}} -- {{path/to/file}}`
|
|
|
|
|
|
|
|
- Run from a remote repository:
|
|
|
|
|
|
|
|
`nix run {{remote_name}}:{{owner}}/{{repo}}`
|
|
|
|
|
|
|
|
- Run from a remote repository using a specific tag, revision or branch:
|
|
|
|
|
|
|
|
`nix run {{remote_name}}:{{owner}}/{{repo}}/{{reference}}`
|
|
|
|
|
|
|
|
- Run from a remote repository specifying a subdirectory and a program:
|
|
|
|
|
|
|
|
`nix run "{{remote_name}}:{{owner}}/{{repo}}?dir={{dir_name}}#{{app}}"`
|
|
|
|
|
|
|
|
- Run the flake of a GitHub pull request:
|
|
|
|
|
|
|
|
`nix run github:{{owner}}/{{repo}}/pull/{{number}}/head`
|