[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Some general guix questions
From: |
George Clemmer |
Subject: |
Re: Some general guix questions |
Date: |
Wed, 09 Jan 2019 13:09:34 -0500 |
User-agent: |
mu4e 1.0; emacs 26.1 |
Ricardo Wurmus <address@hidden> 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
Re: Some general guix questions, George Clemmer, 2019/01/08
Re: Some general guix questions, Tonton, 2019/01/08