[Nix-dev] Suggestion: programs are *always* in the path

Eelco Dolstra eelco.dolstra at logicblox.com
Mon May 1 12:05:36 CEST 2017


Hi,

On 05/01/2017 11:55 AM, regivanx at gmail.com wrote:

> If you enter a command, you want to run it.
> 
> If the corresponding program is not installed, the command is a symbolic link to
> a script that says:
> 
> _ download the program and its dependencies,
> _ install it,
> _ run it.

On NixOS, you can already do something like that by setting $NIX_AUTO_RUN to 1.

E.g.

$ export NIX_AUTO_RUN=1

$ gphoto2 --version
these paths will be fetched (1.44 MiB download, 8.20 MiB unpacked):
  /nix/store/3a7xm6l9ysvf6igk9g9nsc0w9kxpscb0-libgphoto2-2.5.12
  /nix/store/7fhspkpiylqi4lifqn6k2lvjhkw1llsv-gphoto2-2.5.8
...
gphoto2 2.5.8

This only works if the programs database
/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite exists. Also
it doesn't work if a command has multiple alternatives.

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/


More information about the nix-dev mailing list