unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Some general guix questions
@ 2019-01-08 16:43 Divan Santana
  2019-01-08 17:13 ` Pierre Neidhardt
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Divan Santana @ 2019-01-08 16:43 UTC (permalink / raw)
  To: help-guix

Hi great guix community,

1. What is the recommendations around when to install a package system
   wide (via guix system reconfigure manifest.scm) vs in your user
   profile? I'm confused if i3/various X packages and other desktop
   packages should be installed in one or the other? Or even the pros
   and cons of each. Is this in the manual?

2. One can install packages via a manifest or via a frontend tool like
   emacs-guix or helm system packages.  I like the former, because
   it's like your system is defined in a manifest and evaluated, and
   you can keep track in git etc, suppose infrastructure as code. But
   I like the latter too and I believe some others do too. Is there a
   way to get the best of both worlds here? Any thoughts on the matter.

3. If I run guix system vm --fallback system.scm I get a vm I can run,
   which is really awesome. If I then do a guix pull and guix system
   vm --fallback system.scm I get /another/ VM which I can run. How is
   the previous VMs garbage collected, I wonder?

Thanks very much,
--
Divan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  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-09  7:51   ` Divan Santana
  2019-01-08 19:26 ` George Clemmer
  2019-01-08 20:00 ` Tonton
  2 siblings, 2 replies; 12+ messages in thread
From: Pierre Neidhardt @ 2019-01-08 17:13 UTC (permalink / raw)
  To: Divan Santana; +Cc: help-guix


1. System-wide installation means packages are readily available to all users,
   which can be nice, but users then don't have the freedom to remove them.
   For maximal flexibility, it's often best to leave system-wide packages to the
   bare minimum and let users choose what they want.
   
   If you are preparing a distribution for an organization, requirements could
   be different.  Your mileage may vary.
   
2. I also combine emacs-guix and helm-system-packages a lot ;)
   My personal take at this issue is to generate the manifest from all installed
   packages with the following shell script:

--8<---------------cut here---------------start------------->8---
 	cat<<EOF>"$PKG_ROOT/guix"
(specifications->manifest
 '(
EOF

	guix package -I | awk '{printf("\"%s", $1); if($3!="out") {printf("%s", ":" $3)}; print "\""}' | LC_ALL=C sort >>"$PKG_ROOT/guix"
	echo "))" >>"$PKG_ROOT/guix"
--8<---------------cut here---------------end--------------->8---

  There might be better ways to do this.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-08 16:43 Some general guix questions Divan Santana
  2019-01-08 17:13 ` Pierre Neidhardt
@ 2019-01-08 19:26 ` George Clemmer
  2019-01-09  7:50   ` Divan Santana
  2019-01-08 20:00 ` Tonton
  2 siblings, 1 reply; 12+ messages in thread
From: George Clemmer @ 2019-01-08 19:26 UTC (permalink / raw)
  To: Divan Santana; +Cc: help-guix


Divan Santana <divan@santanas.co.za> writes:

> Hi great guix community,
>
> 1. What is the recommendations around when to install a package system
>    wide (via guix system reconfigure manifest.scm) vs in your user
>    profile? I'm confused if i3/various X packages and other desktop
>    packages should be installed in one or the other? Or even the pros
>    and cons of each. Is this in the manual?

FWIW, when you run a single-user system (e.g. a desktop or server that
only you use), it can be convenient to install any packages that you
want available in root system-wide. E.g, I use ...

(define sys-packages
  '(
    "cups"
    "emacs-no-x"
    "emacs-guix"
    "emacs-magit"
    "emacs-paredit"
    "freeipmi"
    "git"
    "glibc-utf8-locales"
    "mdadm"
    "mosh"
    "nss-certs"
    "openssh"
    "qemu"
    "screen"
    "smartmontools"
    ))
...
 (packages (append (map specification->package
			sys-packages)
		   %base-packages))

> 2. One can install packages via a manifest or via a frontend tool like
>    emacs-guix or helm system packages.  I like the former, because
>    it's like your system is defined in a manifest and evaluated, and
>    you can keep track in git etc, suppose infrastructure as code. But
>    I like the latter too and I believe some others do too. Is there a
>    way to get the best of both worlds here? Any thoughts on the
>    matter.

I find it convenient to maintain a Guix manifest under Git but I feel
free to "dabble" using emacs-guix. I "roll back" to the manifest set by
using the emacs-guix Generation-List running 'guix package -m'.

> 3. If I run guix system vm --fallback system.scm I get a vm I can run,
>    which is really awesome. If I then do a guix pull and guix system
>    vm --fallback system.scm I get /another/ VM which I can run. How is
>    the previous VMs garbage collected, I wonder?

Your 'guix system vm' results will be protected from gc if you specify
the ‘--root=FILE’ option.

HTH - George

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-08 16:43 Some general guix questions Divan Santana
  2019-01-08 17:13 ` Pierre Neidhardt
  2019-01-08 19:26 ` George Clemmer
