all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: indieterminacy <indieterminacy@libre.brussels>
To: Sarthak Shah <shahsarthakw@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: Implementing Nix's command-not-found in Guix
Date: Sun, 05 Mar 2023 03:19:14 +0100	[thread overview]
Message-ID: <fd10e60d4ee7ca5c96aa46319554bf6b@libre.brussels> (raw)
In-Reply-To: <CADBZEVkEu9Rv8PaC=a+XLUGKEU1uRhf9V4pv-a9RToWEF9gBFw@mail.gmail.com>

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


  reply	other threads:[~2023-03-05  2:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-04 21:42 Implementing Nix's command-not-found in Guix Sarthak Shah
2023-03-05  2:19 ` indieterminacy [this message]
2023-03-06 20:19 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd10e60d4ee7ca5c96aa46319554bf6b@libre.brussels \
    --to=indieterminacy@libre.brussels \
    --cc=guix-devel@gnu.org \
    --cc=shahsarthakw@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.