NixOS / nix.dev

Official documentation for getting things done with Nix.
https://nix.dev
Creative Commons Attribution Share Alike 4.0 International
2.44k stars 243 forks source link

How to run an executable produced by a derivation #198

Open nikitavoloboev opened 2 years ago

nikitavoloboev commented 2 years ago

I searched on internet and in nix.dev and still am confused how to do it.

willbush commented 2 months ago

related: https://github.com/NixOS/nix.dev/issues/135

Some links on the topic I found:

I do think this should be documented better.

fricklerhandwerk commented 2 months ago

The original issue title seems to have mixed up two aspects:

  1. The special role of default.nix for the Nix language evaluator and CLI commands

    That may be better addressed in a single place in the Nix reference manual: https://github.com/NixOS/nix/issues/11132

  2. Running an executable produced by a derivation.

    For sure this is a killer feature, and needs to be made prominent in a little FAQ answer. The answer for stable Nix is

    $(nix-build someFile.nix -A someAttr --no-out-link)/bin/someExecutable

    A PR addressing that should add (links to) everything needed to fully understand that line, including a self-contained example that can be tested.

Changed the title and added labels.