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

2017-05-04 Thread Eelco Dolstra
Hi,

On 05/04/2017 05:00 PM, Jos van den Oever wrote:

> This does not:
> 
> NIX_AUTO_RUN=1 sqlite3

That's because sqlite3 is in multiple packages (sqlite and sqliteInteractive).
NIX_AUTO_RUN only works if there is only one variant. Might be nice if it picked
one according to some heuristic.

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-04 Thread Jos van den Oever
On Monday 01 May 2017 14:23:38 Eelco Dolstra wrote:
> Hi,
> 
> On 05/01/2017 02:11 PM, Jörg Thalheim wrote:
> > Unfortunately the sqlite database feeding command-not-found is almost
> > empty at the moment,
> > 
> > so this command is useless.
> 
> What channel are you on? For the minimal channel, the database contains only
> a handful of packages, but the regular channel has a pretty extensive
> database:
> 
> $ sqlite3 /nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite
> 'select count(*) from Programs'
> 49351

I just tried this while not having sqlite3 installed.

This works:

NIX_AUTO_RUN=1 gphoto2

This does not:

NIX_AUTO_RUN=1 sqlite3

Perhaps this feature only works when the package name is equal to the 
executable name. Or the issue is that there are two packages with the same 
executable name.

sqlite> select * from programs where name = 'sqlite3';
sqlite3|i686-linux|sqlite
sqlite3|i686-linux|sqlite-interactive
sqlite3|x86_64-linux|sqlite
sqlite3|x86_64-linux|sqlite-interactive

sqlite> select * from programs where name = 'gphoto2';
gphoto2|i686-linux|gphoto2
gphoto2|x86_64-linux|gphoto2

Cheers,
Jos


signature.asc
Description: This is a digitally signed message part.
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-02 Thread Marc Weber
> > $ export NIX_AUTO_RUN=1
Well, maybe refactoring would make sense and call it

ON_MISSING_BUT_KNOWN_EXECUTABLE=run/install/ask/ask_run/ask_install/ask_once_run/ask_once_install
where 
  run => runs
  ask => asks whether to run or run and install
  ask_install => asks to install
  ask_run => asks to run

or similar. For instance I'd prefer "ask once per app" eventually
because I could have made a typo.

Marc Weber
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-02 Thread Frank
It would be nice if the database had the description of the package: It
would be easy to build a QT-package-manager based on the info (or some
other frontend).

Greetings,
Frank

Op Mon, 1 May 2017 12:37:07 +0200
"regiv...@gmail.com"  schreef:

> I think it's really a very interesting feature! A user no longer
> needs to install their programs: nix installs them in his place when
> he needs them. This option could be highlighted in the NixOS
> presentation. ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/nix-dev

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread Benno Fünfstück
I believe https://github.com/NixOS/nixos-channel-scripts/issues/13 breaks
the sqlite database, since only a few NARs have listings in the old format.

Eelco Dolstra  schrieb am Mo., 1. Mai 2017 um
14:23 Uhr:

> Hi,
>
> On 05/01/2017 02:11 PM, Jörg Thalheim wrote:
>
> > Unfortunately the sqlite database feeding command-not-found is almost
> empty at the moment,
> >
> > so this command is useless.
>
> What channel are you on? For the minimal channel, the database contains
> only a
> handful of packages, but the regular channel has a pretty extensive
> database:
>
> $ sqlite3
> /nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite
> 'select count(*) from Programs'
> 49351
>
> --
> Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
> ___
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> https://mailman.science.uu.nl/mailman/listinfo/nix-dev
>
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread Eelco Dolstra
Hi,

On 05/01/2017 02:11 PM, Jörg Thalheim wrote:

> Unfortunately the sqlite database feeding command-not-found is almost empty 
> at the moment,
> 
> so this command is useless.

What channel are you on? For the minimal channel, the database contains only a
handful of packages, but the regular channel has a pretty extensive database:

$ sqlite3 /nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite
'select count(*) from Programs'
49351

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread Jörg Thalheim
Unfortunately the sqlite database feeding command-not-found is almost empty at 
the moment,

so this command is useless.


On 2017-05-01 12:05, Eelco Dolstra wrote:
> Hi,
>
> On 05/01/2017 11:55 AM, regiv...@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.
>

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread regiv...@gmail.com

For cautious users, there might be the message:

"dc is not installed. Do you want to install it? Yes / no "

But in practice, typos are rarely problematic.

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread regiv...@gmail.com
I think it's really a very interesting feature! A user no longer needs 
to install their programs: nix installs them in his place when he needs 
them. This option could be highlighted in the NixOS presentation.

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread Sergiu Ivanov

Hello,

Thus quoth  regiv...@gmail.com  at 09:55 on Mon, May 01 2017:
>
> 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.
>
> The speed of installation and execution is optimal because the script
> already knows what to download and install.

What about executables provided by multiple packages?

What about typos?  I sometimes type dc (calculator) instead of cd, but I
don't have nor want to have dc on my machine.

What about a script myScript I wrote which happens to have the same name
as an executable provided by a package, and which I erroneously tried to
run using myScript directly, instead of typing ./myScript?

Note that typing commands in a local command line is a use case quite
different from typing URLs in a browser: the commands are way shorter
and the risk of confusion is much higher.

--
Sergiu


signature.asc
Description: PGP signature
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread Bjørn Forsman
On 1 May 2017 at 12:05, Eelco Dolstra  wrote:
> Hi,
>
> On 05/01/2017 11:55 AM, regiv...@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

Follow up:

NIX_AUTO_RUN=1 means the program will be run via nix-shell. (The
grabage collector may remove it on the next GC run.)

NIX_AUTO_INSTALL=1 means the program will be installed with nix-env
and then run from your normal shell. (It won't be automatically
garbage collected.)

Best regards,
Bjørn Forsman
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread Eelco Dolstra
Hi,

On 05/01/2017 11:55 AM, regiv...@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/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev


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

2017-05-01 Thread regiv...@gmail.com

Hello!

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.

The speed of installation and execution is optimal because the script 
already knows what to download and install.


This comes close to how web applications are downloaded and executed. To 
run a web application, you enter its URL in the address bar and the 
browser automatically takes care of downloading it, installing it in the 
cache and running it. This system should also exist for local programs.

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
https://mailman.science.uu.nl/mailman/listinfo/nix-dev