From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bengt Richter Subject: Re: Profiles/manifests-related command line interface enhancements Date: Wed, 6 Nov 2019 14:21:35 -0800 Message-ID: <20191106222135.GB55508@PhantoNv4ArchGx.localdomain> References: <87mudrxvs8.fsf@ambrevar.xyz> <87mudd59ho.fsf@gnu.org> <877e4glyc3.fsf@ambrevar.xyz> <87k18dvsqq.fsf@gnu.org> Reply-To: Bengt Richter Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:33264) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iSTgY-0001CT-5b for guix-devel@gnu.org; Wed, 06 Nov 2019 17:21:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iSTgW-00089d-FP for guix-devel@gnu.org; Wed, 06 Nov 2019 17:21:53 -0500 Content-Disposition: inline In-Reply-To: <87k18dvsqq.fsf@gnu.org> 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+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: Guix Devel Hi all, On +2019-11-06 18:07:09 +0100, Ludovic Court=C3=A8s wrote: > Hi Konrad, >=20 > Konrad Hinsen skribis: >=20 > > Take the typical example from Docker tutorials: bundling a Web server > > with some Web application and a database. It's easy to make a manifes= t > > file for collecting the required packages. But it would make more sen= se > > to me to have a module in a Guix channel that defines a parametrizabl= e > > super-package for the Web application that has no source code of its = own > > but various inputs and perhaps configuration files. Users can then > > install several Web apps bundled in this fashion, sharing the Web > > server. This kind of composition is not possible (currently) with > > manifest files. >=20 > I agree this is an important use case. It seems to me that the problem > here is being able to aggregate more than just packages. >=20 > A manifest can contain any lowerable object, not just packages, but > then, does it make much sense to use a manifest (and a profile) in this > case? >=20 > The Web application example above seems to be somewhere between a mere > and an full-blown . Perhaps we need an > intermediate abstraction that bundles together a profile along with som= e > lightweight services? >=20 > Or, to put it differently, how do we define =E2=80=9Csuper-package=E2=80= =9D? >=20 > >> Profiles are managed by Guix, isn't it? > > > > Sure, but how exactly? Right now, a profile is a directory anywhere i= n > > the file system that Guix knows about. Recent discussions have propos= ed > > alternatives, such as keeping all of a user's profile in some directo= ry > > defined by convention and referring to them by name. What's the bette= r > > way to use as a default? I don't know, but I think we should discuss = it > > rather than adding new sub-commands with different behavior and thus > > adding to the mess. >=20 > =E2=80=98guix package --list-profiles=E2=80=99 was added to improve thi= s situation where > there=E2=80=99s no enforced convention. >=20 > The question seems to be whether we should add more convention and less > configuration. >=20 > I=E2=80=99m often reluctant to that, preferring self-contained commands= where > all the files involved appear on the command line. However, I agree > that it=E2=80=99s a tradeoff and there=E2=80=99s a balance to be found = to make the CLI > practical and convenient without making it obscure. To that end, we > should probably usefully move from =E2=80=9Czero conventions=E2=80=9D t= o =E2=80=9Csome > conventions enforced=E2=80=9D to improve over the current situation. >=20 > Examples of conventions discussed before: >=20 > =E2=80=A2 Referring to profiles by name, meaning that users would no = longer > explicitly manipulate symlinks that live anywhere on the file > system. >=20 > =E2=80=A2 Having =E2=80=9Cguix environment=E2=80=9D without arguments= load an > =E2=80=98environment.scm=E2=80=99 file (or similar) from the curren= t directory. >=20 > Are these things you have in mind? Anything else? >=20 > We should boil that discussion down to a list of things to implement. > :-) >=20 > Thanks! >=20 > Ludo=E2=80=99. >=20 1. guix explain EXAMPLE as a quick way to get a definition of EXAMPLE from a guix glossary of ter= ms and acronyms, as well as references to example snippets etc. Also add easy ways to laun= ch relevant links to info or list archives or a wiki of troubleshooting experience, etc. in= arbitrary URLs. 2. When implementing something, consider whether it could be useful as a = separate script that can be invoked from bash or on a region in emacs, vs being inaccessi= bly embedded, and if useful, expose it in the current profile (or as directed). As an example, putting snip-delimiters around some text could be done in = elisp, but it's more accessible and customizable as a script, e.g., --8<----(original did not do this)-----------cut here---------------start= ------------->8--- #!/usr/bin/env -S guile -e gxsnip -s !# (use-modules (ice-9 format)) (use-modules (ice-9 textual-ports)) (define (gxsnip args) (begin (let*((opt (cdr args)) (tag (if (pair? opt) (string-append "(" (string-join opt " ") ")") ""))) (format #t=20 "--8<----~a~a\n~a\n--8<----~a~a\n" tag "-----------cut here---------------start------------->8---" (get-string-all (current-input-port)) tag "-----------cut here---------------end--------------->8---" )))) --8<----(original did not do this)-----------cut here---------------end--= ------------->8--- Oops. still using /usr/bin/... there ;-) And I see easy improvements, but my point is it would have been less shar= eable as an emacs-only macro. Where guix is factorable into separately useful components, I think the s= ame idea applies. The unix way of small things :) HTH -- Regards, Bengt Richter