From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: Package request inxi Date: Thu, 12 Apr 2018 01:53:34 -0700 Message-ID: <87muy8dcvl.fsf@gmail.com> References: <87h8p0wb6m.fsf@gmail.com> <87woxwkypg.fsf@gmail.com> <874ll09kn6.fsf@gmail.com> <87po353efj.fsf@gmail.com> <87bmepd5dc.fsf@gmail.com> <87o9ip3b3y.fsf@gmail.com> <87muy93aw5.fsf@gmail.com> <87y3htbofq.fsf@gmail.com> <874lkghp4a.fsf@gmail.com> <873700hoq4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6XzE-00036v-9J for help-guix@gnu.org; Thu, 12 Apr 2018 04:53:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6XzB-00072O-3r for help-guix@gnu.org; Thu, 12 Apr 2018 04:53:44 -0400 Received: from mail-pf0-x22a.google.com ([2607:f8b0:400e:c00::22a]:38039) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f6XzA-000715-UA for help-guix@gnu.org; Thu, 12 Apr 2018 04:53:41 -0400 Received: by mail-pf0-x22a.google.com with SMTP id y69so3108143pfb.5 for ; Thu, 12 Apr 2018 01:53:40 -0700 (PDT) In-Reply-To: <873700hoq4.fsf@gmail.com> (Pierre Neidhardt's message of "Thu, 12 Apr 2018 12:54:03 +0530") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Pierre Neidhardt Cc: help-guix --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Pierre Neidhardt writes: > Basically inxi sets a 'paths' variable with the usual Unix paths and > then forces the environment PATH to the same value. > > My suggestion instead: set 'paths' to /run/current-system/* and > ~/.guix-profile/{sbin,bin}. > > What do you think? Is this generic enough? Is ~/.guix-profile a > guaranteed location for the user profile? No, ~/.guix-profile is not guaranteed. Users can and do create profiles in various places, e.g. with "guix package -p my-profile -i hello". In addition, /run/current-system/* would not work on foreign distros. Is inxi a program, or a library? If it's a program, then a better solution is to bind PATH to the required dependencies at build time. An easy way to accomplish that would be to use the wrap-program procedure from (guix build utils). Read its docstring and grep for wrap-program in the gnu/packages directories to see how it's used. The basic idea is that we can create a wrapper script for inxi which launches inxi in an environment where PATH is set to exactly the things it needs. There are other ways to accomplish the same thing. For example, we could replace references in the source code with references that point to precisely the things required. Generally we would add or modify a build phase to accomplish this; read the docstring for the substitute* procedure (also defined in (guix build utils) and grep for it in the gnu/packages directories to see this technique in action. Inxi has been written, like much software, to be composed with other software at runtime; the composition is normally achieved via environment variables. The techniques above allow us to compose inxi with its dependencies at build time, which is desirable because it means that the built program will behave the same on my machine as it does on yours, regardless of how my environment is configured. This is known as "static composition" of software components (see Section 7.1.1, "Principles", in the Nix thesis [1]). Footnotes:=20 [1] https://nixos.org/~eelco/pubs/phd-thesis.pdf =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAlrPHo4ACgkQ3UCaFdgi Rp372RAAyJ7xW5QSrmS/wfsY6RTAoFvIrcj/18AkJYbGbbnfSy1ClmGPB8JazMM6 Y7eeLGgjMu54Y/6FG9Di9EWLMe4Z+mMwBoJXw/EZa+MWvF+uqe7guyTjEZYWtwhO IVmAeqoiCy4Yb9QQIIbrCIMJhPjSzmuEjaDkYnlHjoWNLb+E+72Qgx81uJb5x4kx RcIOrVsSYP3FUV0a/Yg2ythDPcLxXpZtKwcGesaOcu+7VGGz/hb/DWvpezLJk4q/ ZZd1glxNcgyFBKmg67GWcc5EgJYYnz3UrjgnDyUuSd5HJhrSgDB6jeupYCzG2tZw AFeC14f3KUOsHUtzhCl/sZYz2As2TH1olBNaD7YrxiyFc82Ka7xWqIEOLmLSK40T HtpJR+XKTbG6Q9OE89KRMvd9LIBDYf6CJ/mKnVpi2ZvMm6teOt+mKxYB8kkcRQXE OSw2v442iD3Ro5DPVGLixhcCiO/jATFOnWIvDDJgrPfeJK3vue4+0DIiOofrlrWS GHEnjzOWd1Mr1C6r4EN74CBkaaB3dCh2FOg6HnAqTCsnfu3pU9auvXEYjehhyLOc k1MekmBYCN6q8/LgvMQyfB87Q7ZMazR/YQv3GWec3RfC+0hs9lUZiW2rZbBSH1ng g9bRURaYlBLYcPiCs7ppwCGljTE7XrzJKLPP10e6vN7dggU+iM4= =Md1g -----END PGP SIGNATURE----- --=-=-=--