help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleting services from %desktop-services in operating system declara


From: Alex Kost
Subject: Re: Deleting services from %desktop-services in operating system declaration
Date: Sat, 23 Jan 2016 19:43:00 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

address@hidden (2016-01-23 16:09 +0300) wrote:

> On 2016-01-21 00:24, address@hidden wrote:
>> address@hidden skribis:
>>
>>> I have trouble getting the syntax right to delete avahi and wicd from
>>> my config.scm.
>>
>> The correct syntax would be:
>>
>>   (operating-system
>>     ;; …
>>     (services (remove (lambda (service)
>>                         (or (eq? (service-kind service)
>>                                  wicd-service-type)
>>                             (eq? (service-kind service)
>>                                  avahi-service-type)))
>>                       %desktop-services)))
>
> I tried this and got this error:
> # guix system reconfigure /etc/config/config.scm
> guix system: error: failed to load '/etc/config/config.scm':
> /etc/config/config.scm:48:12: In procedure #<procedure a7c3530 ()>:
> /etc/config/config.scm:48:12: In procedure module-lookup: Unbound
> variable: remove

'remove' procedure is from (srfi srfi-1) module, so you need to use it
in your config (see below).

Note that after fixing it, you'll get complaints about other unbound
variables:

- 'avahi-service-type': it is from (gnu services avahi);

- 'tor-service': it is from (gnu services networking);

- 'wicd-service-type': it is also from (gnu services networking), but it
  is not exported (I think we should fix it), so now you have to use it
  like this:

  (@@ (gnu services networking) wicd-service-type)

  which means: "give me 'wicd-service-type' from (gnu services
  networking) module, and I don't care if it's not exported".

> Config here: https://paste.debian.net/367385/

I paste your config here for convenience:

> (use-modules (gnu) (gnu system nss))

(use-modules
 (gnu)
 (gnu system nss)
 (srfi srfi-1))

> (use-service-modules desktop)
> (use-package-modules xfce ratpoison certs)

> (operating-system
>   (host-name "unknown")
>   (timezone "Europe/Stockholm")
>   (locale "en_US.UTF-8")

>   ;; Assuming /dev/sdX is the target hard disk, and "root" is
>   ;; the label of the target root file system.
>   (bootloader (grub-configuration (device "/dev/sda")))
>   (file-systems (cons* (file-system
>                         (device "guix")
>                         (title 'label)
>                         (mount-point "/")
>                         (type "ext4"))

>                     (file-system
>                         (device "home")
>                         (title 'label)
>                         (mount-point "/home")
>                         (type "ext4"))
>                       %base-file-systems))

>   (swap-devices '("/dev/sdb3"))

>   (users (cons (user-account
>                 (name "sdb")
>                 (comment "swedebugia")
>                 (group "users")
>                 (supplementary-groups '("wheel" "netdev"
>                                         "audio" "video"))
>                 (home-directory "/home/sdb"))
>                %base-user-accounts))

>   ;; Add Xfce and Ratpoison; that allows us to choose
>   ;; sessions using either of these at the log-in screen.
>   (packages (cons* xfce ratpoison    ;desktop environments
>                    nss-certs         ;for HTTPS access
>                    %base-packages))

>   ;; Use the "desktop" services, which include the X11
>   ;; log-in service, networking with Wicd, and more.
>   (services (remove (lambda (service)
>                         (or (eq? (service-kind service)
>                                  wicd-service-type)
>                             (eq? (service-kind service)
>                                  avahi-service-type)))
>                       %desktop-services))
>   (services (cons* (tor-service) %desktop-services))

You shouldn't (!) use 'services' (or any other operating-system field
more than *ONCE*).  You can combine 'cons*' and 'remove' like this:

  (services
   (cons* (tor-service)
          (remove (lambda (service)
                    (or (eq? (service-kind service)
                             avahi-service-type)
                        (eq? (service-kind service)
                             (@@ (gnu services networking) wicd-service-type))
                        (eq? (service-kind service)
                             (@@ (gnu services networking) ntp-service-type))))
                  %desktop-services)))

Note: if you want to remove wicd service, you also need to remove ntp
service, otherwise you'll get:

  guix system: error: service 'ntpd' requires 'networking', which is undefined

>   ;; Allow resolution of '.local' host names with mDNS.
>   (name-service-switch %mdns-host-lookup-nss))

-- 
Alex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]