unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* New reconfigure, creating a file under /etc
@ 2019-10-07  0:12 SuarezMiguelC via
  2019-10-07  2:12 ` John Soo
  2019-10-07  7:03 ` Efraim Flashner
  0 siblings, 2 replies; 5+ messages in thread
From: SuarezMiguelC via @ 2019-10-07  0:12 UTC (permalink / raw)
  To: help-guix@gnu.org

Hello help guix!, I'm trying to make a reconfigure, where I create a file under /etc.

This because, since I'm using gnome as my desktop environment, I want to add some functionalities on it to be more 'connected' to GuixSD, especifically, create the file 'os-release' with the content 'PRETTY_NAME=Guix-System"', this will make gnome to identify the system and display it on settings, thus a better natural 'connection' between gnome and guix.

Using 'etc-service-type' on my new reconfigure, it looks like this:

  (services
    (append
     (list (service gnome-desktop-service-type)
   (service etc-service-type
    (list `("os-release" ,(plain-file "os-release"
      "PRETTY_NAME=Guix-System"))))
   (set-xorg-configuration
    (xorg-configuration
     (keyboard-layout keyboard-layout))))
     %desktop-services)))

Trying to run this reconfigure will cause an error for 'more than one etc service', so I guess I don't have the correct syntax, I've on the IRC chat, but no response, because of this, I write an e-mail.

Thanks in advantage!

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

* Re: New reconfigure, creating a file under /etc
  2019-10-07  0:12 New reconfigure, creating a file under /etc SuarezMiguelC via
@ 2019-10-07  2:12 ` John Soo
  2019-10-07  6:30   ` Gábor Boskovits
  2019-10-07  7:03 ` Efraim Flashner
  1 sibling, 1 reply; 5+ messages in thread
From: John Soo @ 2019-10-07  2:12 UTC (permalink / raw)
  To: SuarezMiguelC; +Cc: help-guix@gnu.org

Hi there,

> (services
>    (append
>     (list (service gnome-desktop-service-type)
>   (service etc-service-type
>    (list `("os-release" ,(plain-file "os-release"
>      "PRETTY_NAME=Guix-System"))))
>   (set-xorg-configuration
>    (xorg-configuration
>     (keyboard-layout keyboard-layout))))
>     %desktop-services)))
> 
> Trying to run this reconfigure will cause an error for 'more than one etc service'

You will want to use modify-services to modify the existing etc-service in %desktop-services. Check out the services reference in the manual:
https://guix.gnu.org/manual/en/html_node/Service-Reference.html

An example might be:

(modify-services %desktop-services
  (etc-service-type conf 
    (do-something-to conf)))

Then you can append the new ones onto the modified services. 

Hope that helps,

John

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

* Re: New reconfigure, creating a file under /etc
  2019-10-07  2:12 ` John Soo
@ 2019-10-07  6:30   ` Gábor Boskovits
  0 siblings, 0 replies; 5+ messages in thread
From: Gábor Boskovits @ 2019-10-07  6:30 UTC (permalink / raw)
  To: John Soo; +Cc: help-guix, SuarezMiguelC

John Soo <jsoo1@asu.edu> ezt írta (időpont: 2019. okt. 7., Hét 4:12):

> Hi there,
>
> > (services
> >    (append
> >     (list (service gnome-desktop-service-type)
> >   (service etc-service-type
> >    (list `("os-release" ,(plain-file "os-release"
> >      "PRETTY_NAME=Guix-System"))))
> >   (set-xorg-configuration
> >    (xorg-configuration
> >     (keyboard-layout keyboard-layout))))
> >     %desktop-services)))
> >
> > Trying to run this reconfigure will cause an error for 'more than one
> etc service'
>
> You will want to use modify-services to modify the existing etc-service in
> %desktop-services. Check out the services reference in the manual:
> https://guix.gnu.org/manual/en/html_node/Service-Reference.html
>
> An example might be:
>
> (modify-services %desktop-services
>   (etc-service-type conf
>     (do-something-to conf)))
>
> Then you can append the new ones onto the modified services.
>
If you just want to add a file, you could extend it using
extra-special-file.

>
>
> Hope that helps,
>
> John
>
>
>

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

* Re: New reconfigure, creating a file under /etc
  2019-10-07  0:12 New reconfigure, creating a file under /etc SuarezMiguelC via
  2019-10-07  2:12 ` John Soo
@ 2019-10-07  7:03 ` Efraim Flashner
  2019-10-09  8:11   ` Giovanni Biscuolo
  1 sibling, 1 reply; 5+ messages in thread
From: Efraim Flashner @ 2019-10-07  7:03 UTC (permalink / raw)
  To: SuarezMiguelC; +Cc: help-guix@gnu.org

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

Here's the code I have for /etc/os-release. I defined %os-release-file
at the top to keep my actual services list a bit shorter. The '@'
notation is a short-cut to not need to actually import (guix packages)
or (gnu packages package-management) in my config.

Then later when adding the other services the 'simple-service' can just
be added in and it'll be combined with the other 'etc-service-type'
services to create a unified /etc.

(define %os-release-file
  (plain-file "os-release"
              (string-append
                "NAME=\"Guix System\"\n"
                "PRETTY_NAME=\"Guix System\"\n"
                "VERSION=\""((@ (guix packages) package-version) (@ (gnu packages package-management) guix))"\"\n"
                "ID=guix\n"
                "HOME_URL=\"https://www.gnu.org/software/guix/\"\n"
                "SUPPORT_URL=\"https://www.gnu.org/software/guix/help/\"\n"
                "BUG_REPORT_URL=\"mailto:bug-guix@gnu.org\"\n")))

(simple-service 'os-release etc-service-type
                `(("os-release" ,%os-release-file)))

and here's what it looks like:

efraim@E5400 ~$ cat /etc/os-release 
NAME="Guix System"
PRETTY_NAME="Guix System"
VERSION="1.0.1-6.0ed97e6"
ID=guix
HOME_URL="https://www.gnu.org/software/guix/"
SUPPORT_URL="https://www.gnu.org/software/guix/help/"
BUG_REPORT_URL="mailto:bug-guix@gnu.org"

-- 
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: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: New reconfigure, creating a file under /etc
  2019-10-07  7:03 ` Efraim Flashner
@ 2019-10-09  8:11   ` Giovanni Biscuolo
  0 siblings, 0 replies; 5+ messages in thread
From: Giovanni Biscuolo @ 2019-10-09  8:11 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: help-guix@gnu.org

Hi Efraim,

thanks for the very interesting example!

Efraim Flashner <efraim@flashner.co.il> writes:

[...]

> (define %os-release-file
>   (plain-file "os-release"
>               (string-append
>                 "NAME=\"Guix System\"\n"
>                 "PRETTY_NAME=\"Guix System\"\n"
>                 "VERSION=\""((@ (guix packages) package-version) (@ (gnu packages package-management) guix))"\"\n"
>                 "ID=guix\n"
>                 "HOME_URL=\"https://www.gnu.org/software/guix/\"\n"
>                 "SUPPORT_URL=\"https://www.gnu.org/software/guix/help/\"\n"
>                 "BUG_REPORT_URL=\"mailto:bug-guix@gnu.org\"\n")))
>
> (simple-service 'os-release etc-service-type
>                 `(("os-release" ,%os-release-file)))

[...]

IMHO this is a perfect candidate - whith many other replies in help-guix
- for the Guix Cookbook (thanks Ricardo for creating it!): what about to
expand your example in a patch for the cookbook? :-)

Thanks! Gio'

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

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

end of thread, other threads:[~2019-10-09  8:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-07  0:12 New reconfigure, creating a file under /etc SuarezMiguelC via
2019-10-07  2:12 ` John Soo
2019-10-07  6:30   ` Gábor Boskovits
2019-10-07  7:03 ` Efraim Flashner
2019-10-09  8:11   ` Giovanni Biscuolo

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