From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aETmJkT8A2RgJQAAbAwnHQ (envelope-from ) for ; Sun, 05 Mar 2023 03:19:48 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id IN7+JUT8A2RDMgEAG6o9tA (envelope-from ) for ; Sun, 05 Mar 2023 03:19:48 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1443A7F2A for ; Sun, 5 Mar 2023 03:19:48 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pYdy8-0002dI-0I; Sat, 04 Mar 2023 21:19:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pYdy6-0002d6-Lf for guix-devel@gnu.org; Sat, 04 Mar 2023 21:19:22 -0500 Received: from libre.brussels ([144.76.234.112]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pYdy4-0007hp-QJ for guix-devel@gnu.org; Sat, 04 Mar 2023 21:19:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libre.brussels; s=mail; t=1677982754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MBTIvxMW5vk4Hzzrp6fj/5Pcaw1hq+u5pR70OHtql/A=; b=REQXbMM2I8zDJtWI6QDbVlQy3Ux8TmXtyBNGJxiO89yKijuUp8W98w0vJQSPOZPgF/8S/y HIZvZsyuFc5xyIgJeoL50C5GBVU3pgoi1z6FXA8r9mtVOODKzFCn/y3KrKYu/Pkqcxn9Zm HKAtOpMHAfR5d/tf6ULB+spCcH39SdM= MIME-Version: 1.0 Date: Sun, 05 Mar 2023 03:19:14 +0100 From: indieterminacy To: Sarthak Shah Cc: guix-devel@gnu.org Subject: Re: Implementing Nix's command-not-found in Guix In-Reply-To: References: Message-ID: X-Sender: indieterminacy@libre.brussels Organization: Icebreaker Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=144.76.234.112; envelope-from=indieterminacy@libre.brussels; helo=libre.brussels X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677982788; a=rsa-sha256; cv=none; b=T0XHtWGr2cpkZkqiIEvDiu6dDq3RdIlF+7PjIKDvXJGfSGXcOF5L3DVb4WAWGumS9XXDub bTi520k+Y5X1w1zLbUDmJR4nCan0RMMJ9ZI8/EkjhktzMyX/CL+JhJg/EhpkDrNuLqNqUd GK09LqzLxCjyg5KqZowXR9XjbIcPVKSRufnGIo86LsCH10AKl5a/O4abXKMcxQd7LkCKJz rql+k6NO44OsALY0gnM86QyiBtdhgdurcVmBbM1IDJt/xBVF4R0txe3OEAsryvNIlTxuKv ZoHo3F0O86yc8K1uLBkjLu7jHwC23GC19kYgFlJyYfS4V9ZyR1dAUo1okaY7xA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=libre.brussels header.s=mail header.b=REQXbMM2; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=libre.brussels ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1677982788; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=MBTIvxMW5vk4Hzzrp6fj/5Pcaw1hq+u5pR70OHtql/A=; b=lLnTn3f6ogTcsIIPBe4pzCXsb0ANE1nB5Uwv5gfNpxFd8arxGllJBttjtuy49C8ULR6rCN uik6/vKTQzC6mLnH6LIQI/84mm/MVbtIL1qmJ/XzDl9Jpk/ZcjHzecXkpyDm51JY9MFAyl hFKHZEipec3Oi++nRWMgD3zumZrcg2v3JDp5NjucXh55r/sWH5K4T61GHDhYi8bG81099X /pG9s3Z6kcpoq1MKjw/QaKT/vOaiBbR6FCtFIvaDflRXKDutZ+Q056Ifs0lY9UYhEtHEEK 5wE8QdIuEOfSTP8wg/g8UO0yUgGLd+bZ4Nb5wmVmKZZeP+xL4BeVUkklQ3lXDQ== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.21 X-Spam-Score: -4.21 X-Migadu-Queue-Id: 1443A7F2A Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=libre.brussels header.s=mail header.b=REQXbMM2; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=libre.brussels X-TUID: IpVHMAY6mDwy 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