Subject: [PATCH] Support canonical guix environment -l guix.scm.

From: Jan Nieuwenhuizen <[email-masked]>
Date: Sun, 22 Sep 2019 13:09:03 +0200

Hi Guix,

I often find myself typing `guix environment -l guix.scm' in the Guix
source root and thought IWBN no make that "just work".  WYDT?

Greetings,
janneke

>From 18f1ef75d38c8a40d2e1f8d56a041cd64bc5c64f Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <[email-masked]>
Date: Sun, 22 Sep 2019 13:01:38 +0200
Subject: [PATCH] Support canonical guix environment -l guix.scm.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Developers are encouraged to include a `guix.scm' in the root of their project
source to set-up a development environment (See 4.2 Invoking ‘guix package’),
so that

    guix environment -l guix.scm

provides a development environment.

* guix.scm: Return guix "git" package.
---
 guix.scm | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/guix.scm b/guix.scm
index 8753c21e42..919179e5cf 100644
--- a/guix.scm
+++ b/guix.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2014 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -16,7 +17,11 @@
 ;;; You should have received a copy of the GNU General Public License
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
-(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 composite module that re-exports everything from the public modules.
 
@@ -39,3 +44,25 @@
                 (lambda (m)
                   (module-use! i (resolve-interface `(guix ,m)))))
               %public-modules)))
+
+;; To setup the development environment, run the following:
+;;
+;;    guix environment -l guix.scm
+;;    ./bootstrap && ./configure;
+;;
+;; To build the development snapshot, run:
+;;
+;;    guix build -f guix.scm
+;;
+;; To install the development snapshot, run:
+;;
+;;    guix package -f guix.scm
+;;
+(define %source-dir (dirname (current-filename)))
+
+(package
+  (inherit guix)
+  (version "git")
+  (source (local-file %source-dir
+                      #:recursive? #t
+                      #:select? (git-predicate %source-dir))))
-- 
2.23.0

-- 
Jan Nieuwenhuizen <[email-masked]> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com