@ 2019-01-08 20:00 ` Tonton
  2019-01-09  7:48   ` Divan Santana
  2 siblings, 1 reply; 12+ messages in thread
From: Tonton @ 2019-01-08 20:00 UTC (permalink / raw)
  To: Divan Santana; +Cc: help-guix

On Tue, 08 Jan 2019 18:43:06 +0200
Divan Santana <divan@santanas.co.za> wrote:

> 3. If I run guix system vm --fallback system.scm I get a vm I can run,
>    which is really awesome. If I then do a guix pull and guix system
>    vm --fallback system.scm I get /another/ VM which I can run. How is
>    the previous VMs garbage collected, I wonder?

A note on garbage collection in guix: most everything lives in the store.
vm's, packages, your operating system, previous generations of operating
systems.

All entries can have what's called GC roots. As far as I understand a root is
a symbolic link somewhere else on the filesystem. So if you create a vm it
will remain in your store until guix gc is run WHILE the vm has no roots.

So to clear space you would have to delete the roots for previous generations
of your system or packages. guix package has a command for this, guix system
does not have this yet (I think). A roundabout way to delete system
generations is to delete the symlink/root in '/var/guix/profiles/' and then
run guix gc. Be careful what you delete.
-- 
    :)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-08 17:13 ` Pierre Neidhardt
@ 2019-01-08 20:36   ` Ricardo Wurmus
  2019-01-08 21:24     ` Pierre Neidhardt
  2019-01-09 18:09     ` George Clemmer
  2019-01-09  7:51   ` Divan Santana
  1 sibling, 2 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2019-01-08 20:36 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix


Hi Pierre,

>    My personal take at this issue is to generate the manifest from all installed
>    packages with the following shell script:
>
> --8<---------------cut here---------------start------------->8---
>  	cat<<EOF>"$PKG_ROOT/guix"
> (specifications->manifest
>  '(
> EOF
>
> 	guix package -I | awk '{printf("\"%s", $1); if($3!="out") {printf("%s", ":" $3)}; print "\""}' | LC_ALL=C sort >>"$PKG_ROOT/guix"
> 	echo "))" >>"$PKG_ROOT/guix"
> --8<---------------cut here---------------end--------------->8---
>
>   There might be better ways to do this.

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

--
Ricardo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  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
  1 sibling, 1 reply; 12+ messages in thread
From: Pierre Neidhardt @ 2019-01-08 21:24 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: help-guix

I think your solution is more elegant, Ricardo, because it's not robust to
change (the AWK parsing could break).

Question: why should we run it from a Guix checkout?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-08 21:24     ` Pierre Neidhardt
@ 2019-01-08 21:40       ` Ricardo Wurmus
  0 siblings, 0 replies; 12+ messages in thread
From: Ricardo Wurmus @ 2019-01-08 21:40 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix


Pierre Neidhardt <mail@ambrevar.xyz> writes:

> I think your solution is more elegant, Ricardo, because it's not robust to
> change (the AWK parsing could break).
>
> Question: why should we run it from a Guix checkout?

So that you can use “./pre-inst-env guile” which makes sure that you’re
using the Guix modules from the checkout.  When you’re using “guix pull”
you’d have to first set the load path to the correct location (otherwise
it would take the system load path, which might give you older Guix
modules).

--
Ricardo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-08 20:00 ` Tonton
@ 2019-01-09  7:48   ` Divan Santana
  0 siblings, 0 replies; 12+ messages in thread
From: Divan Santana @ 2019-01-09  7:48 UTC (permalink / raw)
  To: Tonton; +Cc: help-guix


Tonton <tonton@riseup.net> writes:

> On Tue, 08 Jan 2019 18:43:06 +0200
> Divan Santana <divan@santanas.co.za> wrote:
>
>> 3. If I run guix system vm --fallback system.scm I get a vm I can run,
>>    which is really awesome. If I then do a guix pull and guix system
>>    vm --fallback system.scm I get /another/ VM which I can run. How is
>>    the previous VMs garbage collected, I wonder?
>
> A note on garbage collection in guix: most everything lives in the store.
> vm's, packages, your operating system, previous generations of operating
> systems.
>
> All entries can have what's called GC roots. As far as I understand a root is
> a symbolic link somewhere else on the filesystem. So if you create a vm it
> will remain in your store until guix gc is run WHILE the vm has no roots.
>
> So to clear space you would have to delete the roots for previous generations
> of your system or packages. guix package has a command for this, guix system
> does not have this yet (I think). A roundabout way to delete system
> generations is to delete the symlink/root in '/var/guix/profiles/' and then
> run guix gc. Be careful what you delete.

Great thanks!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-08 19:26 ` George Clemmer
@ 2019-01-09  7:50   ` Divan Santana
  0 siblings, 0 replies; 12+ messages in thread
From: Divan Santana @ 2019-01-09  7:50 UTC (permalink / raw)
  To: George Clemmer; +Cc: help-guix


George Clemmer <myglc2@gmail.com> writes:

> Divan Santana <divan@santanas.co.za> writes:
>
>> Hi great guix community,
>>
>> 1. What is the recommendations around when to install a package system
>>    wide (via guix system reconfigure manifest.scm) vs in your user
>>    profile? I'm confused if i3/various X packages and other desktop
>>    packages should be installed in one or the other? Or even the pros
>>    and cons of each. Is this in the manual?
>
> FWIW, when you run a single-user system (e.g. a desktop or server that
> only you use), it can be convenient to install any packages that you
> want available in root system-wide. E.g, I use ...
>
> (define sys-packages
>   '(
>     "cups"
>     "emacs-no-x"
>     "emacs-guix"
>     "emacs-magit"
>     "emacs-paredit"
>     "freeipmi"
>     "git"
>     "glibc-utf8-locales"
>     "mdadm"
>     "mosh"
>     "nss-certs"
>     "openssh"
>     "qemu"
>     "screen"
>     "smartmontools"
>     ))
> ...
>  (packages (append (map specification->package
> 			sys-packages)
> 		   %base-packages))
>
>> 2. One can install packages via a manifest or via a frontend tool like
>>    emacs-guix or helm system packages.  I like the former, because
>>    it's like your system is defined in a manifest and evaluated, and
>>    you can keep track in git etc, suppose infrastructure as code. But
>>    I like the latter too and I believe some others do too. Is there a
>>    way to get the best of both worlds here? Any thoughts on the
>>    matter.
>
> I find it convenient to maintain a Guix manifest under Git but I feel
> free to "dabble" using emacs-guix. I "roll back" to the manifest set by
> using the emacs-guix Generation-List running 'guix package -m'.
>
>> 3. If I run guix system vm --fallback system.scm I get a vm I can run,
>>    which is really awesome. If I then do a guix pull and guix system
>>    vm --fallback system.scm I get /another/ VM which I can run. How is
>>    the previous VMs garbage collected, I wonder?
>
> Your 'guix system vm' results will be protected from gc if you specify
> the ‘--root=FILE’ option.
>
> HTH - George

It does help. Thanks.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-08 17:13 ` Pierre Neidhardt
  2019-01-08 20:36   ` Ricardo Wurmus
@ 2019-01-09  7:51   ` Divan Santana
  1 sibling, 0 replies; 12+ messages in thread
