unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* %desktop-services #:select service alsa-service-type - unbound variable
@ 2018-09-20 14:31 znavko
  2018-09-20 15:50 ` Pierre Neidhardt
  0 siblings, 1 reply; 5+ messages in thread
From: znavko @ 2018-09-20 14:31 UTC (permalink / raw)
  To: help-guix@gnu.org

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

Hello! I respect GuixSD ideas, guix developers' work and want to use guix opportunities.
I am novice in Scheme language. I prefer wpa-supplicant + dhclient without networkmanager (cause I had troubles with nm-dispatcher on funtoo).
I want to write my /etc/config.scm without networkmanager and d-bus (cause I think only networkmanager in my config needs it) .
As I know it appears in my system from %desktop-services variable defined here https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/desktop.scm
So I have no sense about #:select, but as saw I try to get from %desktop-services all services I need except ntpd, networkmanager, avahi, polkid.

I type /etc/config.scm and `guix system reconfigure /etc/config.scm` repeatedly say me to use module, and I add them into use-modules variable. But in the end it shows me the error:
# guix system reconfigure /etc/config.scm
/etc/config.scm:27:9: alsa-service-type: unbound variable
hint: Did you forget a `use-modules' form?

# cat /etc/config.scm
;; This is an operating system configuration template
;; for a "desktop" setup with GNOME and Xfce where the
;; root partition is encrypted with LUKS.

(use-modules (gnu) (gnu system nss)
             (gnu services xorg)
             (gnu packages libusb)
             (gnu services networking)
             (gnu services audio)
             (gnu packages linux)
             (gnu services dbus)

)
(use-service-modules desktop)
(use-package-modules certs gnome)

(operating-system
  (host-name "antelope")
  (timezone "Europe/Moscow")
  (locale "en_US.utf8")

  (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
                (target "/dev/sda")))

  (file-systems (cons (file-system
                        (device "/dev/sda1")
                        (mount-point "/")
                        (type "ext4")
                        )
                      %base-file-systems))

  (swap-devices '("/dev/sda2"))

  (users (cons* (user-account
                (name "bob")
                (comment "bob is good too")
                (group "users")
                (supplementary-groups '("wheel" "netdev"
                                        "audio" "video"))
                (home-directory "/home/bob"))

      (user-account
                (name "alice")
                (comment "alice is bobs sister")
                (group "users")
                (supplementary-groups '("wheel" "netdev"
                                        "audio" "video"))
                (home-directory "/home/alice"))

               %base-user-accounts))

  ;; This is where we specify system-wide packages.
  (packages (cons* nss-certs         ;for HTTPS access
                   gvfs              ;for user mounts
                   %base-packages))

  ;; Add GNOME and/or Xfce---we can choose at the log-in
  ;; screen with F1.  Use the "desktop" services, which
  ;; include the X11 log-in service, networking with
  ;; NetworkManager, and more.
  ;; from here https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/desktop.scm#n971

  (services (cons* (xfce-desktop-service)
                   (%desktop-services
                      #:select ((service slim-service-type)
                                (simple-service 'mtp udev-service-type (list libmtp))
                                (service wpa-supplicant-service-type)
                                (udisks-service)
                                (upower-service)
                                (accountsservice-service)
                                (colord-service)
                                (geoclue-service)
                                (elogind-service)
                                (dbus-service)
                                x11-socket-directory-service

                                (service alsa-service-type)
                                %base-services
                      )
                    )
  ))

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

How to deal with these variables?
I need to have:
- wpa-supplicant service that runs automatically after system run (or better after user login) and uses /etc/wpa_supplicant.conf file
- dhclient tha automatically starts after wpa-supplicant and works with wlp2s0

Now I connec to the wifi like this:
# su
# cat /root/1
#!/bin/sh
#connect to wi-fi through wpa_supplicant
herd stop wpa-supplicant
wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant.conf
sleep 4
dhclient -v wlp2s0

# ./1

