unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: George Clemmer <myglc2@gmail.com>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: help-guix@gnu.org
Subject: Re: Some general guix questions
Date: Wed, 09 Jan 2019 13:09:34 -0500	[thread overview]
Message-ID: <cuca7k9snxd.fsf@gmail.com> (raw)
In-Reply-To: <87zhsa7up1.fsf@elephly.net>


Ricardo Wurmus <rekado@elephly.net> writes:

> Not sure if better (because it has the same effect), but here’s a
> different way to get a “manifest” from the list of installed packages.
>
> --8<---------------cut here---------------start------------->8---
> (use-modules (guix profiles)
>              (ice-9 match)
>              (ice-9 pretty-print))
>
> (match (command-line)
>   ((_ where)
>    (pretty-print
>     `(specifications->manifest
>       ',(map manifest-entry-name (manifest-entries (profile-manifest where))))))
>   (_ (error "Please provide the path to a Guix profile.")))
> --8<---------------cut here---------------end--------------->8---
>
> You can put this in a file “manifest-to-manifest.scm” and run it like
> this from a Guix source checkout:
>
>     ./pre-inst-env guile -s manifest-to-manifest.scm /path/to/.guix-profile > my-manifest.scm

Hi Ricardo,

Since the ".guix-profile/manifest" file is undocumented and confusingly
shares a name with package/environment "manifest" files, ISTM it's
clearer to call this "profile-to-manifest.scm". Also, I added sort for a
bit more canonical result ...

--8<---------------cut here---------------start------------->8---
(use-modules (guix profiles)
             (ice-9 match)
             (ice-9 pretty-print)
	     )

(match (command-line)
  ((_ where)
   (pretty-print
    `(specifications->manifest
      ',(sort(map manifest-entry-name (manifest-entries (profile-manifest where)))string<?))))
  (_ (error "Please provide the path to a Guix profile.")))
--8<---------------cut here---------------end--------------->8---

I run it this way to get a manifest from a user profile:

./pre-inst-env guile -s profile-to-manifest.scm /path/to/.guix-profile > manifest-from-user-profile.scm

... and this way to get a "manifest" of the system profile:

./pre-inst-env guile -s profile-to-manifest.scm /var/guix/profiles/system/profile > manifest-from-system-profile.scm

... and this way to get a "manifest" from an environment profile:

./pre-inst-env guile -s profile-to-manifest.scm /path/to/environment-profile > manifest-from-environment-profile.scm

All of which can be handy. ISTM it would be useful have this function in
Guix. But it's not obvious where to put it, since it can operate on
outputs of 'guix package', 'guix system reconfigure', and 'guix
environment' commands.

And, as you noted in a subsequent post, there is the issue of whether it
uses Guix from Git as above, the system guix, or a "pulled" guix
version.

- George

  parent reply	other threads:[~2019-01-09 18:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-08 16:43 Some general guix questions Divan Santana
2019-01-08 17:13 ` Pierre Neidhardt
2019-01-08 20:36   ` Ricardo Wurmus
2019-01-08 21:24     ` Pierre Neidhardt
2019-01-08 21:40       ` Ricardo Wurmus
2019-01-09 18:09     ` George Clemmer [this message]
2019-01-22 10:28       ` Pierre Neidhardt
2019-01-09  7:51   ` Divan Santana
2019-01-08 19:26 ` George Clemmer
2019-01-09  7:50   ` Divan Santana
2019-01-08 20:00 ` Tonton
2019-01-09  7:48   ` Divan Santana

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=cuca7k9snxd.fsf@gmail.com \
    --to=myglc2@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=rekado@elephly.net \
    /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.
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).