unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Implementing Nix's command-not-found in Guix
@ 2023-03-04 21:42 Sarthak Shah
  2023-03-05  2:19 ` indieterminacy
  2023-03-06 20:19 ` Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Sarthak Shah @ 2023-03-04 21:42 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1015 bytes --]

Hello Guix!

I'd like to implement something similar to NixOS's command-not-found in
Guix.
As you can see in the repository below, it contains a nix file which is
essentially a shell script which runs the second file, a perl script, if
the user enters a command which is not found on this system. The perl
script suggests names of packages containing said command which it pulls
from an SQL database.
https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found
This would make Guix much more user-friendly; for example, new Guix System
users often struggle to figure out how to add the "clear" command to their
shell. command-not-found would immediately inform them that it can be found
in the ncurses package.

How would you recommend I go about implementing something similar for Guix?
I have unfortunately been unable to find a database or anything similar
listing files outputted to /bin by each package, which would in my opinion
be the starting step.

Happy Hacking!
Sarthak (cel7t)

[-- Attachment #2: Type: text/html, Size: 1190 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Implementing Nix's command-not-found in Guix
  2023-03-04 21:42 Implementing Nix's command-not-found in Guix Sarthak Shah
@ 2023-03-05  2:19 ` indieterminacy
  2023-03-06 20:19 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: indieterminacy @ 2023-03-05  2:19 UTC (permalink / raw)
  To: Sarthak Shah; +Cc: guix-devel

On 04-03-2023 22:42, Sarthak Shah wrote:
> Hello Guix!
> 
> I'd like to implement something similar to NixOS's command-not-found
> in Guix.
> As you can see in the repository below, it contains a nix file which
> is essentially a shell script which runs the second file, a perl
> script, if the user enters a command which is not found on this
> system. The perl script suggests names of packages containing said
> command which it pulls from an SQL database.
> https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found
> This would make Guix much more user-friendly; for example, new Guix
> System users often struggle to figure out how to add the "clear"
> command to their shell. command-not-found would immediately inform
> them that it can be found in the ncurses package.
> 
> How would you recommend I go about implementing something similar for
> Guix?
> I have unfortunately been unable to find a database or anything
> similar listing files outputted to /bin by each package, which would
> in my opinion be the starting step.
> 

While you wait for a better answer it may be worth trying out IDUtils 
(which if I recall Ludo recommended during a Guix blogpost).
```
  An ID database is a binary file containing a list of file names, a list 
of tokens, and a sparse matrix indicating which tokens appear in which 
files.

With this database and some tools to query it (described in this 
manual), many text-searching tasks become simpler and faster. For 
example, you can list all files that reference a particular #include 
file throughout a huge source hierarchy, search for all the memos 
containing references to a project, or automatically invoke an editor on 
all files containing references to some function or variable. Anyone 
with a large software project to maintain, or a large set of text files 
to organize, can benefit from the ID utilities.
```
https://www.gnu.org/software/idutils/manual/idutils.html

As such, even if it is not a complete solution it could allow you to 
identify or exclude things in advance of a more complete or bespoke 
solutions.

Happy hacking!

-- 
Jonathan McHugh
indieterminacy@libre.brussels


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Implementing Nix's command-not-found in Guix
  2023-03-04 21:42 Implementing Nix's command-not-found in Guix Sarthak Shah
  2023-03-05  2:19 ` indieterminacy
@ 2023-03-06 20:19 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2023-03-06 20:19 UTC (permalink / raw)
  To: Sarthak Shah; +Cc: guix-devel

Hi,

Sarthak Shah <shahsarthakw@gmail.com> skribis:

> I'd like to implement something similar to NixOS's command-not-found in
> Guix.

There’s been work on a ‘guix index’ command recently, that I hope will
soon be proposed for merge:

  https://lists.gnu.org/archive/html/guix-devel/2022-12/msg00198.html

Once this command is in, it will be possible to implement something like
‘command-not-found’ that would search the ‘guix index’ database.

Ludo’.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-06 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-04 21:42 Implementing Nix's command-not-found in Guix Sarthak Shah
2023-03-05  2:19 ` indieterminacy
2023-03-06 20:19 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).