From: Divan Santana @ 2019-01-09  7:51 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

Pierre Neidhardt <mail@ambrevar.xyz> writes:

> 1. System-wide installation means packages are readily available to all users,
>    which can be nice, but users then don't have the freedom to remove them.
>    For maximal flexibility, it's often best to leave system-wide packages to the
>    bare minimum and let users choose what they want.
>
>    If you are preparing a distribution for an organization, requirements could
>    be different.  Your mileage may vary.
>
> 2. I also combine emacs-guix and helm-system-packages a lot ;)
>    My personal take at this issue is to generate the manifest from all installed
>    packages with the following shell script:
>
> --8<---------------cut here---------------start------------->8---
>  	cat<<EOF>"$PKG_ROOT/guix"
> (specifications->manifest
>  '(
> EOF
>
> 	guix package -I | awk '{printf("\"%s", $1); if($3!="out") {printf("%s", ":" $3)}; print "\""}' | LC_ALL=C sort >>"$PKG_ROOT/guix"
> 	echo "))" >>"$PKG_ROOT/guix"
> --8<---------------cut here---------------end--------------->8---
>
>   There might be better ways to do this.

Brilliant.  Thanks Pierre.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-08 20:36   ` Ricardo Wurmus
  2019-01-08 21:24     ` Pierre Neidhardt
@ 2019-01-09 18:09     ` George Clemmer
  2019-01-22 10:28       ` Pierre Neidhardt
  1 sibling, 1 reply; 12+ messages in thread
From: George Clemmer @ 2019-01-09 18:09 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: help-guix


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Some general guix questions
  2019-01-09 18:09     ` George Clemmer
@ 2019-01-22 10:28       ` Pierre Neidhardt
  0 siblings, 0 replies; 12+ messages in thread
From: Pierre Neidhardt @ 2019-01-22 10:28 UTC (permalink / raw)
  To: George Clemmer; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

I realized that something was missing from the above manifest generators: the
outputs.

My shot at it:

--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 (lambda (entry)
               (let ((out (manifest-entry-output entry)))
                 (if (string= out "out")
                     (manifest-entry-name entry)
                     (format #f "~a:~a"
                             (manifest-entry-name entry)
                             (manifest-entry-output entry)))))
             (manifest-entries (profile-manifest where))))))
  (_ (error "Please provide the path to a Guix profile.")))
--8<---------------cut here---------------end--------------->8---

Unlike George, I'm not sorting the entry, so the latest package will appear
first in the manifest.  I haven't made up my mind yet as to which one is more
useful, sorted or not.

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-01-22 10:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).