Help me to write config for wpa-supplicant + dhclient services.

[-- Attachment #2: Type: text/html, Size: 10682 bytes --]

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

* Re: %desktop-services #:select service alsa-service-type - unbound variable
  2018-09-20 14:31 %desktop-services #:select service alsa-service-type - unbound variable znavko
@ 2018-09-20 15:50 ` Pierre Neidhardt
  2018-09-20 17:07   ` znavko
  2018-09-20 17:29   ` znavko
  0 siblings, 2 replies; 5+ messages in thread
From: Pierre Neidhardt @ 2018-09-20 15:50 UTC (permalink / raw)
  To: znavko; +Cc: help-guix@gnu.org

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

Hello,

I'm not sure I understood all your issues, so I'll try out some suggestions:

- The ALSA-related options are defined in the `(gnu services sound)` Guile module.
  Import the module to your config file and it should fix your issue.
  This is documented in the "(guix) Sound Services" section of the manual.

- NetworkManager: have you tried it?  Does it work?  You might not have the same
  issues with it on Guix than on Funtoo.  I suggest you give it a try first.
	Like you, I had a poor opinion of NetworkManager before I tried it on GuixSD.

- If you really want to turn off NetworkManager, I suggest you remove the
  service from your config.  For instance (untested):

  (services
     (remove (lambda (service)
               (eq? (service-kind service) network-manager-service-type))
             %desktop-services))

  With NetworkManager disabled, wpa_supplicant and dhclient should also be
  disabled.  Check the running processes.

  - If you want to run the wpa_supplicant Guix service, I don't know you can
  specify a custom config.  From the documentation and the source code in
  (gnu services networking), it does not seem to be customizable but I suppose
  that it reads /etc/wpa_supplicant anyways.

  - Otherwise, disable wpa_supplicant / dhclient services just like you did with
  NetworkManager if necessary.  Then you are free to run them manually with your
  custom script.

Hope that helps!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

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

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

* Re: %desktop-services #:select service alsa-service-type - unbound variable
  2018-09-20 15:50 ` Pierre Neidhardt
@ 2018-09-20 17:07   ` znavko
  2018-09-20 17:29   ` znavko
  1 sibling, 0 replies; 5+ messages in thread
From: znavko @ 2018-09-20 17:07 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix\@gnu.org

Thank you for your response, Pierre Neidhardt!
I tried NetworkManager on GuixSD and have no troubles with it. But I dislike NM cause it stores wifi password as it is, but wpa_supplicant saves hash only. Of course, I want delete NetworkManager cause I want to control network by myself without such a monster. Further I will configure dnsmasq and I know NM pretty cool linked with it, but no.

As it is now, I tried to move config to /etc/wpa_supplicant/wpa_supplicant.conf and reboot. So the service wpa-supplicant was running

# herd status wpa-supplicant
Status of wpa-supplicant:
  It is started.
  Running value is 324.
  It is enabled.
  Provides (wpa-supplicant).
  Requires (user-processes dbus-system loopback).
  Conflicts with ().
  Will be respawned.

But I could not connect to network running `dhclient -v wlp2s0` so I think I do not know how get wpa-supplicant service to use my config by default.

Your piece of code grews like this:

# cat /etc/config.scm
...
  (services (cons* (xfce-desktop-service)
                    (remove (lambda (service)
                     (eq? (service-kind service) network-manager-service-type))
                    %desktop-services)

As I can understand guix will compile entire system with such config.scm from sources, cause such configuration is not presented in GuixSD servers, am I right?

This construction is hard understandable for me. https://www.scheme.com/tspl4/start.html#./start:h5 did not help this time. I want also to delete polkitd, avahi, cups, but I have troubles from start learning Scheme:
I tried 2 Scheme compilers: MIT-Scheme and Chicken, but their behavior is quite different even with 'print' function. MIT-Scheme gives errors on `(print x)` and `print x`. http://0x0.st/sxhA.png  But (lambda (service) ...) is very hard.




‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
четверг, сентябрь 20, 2018 6:50 вечера, Pierre Neidhardt <mail@ambrevar.xyz> пишет:

> Hello,
>
> I'm not sure I understood all your issues, so I'll try out some suggestions:
>
> -   The ALSA-related options are defined in the `(gnu services sound)` Guile module.
>     Import the module to your config file and it should fix your issue.
>     This is documented in the "(guix) Sound Services" section of the manual.
>
> -   NetworkManager: have you tried it? Does it work? You might not have the same
>     issues with it on Guix than on Funtoo. I suggest you give it a try first.
>     Like you, I had a poor opinion of NetworkManager before I tried it on GuixSD.
>
> -   If you really want to turn off NetworkManager, I suggest you remove the
>     service from your config. For instance (untested):
>
>     (services
>     (remove (lambda (service)
>     (eq? (service-kind service) network-manager-service-type))
>     %desktop-services))
>
>     With NetworkManager disabled, wpa_supplicant and dhclient should also be
>     disabled. Check the running processes.
>
>     -   If you want to run the wpa_supplicant Guix service, I don't know you can
>         specify a custom config. From the documentation and the source code in
>         (gnu services networking), it does not seem to be customizable but I suppose
>         that it reads /etc/wpa_supplicant anyways.
>
>     -   Otherwise, disable wpa_supplicant / dhclient services just like you did with
>         NetworkManager if necessary. Then you are free to run them manually with your
>         custom script.
>
>         Hope that helps!
>
>         --
>         Pierre Neidhardt
>         https://ambrevar.xyz/
>

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

* Re: %desktop-services #:select service alsa-service-type - unbound variable
  2018-09-20 15:50 ` Pierre Neidhardt
  2018-09-20 17:07   ` znavko
@ 2018-09-20 17:29   ` znavko
  2018-09-20 17:49     ` Pierre Neidhardt
  1 sibling, 1 reply; 5+ messages in thread
From: znavko @ 2018-09-20 17:29 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix\@gnu.org

My config caused the error downloading linux-libre 4.16. Do not know why 4.16, cause I have installed 4.17

$ $ uname -a
Linux antelope 4.17.0-gnu #1 SMP 1 x86_64 GNU/Linux

# cat /etc/config.scm
...
  (services (cons* (xfce-desktop-service)
                    (remove (lambda (service)
                     (eq? (service-kind service) network-manager-service-type))
                    %desktop-services)

  ))


# guix system reconfigure /etc/config.scm
...
kmod-24/tools/rmmod.c
kmod-24/tools/static-nodes.c
source is under 'kmod-24'
applying '/gnu/store/p7yx2m3l014sam8jlax25mskq4dk8kvm-kmod-module-directory.patch'...

Starting download of /gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz
From https://linux-libre.fsfla.org/pub/linux-libre/releases/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz...
download failed "https://linux-libre.fsfla.org/pub/linux-libre/releases/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz" 404 "Not Found"

Starting download of /gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz
From ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-4.16.4-gnu.tar.xz...
Throw to key `ftp-error' with args `(#<input-output: socket 14> "RETR linux-libre-4.16.4-gnu.tar.xz" 550 "Failed to open file.\r")'.

Starting download of /gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz
From https://ftpmirror.gnu.org/gnu/linux-libre/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz...
following redirection to `https://mirror.tochlab.net/pub/gnu/linux-libre/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz'...
download failed "https://mirror.tochlab.net/pub/gnu/linux-libre/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz" 404 "Not Found"

Starting download of /gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz
From ftp://ftp.cs.tu-berlin.de/pub/gnu/linux-libre/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz...
In procedure connect*: Connection timed out

Starting download of /gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz
From ftp://ftp.funet.fi/pub/mirrors/ftp.gnu.org/gnu/linux-libre/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz...
Throw to key `ftp-error' with args `(#<input-output: socket 17> "CWD 4.16.4-gnu" 550 "Can't change directory to 4.16.4-gnu: No such file or directory\r")'.

Starting download of /gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz
From http://ftp.gnu.org/pub/gnu/linux-libre/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz...
download failed "http://ftp.gnu.org/pub/gnu/linux-libre/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz" 404 "Not Found"

Starting download of /gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz
From http://mirror.hydra.gnu.org/file/linux-libre-4.16.4-gnu.tar.xz/sha256/0lq3yv88yd9zcz52bl4hfllb41vy1i826gcim6qjjc88assqib9i...
download failed "http://mirror.hydra.gnu.org/file/linux-libre-4.16.4-gnu.tar.xz/sha256/0lq3yv88yd9zcz52bl4hfllb41vy1i826gcim6qjjc88assqib9i" 404 "Not Found"

Starting download of /gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz
From http://tarballs.nixos.org/sha256/0lq3yv88yd9zcz52bl4hfllb41vy1i826gcim6qjjc88assqib9i...
download failed "http://tarballs.nixos.org/sha256/0lq3yv88yd9zcz52bl4hfllb41vy1i826gcim6qjjc88assqib9i" 404 "Not Found"
failed to download "/gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz" from ("https://linux-libre.fsfla.org/pub/linux-libre/releases/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz" "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-4.16.4-gnu.tar.xz" "mirror://gnu/linux-libre/4.16.4-gnu/linux-libre-4.16.4-gnu.tar.xz")
builder for `/gnu/store/s3wzp8igh4g1x4fsp5l39gfia8q0bib6-linux-libre-4.16.4-gnu.tar.xz.drv' failed to produce output path `/gnu/store/a8vz60aiccnhzz35calv7wfzlgm2r312-linux-libre-4.16.4-gnu.tar.xz'
cannot build derivation `/gnu/store/pvfwji4aqr1764ylij8xabaqlx7qghn7-linux-libre-4.16.4-gnu.tar.xz.drv': 1 dependencies couldn't be built
cannot build derivation `/gnu/store/pvdzw7wk93ckhp0c8j7h2h3flgsf1mp8-linux-libre-4.16.4.drv': 1 dependencies couldn't be built
guix system: error: build failed: build of `/gnu/store/pvdzw7wk93ckhp0c8j7h2h3flgsf1mp8-linux-libre-4.16.4.drv' failed
#

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
четверг, сентябрь 20, 2018 6:50 вечера, Pierre Neidhardt <mail@ambrevar.xyz> пишет:

> Hello,
>
> I'm not sure I understood all your issues, so I'll try out some suggestions:
>
> -   The ALSA-related options are defined in the `(gnu services sound)` Guile module.
>     Import the module to your config file and it should fix your issue.
>     This is documented in the "(guix) Sound Services" section of the manual.
>
> -   NetworkManager: have you tried it? Does it work? You might not have the same
>     issues with it on Guix than on Funtoo. I suggest you give it a try first.
>     Like you, I had a poor opinion of NetworkManager before I tried it on GuixSD.
>
> -   If you really want to turn off NetworkManager, I suggest you remove the
>     service from your config. For instance (untested):
>
>     (services
>     (remove (lambda (service)
>     (eq? (service-kind service) network-manager-service-type))
>     %desktop-services))
>
>     With NetworkManager disabled, wpa_supplicant and dhclient should also be
>     disabled. Check the running processes.
>
>     -   If you want to run the wpa_supplicant Guix service, I don't know you can
>         specify a custom config. From the documentation and the source code in
>         (gnu services networking), it does not seem to be customizable but I suppose
>         that it reads /etc/wpa_supplicant anyways.
>
>     -   Otherwise, disable wpa_supplicant / dhclient services just like you did with
>         NetworkManager if necessary. Then you are free to run them manually with your
>         custom script.
>
>         Hope that helps!
>
>         --
>         Pierre Neidhardt
>         https://ambrevar.xyz/
>

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

* Re: %desktop-services #:select service alsa-service-type - unbound variable
  2018-09-20 17:29   ` znavko
@ 2018-09-20 17:49     ` Pierre Neidhardt
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Neidhardt @ 2018-09-20 17:49 UTC (permalink / raw)
  To: znavko; +Cc: help-guix@gnu.org

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


> But I dislike NM cause it stores wifi password as it is, but wpa_supplicant
> saves hash only.

See
https://wiki.archlinux.org/index.php/NetworkManager#Encrypted_Wi-Fi_passwords if
that's an acceptable solution for you.  Also note that the passwords are only
readable with root access.

> But I could not connect to network running `dhclient -v wlp2s0` so I think I do
> not know how get wpa-supplicant service to use my config by default.

Make sure dhclient is not already running.  Check your processes and the
services.

Multiple instances of dhclient / wpa_supplicant will prevent you from
connecting.

Regarding wpa_supplicent, actually the Guix service does not load a config file
but rather listens to a D-Bus interface (if I'm not mistaken).  I guess you
could pass the configuration via D-Bus but I don't know how to do this.

If you really want to use wpa_supplicant manually, you can also disable the
service wpa-supplicant service and it should work.

> As I can understand guix will compile entire system with such config.scm from
> sources, cause such configuration is not presented in GuixSD servers, am I
> right?

No, it will only compile the outputs (e.g. packages) for which no substitute was
found on the server, assuming you have enabled substitutes.

Running `guix system reconfigure` will only build/install outputs if they are
missing from the store.  A config.scm involves a collection of outputs and if
they are all available already, nothing will be built.

This is why when running `guix system reconfigure` twice in a row, the second
run should not take more than a couple of seconds.

>   (services (cons* (xfce-desktop-service)
>                     (remove (lambda (service)
>                      (eq? (service-kind service) network-manager-service-type))
>                     %desktop-services)

Quick explanation:

- The Lisp syntax boils down to this: `(FUNCTION ARGUMENTS...)`.  The first
  element between the parentheses is the function name, the other elements are
  all the arguments passed to that function.  Everything is an expression and
  expressions can be nested, so `(SQUARE (SQRT 4))` return 4.

- "services" takes a list of services as argument.

- To make things simpler here, you could replace "cons*" with "list".

- The arguments to "cons*" or "list" return a list, so we build a list of
services with `(list SERVICE1 SERVICE2 ...)`.

- `(xfce-desktop-service)` returns just that, the XFCE desktop service.

- The `remove` function takes two arguments: an anonymous function (i.e. a
  "lambda") and a list.  The anonymous function is a predicate: if true, then
  the element of the list is discarded.  You can look at it like a filter.  The
  lambda here is a function that takes a service and if equal to
  network-manager-service-type, then it returns true (the result of the `eq?`
  function), thus the service is discarded.

- `remove` is called on %desktop-services with a predicate that matches
  network-manager-service-type: the result is a list stripped from
  network-manager-service-type.

Hope that helps, let me know if there is anything else to clarify.

> I tried 2 Scheme compilers: MIT-Scheme and Chicken

Note that Guix uses Guile, so that's probably the Scheme you want to use here! :)

If you want to learn Scheme, there are many books out there.
If TSPL is not to your taste, consider:

- The Little Schemer: Haven't read it, but I heard it's a gentle introduction.

- Structure and Interpretation of Computer Programs: a bit more academic, but it
comes with a bunch of videos
(https://www.youtube.com/watch?v=2Op3QLzMgSY&list=PLE18841CABEA24090) and it's
also available in Texinfo format -- checkout the SICP Guix package.

Hope that helps!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

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

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

end of thread, other threads:[~2018-09-20 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 14:31 %desktop-services #:select service alsa-service-type - unbound variable znavko
2018-09-20 15:50 ` Pierre Neidhardt
2018-09-20 17:07   ` znavko
2018-09-20 17:29   ` znavko
2018-09-20 17:49     ` Pierre Neidhardt

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