all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: rendaw <7e9wc56emjakcm@s.rendaw.me>
To: help-guix@gnu.org
Subject: Re: G-Expressions manual. change user shell in guix config.scm
Date: Sat, 4 May 2019 15:11:12 +0900	[thread overview]
Message-ID: <b1f0d983-def5-6a8c-c865-9690e76ef6d0@s.rendaw.me> (raw)
In-Reply-To: <020ade7dd57cfe2182b3aa360a8cf13d@disroot.org>

On 5/4/19 12:36 AM, znavko@disroot.org wrote:
> I want to try to use G-expressions to change 'mom' user shell to dash.
> I have this error:
>
> # guix system reconfigure config-znavko.scm
> ...
> building /gnu/store/zhmd8fr5v86wnaf6apcz4281c008fjv5-shepherd-user-homes.scm.drv...
> building /gnu/store/6wnbkfdqy3qmbcjz00d1w5p8mw1rkyaa-shells.drv...
> /builder for `/gnu/store/6wnbkfdqy3qmbcjz00d1w5p8mw1rkyaa-shells.drv' failed with exit code 1
> build of /gnu/store/6wnbkfdqy3qmbcjz00d1w5p8mw1rkyaa-shells.drv failed
> View build log at '/var/log/guix/drvs/6w/nbkfdqy3qmbcjz00d1w5p8mw1rkyaa-shells.drv.bz2'.
> cannot build derivation `/gnu/store/36ah9x5q8nj6y01fs32brcndmkgyvqmv-etc.drv': 1 dependencies couldn't be built
> building /gnu/store/kvdsb795wn1ic8p9kcdsbkd9vw5v4dm2-shepherd.conf.drv...
> cannot build derivation `/gnu/store/cmfly4pn3hs2y38km0l3yn3phkxy84xj-system.drv': 1 dependencies couldn't be built
> guix system: error: build of `/gnu/store/cmfly4pn3hs2y38km0l3yn3phkxy84xj-system.drv' failed
>
> # tail -n1 /var/log/guix/drvs/6w/nbkfdqy3qmbcjz00d1w5p8mw1rkyaa-shells.drv
> ERROR: Wrong type to apply: "/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2"
> it is here:
> (user-account (name "mom") (group "users")
> (supplementary-groups '("wheel" "netdev" "audio" "video"))
> (home-directory "/home/mom")
> (shell #~(#$dash)))
> I read Guix Refernce Manual 'G-Expressions' section, but there types described quite a little: Scheme Syntax: #~exp  Scheme Syntax: (gexp exp)   
>
> 	Return a G-expression containing exp. exp may contain one or more of the following forms:  #$obj (ungexp obj)  
>
> 	Introduce a reference to obj. obj may have one of the supported types, for example a package or a derivation, in which case the ungexp form is replaced by its output file name—e.g., "/gnu/store/…-coreutils-8.22. 
>
> 	If obj is a list, it is traversed and references to supported objects are substituted similarly. 
>
> 	If obj is another gexp, its contents are inserted and its dependencies are added to those of the containing gexp. 
>
> 	If obj is another kind of object, it is inserted as is.     
> My wrong config is attached.
>
> But I've found on github workable example https://github.com/meiyopeng/guix-config/blob/master/meiyo/systems/default.scm
>
> And rewrite config with file-append Scheme procedure. This works:
>
>  (user-account (name "mom") (group "users")
>  (supplementary-groups '("wheel" "netdev" "audio" "video"))
>  (home-directory "/home/mom")
>  (shell (file-append dash "/bin/dash")))
>
> But I am confused, cause I do not know why config works without #~ and #~ but only file-append function? Is it still G-Expression (shell (file-append dash "/bin/dash"))?

I'm not 100% sure I'm correct, but I think there are a couple issues here.


So first of all, I think you have extra parentheses.  You're saying you
want the gexp of the "form" where the lowered dash is the first element,
but you actually want the gexp of the lowered dash itself (no form).
It's the difference between `("/gnu/store/...-dash/")` and
`"/gnu/store/...-dash/"` (the former might be evaluated as an invalid
function call).

So try:

#~#$dash

instead of

#~(#$dash)


However, `dash` is already an object that lowers to a string, and since
`(shell ...)` needs a (n object that lowers to a) path string the #~#$
is unnecessary - you can just do `(shell dash)`.


That being said, the lowered form of `dash` is the string of the path to
the derivation directory rather than the string of the path to an
executable, so you either need to do `#~(string-append #$dash
"/bin/dash")` to get the executable path string or else `(file-append
dash "/bin/dash")` as a shortcut.  `(file-append ...)` returns an object
that lowers to a string.

I hope this helps slightly - it's a really good question and I think I
learned from it too.

... ah, and it makes sense that `(shell ...)` is evaluated in a
g-expression context (and thus will lower lowerable objects) --
g-expressions are usually evaluated at boot time rather than
build/reconfigure time, and in disk-image at least the user accounts are
created at boot.

  parent reply	other threads:[~2019-05-04  6:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 15:36 G-Expressions manual. change user shell in guix config.scm znavko
2019-05-04  3:11 ` rendaw
2019-05-04  3:13   ` rendaw
2019-05-04  6:11 ` rendaw [this message]
2019-05-04 10:53 ` znavko
2019-05-04 11:06   ` rendaw
2019-05-04 11:19   ` znavko
2019-05-04 11:24     ` rendaw
2019-05-04 11:29     ` znavko
2019-05-04 11:36       ` rendaw
2019-05-04 11:48       ` znavko
2019-05-04 11:50         ` rendaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b1f0d983-def5-6a8c-c865-9690e76ef6d0@s.rendaw.me \
    --to=7e9wc56emjakcm@s.rendaw.me \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.