GNU bug report logs - #37478
[PATCH] Support canonical guix environment -l guix.scm.

Previous Next

Package: guix-patches;

Reported by: Jan Nieuwenhuizen <janneke <at> gnu.org>

Date: Sun, 22 Sep 2019 11:10:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Jan Nieuwenhuizen <janneke <at> gnu.org>
To: "Thompson\, David" <dthompson2 <at> worcester.edu>
Cc: 37478 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>, Brett Gilio <brettg <at> posteo.net>
Subject: [bug#37478] [PATCH] Support canonical guix environment -l guix.scm.
Date: Tue, 10 Dec 2019 21:59:22 +0100
Thompson, David writes:

>     (package
>       (name "chickadee")
>       (version "0.1")
>       (source #f)
[..]

> Initially I thought a package made sense because, in addition to being
> used as the basis of a dev environment, I could build the same file as
> part of a CI system or pre-release make target, but in practice I
> can't really do that, thus the '(source #f)' bit and all the other
> boilerplate like version, synopsis, description, and license fields to
> satisfy the syntax rules.  It's also not a suitable package for
> upstreaming to Guix later because building from git requires
> additional dependencies that aren't needed when building from a
> release tarball.  So, if I were to rewrite this file today, I think I
> would just make a manifest instead.
>
> Of course, Guix could also just eval the file, use package? and
> manifest? predicates to see what it got, and act accordingly.  That
> might be the best choice from a usability standpoint.

Interesting!  I've been flipping here too.  Currently, I am using a
split setup.  The upstream(able) package lives in a subdirectory

--8<---------------cut here---------------start------------->8---
;;; guix/git/mes.scm:
(define-module (git mes)

(define-public mes
  (let ((triplet "i686-unknown-linux-gnu")
        (version "0.21"))
    (package
      (name "mes")
      (version version)
      (source (origin
                (method url-fetch)
                (uri (string-append
                      "https://ftp.gnu.org/pub/gnu/mes/mes-" version ".tar.gz"))
                (sha256
                 (base32 "04pajp8v31na34ls4730ig5f6miiplhdvkmsb9ls1b8bbmw2vb4n"))))
      (build-system gnu-build-system)
      ...
      (home-page "https://www.gnu.org/software/mes")
      (license gpl3+))))
--8<---------------cut here---------------end--------------->8---

and my guix.scm then uses that

--8<---------------cut here---------------start------------->8---
;;; guix.scm
(use-modules (guix gexp)
             (guix git-download)
             (guix packages)
             (gnu packages))

(define %source-dir (dirname (current-filename)))
(add-to-load-path (string-append %source-dir "/guix"))
(use-modules (git mes))

(define-public mes.git
  (package
    (inherit mes)
    (source (local-file %source-dir
                        #:recursive? #t
                        #:select? (git-predicate %source-dir)))))

mes.git
--8<---------------cut here---------------end--------------->8---

This way, I can maintain an upstream(able) package literally, build
from git and have my environment set up.

As a bonus, you can then use a .guix-channel file
--8<---------------cut here---------------start------------->8---
(channel
 (version 0)
 (directory "guix"))
--8<---------------cut here---------------end--------------->8---

so that you can guix pull straight from your repo.

Greetings,
janneke

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




This bug report was last modified 5 years and 186 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.