* Deleting services from %desktop-services in operating system declaration @ 2016-01-20 12:42 swedebugia 2016-01-20 13:28 ` Efraim Flashner ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: swedebugia @ 2016-01-20 12:42 UTC (permalink / raw) To: help-guix Hi I have trouble getting the syntax right to delete avahi and wicd from my config.scm. This did not work (inspecting with the REPL): (services (cons* (tor-service) %desktop-services)) (modify-services (alist-delete wicd-service %desktop-services)) (modify-services (alist-delete avahi-service %desktop-services)) Neither this: (services (cons* (tor-service) %desktop-services)) (modify-services (alist-delete wicd-service avahi-service %desktop-services)) The manual does not yet have examples of how to delete one or more entries from the %base-services or other lists. Help would be appreciated :) cheers swedebugia ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Deleting services from %desktop-services in operating system declaration 2016-01-20 12:42 Deleting services from %desktop-services in operating system declaration swedebugia @ 2016-01-20 13:28 ` Efraim Flashner 2016-01-20 14:17 ` Thompson, David 2016-01-20 23:24 ` Ludovic Courtès 2 siblings, 0 replies; 8+ messages in thread From: Efraim Flashner @ 2016-01-20 13:28 UTC (permalink / raw) To: swedebugia; +Cc: help-guix [-- Attachment #1: Type: text/plain, Size: 1321 bytes --] On Wed, 20 Jan 2016 13:42:11 +0100 swedebugia@riseup.net wrote: > Hi > > I have trouble getting the syntax right to delete avahi and wicd from my > config.scm. > > This did not work (inspecting with the REPL): > (services (cons* (tor-service) %desktop-services)) > (modify-services (alist-delete > wicd-service > %desktop-services)) > (modify-services (alist-delete > avahi-service > %desktop-services)) > > Neither this: > (services (cons* (tor-service) %desktop-services)) > (modify-services (alist-delete > wicd-service > avahi-service > %desktop-services)) > > The manual does not yet have examples of how to delete one or more > entries from the %base-services or other lists. > > Help would be appreciated :) > > cheers > swedebugia > I haven't written any config.scm files, but if it's like the python packages this might work: (services (cons* (tor-service) (fold alist-delete %desktop-services '("wicd-service" "avahi-service")))) -- Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Deleting services from %desktop-services in operating system declaration 2016-01-20 12:42 Deleting services from %desktop-services in operating system declaration swedebugia 2016-01-20 13:28 ` Efraim Flashner @ 2016-01-20 14:17 ` Thompson, David 2016-01-20 23:24 ` Ludovic Courtès 2 siblings, 0 replies; 8+ messages in thread From: Thompson, David @ 2016-01-20 14:17 UTC (permalink / raw) To: swedebugia; +Cc: help-guix On Wed, Jan 20, 2016 at 7:42 AM, <swedebugia@riseup.net> wrote: > Hi > > I have trouble getting the syntax right to delete avahi and wicd from my > config.scm. > > This did not work (inspecting with the REPL): > (services (cons* (tor-service) %desktop-services)) > (modify-services (alist-delete > wicd-service > %desktop-services)) > (modify-services (alist-delete > avahi-service > %desktop-services)) > > Neither this: > (services (cons* (tor-service) %desktop-services)) > (modify-services (alist-delete > wicd-service > avahi-service > %desktop-services)) > > The manual does not yet have examples of how to delete one or more entries > from the %base-services or other lists. > > Help would be appreciated :) First of all, %desktop-services is *not* an alist, so using alist-delete certainly won't work. Second, modify-services is *syntax*, so the form (alist-delete ...) is surely the wrong syntax. Below is the docstring for modify-services: Modify the services listed in SERVICES according to CLAUSES. Each clause must have the form: (TYPE VARIABLE => BODY) where TYPE is a service type, such as 'guix-service-type', and VARIABLE is an identifier that is bound within BODY to the value of the service of that TYPE. Consider this example: (modify-services %base-services (guix-service-type config => (guix-configuration (inherit config) (use-substitutes? #f) (extra-options '(\"--gc-keep-derivations\")))) (mingetty-service-type config => (mingetty-configuration (inherit config) (motd (plain-file \"motd\" \"Hi there!\"))))) It changes the configuration of the GUIX-SERVICE-TYPE instance, and that of all the MINGETTY-SERVICE-TYPE instances. This is a shorthand for (map (lambda (svc) ...) %base-services). Hopefully that provides enough of an example for you! You can retrieve the documentation associated with an object at the Guile REPL. Here's how you'd get this one: $ ./pre-inst-env guile GNU Guile 2.0.11 Copyright (C) 1995-2014 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> ,use (gnu services) scheme@(guile-user)> ,describe modify-services - Dave ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Deleting services from %desktop-services in operating system declaration 2016-01-20 12:42 Deleting services from %desktop-services in operating system declaration swedebugia 2016-01-20 13:28 ` Efraim Flashner 2016-01-20 14:17 ` Thompson, David @ 2016-01-20 23:24 ` Ludovic Courtès 2016-01-23 13:09 ` swedebugia 2 siblings, 1 reply; 8+ messages in thread From: Ludovic Courtès @ 2016-01-20 23:24 UTC (permalink / raw) To: swedebugia; +Cc: help-guix swedebugia@riseup.net 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))) As David notes, ‘%desktop-services’ is a list of service objects. To remove elements from a list, the right procedure is ‘remove’ (info "(guile) SRFI-1 Filtering and Partitioning"). > The manual does not yet have examples of how to delete one or more > entries from the %base-services or other lists. I’ve added this example in commit 5d94ac5. HTH! Ludo’. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Deleting services from %desktop-services in operating system declaration 2016-01-20 23:24 ` Ludovic Courtès @ 2016-01-23 13:09 ` swedebugia 2016-01-23 16:43 ` Alex Kost 0 siblings, 1 reply; 8+ messages in thread From: swedebugia @ 2016-01-23 13:09 UTC (permalink / raw) To: ludo; +Cc: help-guix On 2016-01-21 00:24, ludo@gnu.org wrote: > swedebugia@riseup.net 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 Config here: https://paste.debian.net/367385/ > As David notes, ‘%desktop-services’ is a list of service objects. To > remove elements from a list, the right procedure is ‘remove’ (info > "(guile) SRFI-1 Filtering and Partitioning"). Thanks for the tip! >> The manual does not yet have examples of how to delete one or more >> entries from the %base-services or other lists. > > I’ve added this example in commit 5d94ac5. :) cheers sdb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Deleting services from %desktop-services in operating system declaration 2016-01-23 13:09 ` swedebugia @ 2016-01-23 16:43 ` Alex Kost 2016-01-25 11:20 ` swedebugia 0 siblings, 1 reply; 8+ messages in thread From: Alex Kost @ 2016-01-23 16:43 UTC (permalink / raw) To: swedebugia; +Cc: help-guix swedebugia@riseup.net (2016-01-23 16:09 +0300) wrote: > On 2016-01-21 00:24, ludo@gnu.org wrote: >> swedebugia@riseup.net 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Deleting services from %desktop-services in operating system declaration 2016-01-23 16:43 ` Alex Kost @ 2016-01-25 11:20 ` swedebugia 2016-01-25 22:52 ` Alex Kost 0 siblings, 1 reply; 8+ messages in thread From: swedebugia @ 2016-01-25 11:20 UTC (permalink / raw) To: Alex Kost; +Cc: help-guix On 2016-01-23 17:43, Alex Kost wrote: > swedebugia@riseup.net (2016-01-23 16:09 +0300) wrote: > >> On 2016-01-21 00:24, ludo@gnu.org wrote: >>> swedebugia@riseup.net 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))) Thanks for the tip on how to combine them! > > 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 I got this error a couple of times. Thanks for the explanation - this was really helpful in getting my config to work properly. I decided to keep wicd after all and just removed avahi. It seems that avahi is also not exported. The full config with my comments is found here: https://paste.debian.net/368031/ I'm effectively learning Scheme/Guile while trying to hack GuixSD and I like it :D cheers sdb ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Deleting services from %desktop-services in operating system declaration 2016-01-25 11:20 ` swedebugia @ 2016-01-25 22:52 ` Alex Kost 0 siblings, 0 replies; 8+ messages in thread From: Alex Kost @ 2016-01-25 22:52 UTC (permalink / raw) To: swedebugia; +Cc: help-guix swedebugia@riseup.net (2016-01-25 14:20 +0300) wrote: > On 2016-01-23 17:43, Alex Kost wrote: [...] >> 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 > > I got this error a couple of times. Thanks for the explanation - this > was really helpful in getting my config to work properly. > > I decided to keep wicd after all and just removed avahi. If you don't like wicd, you can use another service that provides 'networking': there are 'dhcp-client-service' and 'static-networking-service' services for this purpose. So if you want to remove wicd and to use dhcp service instead, you can do it like this: (services (cons* (tor-service) (dhcp-client-service) (remove (lambda (service) (or (eq? (service-kind service) (@@ (gnu services networking) wicd-service-type)) (eq? (service-kind service) avahi-service-type))) %desktop-services))) > It seems that avahi is also not exported. Actually 'avahi-service-type' is exported¹, so you can use it instead of (@@ (gnu services avahi) avahi-service-type). > The full config with my comments is found here: > https://paste.debian.net/368031/ > (use-modules (gnu) > (gnu system nss) > (srfi srfi-1) ; Needed to use 'remove' below > (gnu services avahi) ; Needed to remove avahi > (gnu services networking)) ; Needed to add tor-service > (use-service-modules desktop) > (use-package-modules xfce ratpoison certs) Just in case you didn't know: (use-service-modules desktop) is exactly the same as (use-modules (gnu services desktop)) So you can use: (use-service-modules desktop avahi networking) instead of specifying (gnu services avahi) and (gnu services networking) in 'use-modules', if you like it. > I'm effectively learning Scheme/Guile while trying to hack GuixSD and I > like it :D I like Guile and Guix too! http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/avahi.scm#n30 -- Alex ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-01-25 22:53 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-01-20 12:42 Deleting services from %desktop-services in operating system declaration swedebugia 2016-01-20 13:28 ` Efraim Flashner 2016-01-20 14:17 ` Thompson, David 2016-01-20 23:24 ` Ludovic Courtès 2016-01-23 13:09 ` swedebugia 2016-01-23 16:43 ` Alex Kost 2016-01-25 11:20 ` swedebugia 2016-01-25 22:52 ` Alex Kost
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).