[Top][All Lists]

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

Re: How to remove extension from service definition?

From: znavko
Subject: Re: How to remove extension from service definition?
Date: Sat, 20 Mar 2021 17:57:48 +0000

Hello, Joshua!
I see your code is elegant and represents solution of a task:
remove 'network-manager-service-type' from %desktop-services variable

I've already got this solution here in Guix-help and I use it 
in every config.scm example placed to my git:

Now I faced to another interestng task:
1. I use %desktop-services that declares 'network-manager-applet' 
as extension of 'profile-service-type' here [1]
2. I use 'xfce-desktop-service-type' that has 'profile-service-type'
as an extension [2]
3. I cannot just simply remove 'profile-service-type' because it is 
really important [3]
4. I need to remove 'network-manager-applet' from the extensions list
in 'profile-service-type' declared here [4]

You gave me and idea to work with variables.
I could just redefine some variable, for example copy 
desctop.scm to my local machine and include it to my config
and code it without those lines that include 'network-manager-applet'.
But I see this approach is not elegant, as Russians say 'a dog-nail'.

I seek elegant academical solution, as programmers say 'linux-way'.

I alwasy ask here and got solutions, but here I started to read
Lisp manual, then I will read Scheme manual, then Guile manual
and then Guix manual and Guix repository to discover that only 
funcion-antidote for this peace of code [4]:

(define %desktop-services
  ;; List of services typically useful for a "desktop" use case.
      (simple-service 'network-manager-applet
          (list network-manager-applet))))

Do you know some Guix function for remove extension?
If you have a snippet for remove extension from service it
will be very exact I want.


March 19, 2021 4:07 PM, "Joshua Branson" <> wrote:

> znavko--- via <> writes:
>> Hello! I wish to remove network-manager-applet extension from
>> profile-service-type
>> which is in the list of extensions of
>> xfce-desktop-service-type [1] and [2]
>> And also I want to see the result.
>> I try it unsuccessfully like this:
>> $ guile
>>> (use-modules (gnu) (gnu services) (gnu services desktop) (srfi srfi-1))
>>> xfce-desktop-service-type
>> $1 = #<service-type xfce-desktop 7f6c0a4b1000>
>>> (remove (lambda (service) (eq? (service-kind service) profile-service-type))
>>> xfce-desktop-service-type)
>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>> In procedure remove: Wrong type argument in position 2: #<service-type 
>> xfce-desktop 7f6c0a4b1000>
> (remove (lambda (service) (eq? (service-kind service) profile-service-type)) 
> %desktop-services)
> "works for me." Though you get a HUGE output. I didn't check the
> output to make sure it was removed. Also just removing all
> profile-service-type(s) might be a REALLY BAD idea. I wouldn't know
> exactly why it would be bad, but it might remove lots of system services.
>> Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
>> Also I cannot remove service from %desktop-services asI usually do in 
>> config.scm:
>>> (remove (lambda (service) (member (service-kind service) (list 
>>> network-manager-service-type
>>> bluetooth-service))) %desktop-services)
>> ;;; <stdin>:19:57: warning: possibly unbound variable 
>> `network-manager-service-type'
>> ice-9/boot-9.scm:1669:16: In procedure raise-exception:
>> error: network-manager-service-type: unbound variable
>> Can you show me how ot interact with guile ? And how to remove service 
>> extensionsand also
>> how to look at xfce-desktop-service-type contents?
> So the problem with it not knowing that 'network-manager-service-type'
> is a variable is because you have not included the file that specifies
> that network-manager-service-type is a variable. So how do we discover
> what file has network-manager-service-type defined as a variable?
> $ guix system search network-manager
> name: network-manager
> location: gnu/services/networking.scm:1120:4
> extends: shepherd-root dbus polkit account activate session-environment 
> profile
> shepherdnames: networking
> description: Run NetworkManager 
> (, a network
> management daemon that aims to
> + simplify wired and wireless networking.
> relevance: 15
> You can see that it's located in gnu/services/networking.scm. Where is
> bluetooth defined?
> $ guix system search bluetooth
> name: bluetooth
> location: gnu/services/desktop.scm:467:2
> extends: dbus udev etc shepherd-root
> shepherdnames: bluetooth
> description: Run the `bluetoothd' daemon, which manages all the Bluetooth 
> devices and provides a
> number of D-Bus interfaces.
> relevance: 19
> Ahh. gnu/services/desktop.scm.
> so
> $ guile
> scheme@(guile-user) > ,use(gnu services networking)
> scheme@(guile-user) > ,use(gnu services desktop)
> scheme@(guile-user) > (remove (lambda (service) (member (service-kind 
> service) (list
> network-manager-service-type bluetooth-service))) %desktop-services)
> Best of luck!
> --
> Joshua Branson (joshuaBPMan in #guix)
> Sent from Emacs and Gnus
> "You can have whatever you want, as long as you help
> enough other people get what they want." - Zig Ziglar

reply via email to

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