unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Lee Thompson <lee.p.thomp@gmail.com>
To: 宋文武 <iyzsong@envs.net>
Cc: help-guix@gnu.org
Subject: Re: Remove Package from Gnome Meta-Package
Date: Mon, 03 Jun 2024 21:52:29 +0100	[thread overview]
Message-ID: <87mso1da0i.fsf@gmail.com> (raw)
In-Reply-To: <87jzj6hfdn.fsf@envs.net> ("宋文武"'s message of "Mon, 03 Jun 2024 11:30:44 +0800")

宋文武 <iyzsong@envs.net> writes:

> ```
> (define (exclude-some-packages lst)
>   (filter (lambda (pkg)
>             (not (memq pkg (list
>                             gnome-terminal
>                             gnome-user-docs
>                             gnome-maps))))
>           lst))
>
>
> (service gnome-desktop-service-type
>   (let ((cfg (gnome-desktop-configuration)))
>    (gnome-desktop-configuration
>     (core-services
>      (exclude-some-packages (gnome-desktop-configuration-core-services cfg)))
>     (shell
>      (exclude-some-packages (gnome-desktop-configuration-shell cfg)))
>     (utilities
>      (exclude-some-packages (gnome-desktop-configuration-utilities cfg)))
>     (extra-packages
>      (exclude-some-packages (gnome-desktop-configuration-utilities cfg))))))
> ```
Thank you this has been very helpful, in the end I adapted your code
like so:
```scheme
(define (gnome-exclude-packages cfg . exclude)
  (let ((exclude-packages (λ (pkgs)
                            (remove (λ (pkg)
                                      (memq pkg exclude))
                                    pkgs))))
    (gnome-desktop-configuration
     (core-services
      (exclude-packages (gnome-desktop-configuration-core-services cfg)))
     (shell
      (exclude-packages (gnome-desktop-configuration-shell cfg)))
     (utilities
      (exclude-packages (gnome-desktop-configuration-utilities cfg)))
     (extra-packages
      (exclude-packages (gnome-desktop-configuration-extra-packages cfg))))))

; ...

(service gnome-desktop-service-type
                          (gnome-exclude-packages
                           (gnome-desktop-configuration)
                           gnome-music epiphany cheese))
```

I wonder if this is the best or most elegant way of achieving this. I'm
interested to see what others think.

> Hope it helps.
Very much, it was a good opportunity to play around in the REPL and see
the data structures for myself which I must admit I was apprehensive
about. Many thanks.


      reply	other threads:[~2024-06-09  9:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01 20:48 Remove Package from Gnome Meta-Package Lee Thompson
2024-06-03  3:30 ` 宋文武
2024-06-03 20:52   ` Lee Thompson [this message]

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=87mso1da0i.fsf@gmail.com \
    --to=lee.p.thomp@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=iyzsong@envs.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).