unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 37478@debbugs.gnu.org
Subject: [bug#37478] [PATCH] Support canonical guix environment -l guix.scm.
Date: Sat, 05 Oct 2019 11:25:06 +0200	[thread overview]
Message-ID: <87k19jy26l.fsf@gnu.org> (raw)
In-Reply-To: <871rw4mro9.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 25 Sep 2019 15:28:06 +0200")

Ludovic Courtès writes:

>> I often find myself typing `guix environment -l guix.scm' in the Guix
>> source root and thought IWBN no make that "just work".  WYDT?
>
> IWBN, but…
>
>> -(define-module (guix))
>> +(define-module (guix)
>> +  #:use-module (guix git-download)
>> +  #:use-module (guix gexp)
>> +  #:use-module (guix packages)
>> +  #:use-module (gnu packages package-management))
>
> … the (guix) module is a public module, and it must not depend on
> anything but the (guix …) modules it imports.
>
> So unfortunately we can’t just do that.

Hmm, and is there a difference between compile-time and run-time?  I do
not understand the rules well enough here...

So I guess that something vaguely this (I really don't like the
command-line "parsing" bit, just a thought experiment)

--8<---------------cut here---------------start------------->8---
;; Naive command-line parser: are we running from Guix source tree
;;    guix build -f guix.scm
;;    guix environment -l guix.scm
;; then return guix@git package
(when (and (file-exists? "guix/gexp.scm")
           (let ((len (length (command-line))))
             (and (> len 3)
                  (let ((tail (list-tail (command-line) (- len 3))))
                    (or (equal? tail '("build" "-f" "guix.scm"))
                        (equal? tail '("environment" "-l" "guix.scm")))))))
  (let ((source-dir (dirname (current-filename))))
    ((@ (guix packages) package)
     (inherit (@ (gnu packages package-management) guix))
     (version "git")
     (source ((@ (guix gexp) local-file) source-dir
              #:recursive? #t
              #:select? ((@ (guix git-download) git-predicate) source-dir))))))
--8<---------------cut here---------------end--------------->8---

is also not possible?  It is also starts to look like a kludge and hard
to get right...bah :)

> Perhaps we could have a ‘.guix.scm’ file though, or
> ‘build-aux/guix.scm’, something like that?

Yes...I was hoping that we could offer/advise something standardized
that all guix'ified upstreams could/would use.  I think that I've seen
`.guix.scm', but also a `guix.scm' that returns a manifest, so usage
would be `guix environment -m guix.scm', and no way to build the package
itself from git.

Once Guix is blessed `the GNU System' (any day now ;-) we need to have a
a thought-through proposal to amend standards.texi anyway.

Greetings,
janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com

  reply	other threads:[~2019-10-05  9:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-22 11:09 [bug#37478] [PATCH] Support canonical guix environment -l guix.scm Jan Nieuwenhuizen
2019-09-25 13:28 ` Ludovic Courtès
2019-10-05  9:25   ` Jan Nieuwenhuizen [this message]
2019-12-10  4:52     ` Brett Gilio
2019-12-10 18:45       ` Thompson, David
2019-12-10 20:59         ` Jan Nieuwenhuizen

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87k19jy26l.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=37478@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /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 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).