unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How to select git:send-email output in config.scm?
@ 2020-08-08  9:50 EuAndreh
  2020-08-08 11:26 ` Tobias Geerinckx-Rice
  2020-08-08 11:33 ` Tobias Geerinckx-Rice
  0 siblings, 2 replies; 6+ messages in thread
From: EuAndreh @ 2020-08-08  9:50 UTC (permalink / raw)
  To: help-guix

Hi guix!

How can I selecet the git:send-email output in my "operating-system"
declaration inside config.scm?

Right now I only have the git package, but I don't know which output it
is selecting. I guess the git:out one?

I tried adding it just like that to my config.scm declaration:

--8<---------------cut here---------------start------------->8---
  (packages
    (append
      (map specification->package
           '("git"
             "git:send-email"
             ...)
--8<---------------cut here---------------end--------------->8---

But when running guix system reconfigure, it complains about it, saying:

--8<---------------cut here---------------start------------->8---
guix system: error: git:send-email: unknown package
guix system: error: failed to load 'guix.scm':
ice-9/boot-9.scm:222:17: In procedure map1:
--8<---------------cut here---------------end--------------->8---

However, running "guix environment --ad-hoc git:send-email" does work.

I got a bit confused by that. On IRC pkill9 mentioned that "git" is a
package, but "git:send-email" is an output. But isn't "git" the same as
"git:out"?

How can I declare that I want the "git:send-email" output also installed
in my config.scm?


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

* Re: How to select git:send-email output in config.scm?
  2020-08-08  9:50 How to select git:send-email output in config.scm? EuAndreh
@ 2020-08-08 11:26 ` Tobias Geerinckx-Rice
  2020-08-08 14:11   ` EuAndreh
  2020-08-08 11:33 ` Tobias Geerinckx-Rice
  1 sibling, 1 reply; 6+ messages in thread
From: Tobias Geerinckx-Rice @ 2020-08-08 11:26 UTC (permalink / raw)
  To: EuAndreh; +Cc: help-guix

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

Hi!

EuAndreh 写道:
> I tried adding it just like that to my config.scm declaration:
>
> --8<---------------cut 
> here---------------start------------->8---
>   (packages
>     (append
>       (map specification->package
>            '("git"
>              "git:send-email"
>              ...)
> --8<---------------cut 
> here---------------end--------------->8---
>
> But when running guix system reconfigure, it complains about it, 
> saying:
>
> --8<---------------cut 
> here---------------start------------->8---
> guix system: error: git:send-email: unknown package
> guix system: error: failed to load 'guix.scm':
> ice-9/boot-9.scm:222:17: In procedure map1:
> --8<---------------cut 
> here---------------end--------------->8---

Use specification->package+output.

Kind regards,

T G-R

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

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

* Re: How to select git:send-email output in config.scm?
  2020-08-08  9:50 How to select git:send-email output in config.scm? EuAndreh
  2020-08-08 11:26 ` Tobias Geerinckx-Rice
@ 2020-08-08 11:33 ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 6+ messages in thread
From: Tobias Geerinckx-Rice @ 2020-08-08 11:33 UTC (permalink / raw)
  To: EuAndreh; +Cc: help-guix

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

EuAndreh 写道:
> I got a bit confused by that. On IRC pkill9 mentioned that "git" 
> is a
> package, but "git:send-email" is an output. But isn't "git" the 
> same as
> "git:out"?

No.  Packages are records (the things created by calling (package 
...), and upon which you can call (package-name ...) etc.).

git:out is the default output of the git package, but git:out or 
git:send-email aren't packages in themselves:

$ guix repl
scheme@(guix-user)> ,use (gnu packages)
scheme@(guix-user)> (specification->package "git")
$1 = #<package git@2.28.0 gnu/packages/version-control.scm:157 
790e385bd6e0>
scheme@(guix-user)> (specification->package+output "git")
$2 = #<package git@2.28.0 gnu/packages/version-control.scm:157 
790e385bd6e0>
$3 = "out"
scheme@(guix-user)> (specification->package+output 
"git:send-email")
$4 = #<package git@2.28.0 gnu/packages/version-control.scm:157 
790e385bd6e0>
$5 = "send-email"

In all three cases, the package record is identical, since there's 
only one ‘git’ package record.  Your selected output is simply 
returned as a string.

Kind regards,

T G-R

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

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

* Re: How to select git:send-email output in config.scm?
  2020-08-08 11:26 ` Tobias Geerinckx-Rice
@ 2020-08-08 14:11   ` EuAndreh
  2020-08-08 18:16     ` Tobias Geerinckx-Rice
  0 siblings, 1 reply; 6+ messages in thread
From: EuAndreh @ 2020-08-08 14:11 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix

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

> Use specification->package+output.

I tried that, and it indeed doesn't complains about 'unknown package'
anymore. However, send-email is still not installed after a system
reconfigure:

--8<---------------cut here---------------start------------->8---
$ sudo guix system reconfigure guix.scm
...
$ git send-email *.patch
git: 'send-email' is not a git command. See 'git --help'
--8<---------------cut here---------------end--------------->8---

What am I missing here?

I've attached the full file to make it clearer.


[-- Attachment #2: Guix system declaration --]
[-- Type: text/plain, Size: 2975 bytes --]

;; This is an operating system configuration generated
;; by the graphical installer.

(use-modules (gnu))
(use-service-modules desktop networking ssh xorg nix)

(operating-system
  (locale "en_US.utf8")
  (timezone "America/Sao_Paulo")
  (keyboard-layout (keyboard-layout "br" #:options '("caps:swapescape")))
  (host-name "velhinho-guix-system")
  (users (cons* (user-account
                  (name "andreh")
                  (comment "andreh")
                  (group "users")
                  (home-directory "/home/andreh")
                  (supplementary-groups
                    '("wheel" "netdev" "audio" "video")))
                %base-user-accounts))
  (packages
    (append
     (map specification->package+output
          '("nss-certs" ;; suggested by Guix
            "help2man" ;; used in Guix development
            "strace"

            "wget"
            "xclip"
            "autojump"
            "git"
            "git:send-email"
            "rlwrap"
            "myrepos"
            "borg"
            "bash-completion"
            "vlc"
            "youtube-dl"
            "sox"
            "jq"
            "calibre"
            "notmuch"
            "isync"
            "xset"
            "bluez"
            "playerctl"
            "xmessage"
            "alsa-utils"
            "icecat" ; not firefox FIXME
            "git-remote-gcrypt"
            "git-crypt"
            "the-silver-searcher"
            "fd"
            "ranger"
            "seahorse"
            "nautilus"
            "git-annex"
            "emacs"
            "gettext"
            "openssh"
            "gnupg"
            "nvi"
            "tmux"
            "direnv"
            "pinentry-gnome3"
            "pinentry"
            "keepassxc"
            "recutils"
            "owncloud-client" ; FIXME: nextcloud
            "xterm"
            "htop"

            ;; xmonad
            "xmonad"
            "ghc"
            "ghc-xmonad-contrib"
            "gcc-toolchain"
            "glibc"
            "xmobar"
            "dmenu"))
     %base-packages))
  (services
   (append
    (list (service gnome-desktop-service-type)
          (set-xorg-configuration
           (xorg-configuration
            (keyboard-layout keyboard-layout))))
    %desktop-services))
  (bootloader
   (bootloader-configuration
    (bootloader grub-efi-bootloader)
    (target "/boot/efi")
    (keyboard-layout keyboard-layout)))
  (mapped-devices
   (list (mapped-device
          (source
           (uuid "67a25dfa-ed48-4466-89f3-e291365df104"))
          (target "cryptroot")
          (type luks-device-mapping))))
  (file-systems
   (cons* (file-system
            (mount-point "/")
            (device "/dev/mapper/cryptroot")
            (type "btrfs")
            (dependencies mapped-devices))
          (file-system
            (mount-point "/boot/efi")
            (device (uuid "1B26-9F4E" 'fat32))
            (type "vfat"))
          %base-file-systems)))

[-- Attachment #3: Type: text/plain, Size: 2 bytes --]

.

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

* Re: How to select git:send-email output in config.scm?
  2020-08-08 14:11   ` EuAndreh
@ 2020-08-08 18:16     ` Tobias Geerinckx-Rice
  2020-08-08 20:53       ` EuAndreh
  0 siblings, 1 reply; 6+ messages in thread
From: Tobias Geerinckx-Rice @ 2020-08-08 18:16 UTC (permalink / raw)
  To: EuAndreh; +Cc: help-guix

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

Good evening,

EuAndreh 写道:
>> Use specification->package+output.
>
> I tried that, and it indeed doesn't complains about 'unknown 
> package'
> anymore. However, send-email is still not installed after a 
> system
> reconfigure:

Indeed, my first mail was too hurried & my longer mail didn't 
address this part at all...

  (packages
    (append
      (list (list git "send-email")
            (list git "gui")            ; just another example
            foo
            ...)
      (map specification->package
           '("git"
             "bar"
             ...)

PACKAGES takes a list of, well, packages -- *or* (package output) 
sublists!  This is not well-documented: it's mentioned in 
gnu/system.scm, but not in the manual under ‘operating-system 
Reference’.  I will add it there.  Thank you for pointing it out.

If you want to go one step further, get rid of APPEND, and MAP 
everything: it's not hard to write a procedure similar to 
specification->package+output that returns a list instead of 
multiple values (hint: take a look at DEFINE-VALUES).  There might 
well already be one hiding somewhere.  I don't know.

For today, at least, I'll leave this as an excercise for the 
reader.  :-p

Kind regards,

T G-R

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

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

* Re: How to select git:send-email output in config.scm?
  2020-08-08 18:16     ` Tobias Geerinckx-Rice
@ 2020-08-08 20:53       ` EuAndreh
  0 siblings, 0 replies; 6+ messages in thread
From: EuAndreh @ 2020-08-08 20:53 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: help-guix

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> Indeed, my first mail was too hurried & my longer mail didn't 
> address this part at all...
>
>   (packages
>     (append
>       (list (list git "send-email")
>             (list git "gui")            ; just another example
>             foo
>             ...)
>       (map specification->package
>            '("git"
>              "bar"
>              ...)
>
> PACKAGES takes a list of, well, packages -- *or* (package output) 
> sublists!  This is not well-documented: it's mentioned in 
> gnu/system.scm, but not in the manual under ‘operating-system 
> Reference’.  I will add it there.  Thank you for pointing it out.

Thanks for the explanation, now I could make it work.

> If you want to go one step further, get rid of APPEND, and MAP 
> everything: it's not hard to write a procedure similar to 
> specification->package+output that returns a list instead of 
> multiple values (hint: take a look at DEFINE-VALUES).  There might 
> well already be one hiding somewhere.  I don't know.
>
> For today, at least, I'll leave this as an excercise for the 
> reader.  :-p

Challenge accepted! :)

I was able to put handle both cases with a single function. I wasn't
able to get rid of map, though. Here's what I got so far:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu)
             (srfi srfi-1))

(operating-system
  (packages
    (append
     (map (lambda (spec)
            (if (not (string-contains spec ":"))
                (specification->package spec)
                (let ((spec-pair (string-split spec #\:)))
                  (list (specification->package (first spec-pair))
                        (second spec-pair)))))
          '("git"
            "git:send-email"))
     %base-packages))
  ...))
--8<---------------cut here---------------end--------------->8---

Any suggestions?


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

end of thread, other threads:[~2020-08-08 21:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-08  9:50 How to select git:send-email output in config.scm? EuAndreh
2020-08-08 11:26 ` Tobias Geerinckx-Rice
2020-08-08 14:11   ` EuAndreh
2020-08-08 18:16     ` Tobias Geerinckx-Rice
2020-08-08 20:53       ` EuAndreh
2020-08-08 11:33 ` Tobias Geerinckx-Rice

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