From: znavko@disroot.org
To: rendaw <7e9wc56emjakcm@s.rendaw.me>, help-guix@gnu.org
Subject: Re: G-Expressions manual. change user shell in guix config.scm
Date: Sat, 04 May 2019 10:53:37 +0000 [thread overview]
Message-ID: <768fb29d220fa00af3cb133b0909b870@disroot.org> (raw)
In-Reply-To: <b1f0d983-def5-6a8c-c865-9690e76ef6d0@s.rendaw.me>
For $~#$dash it says unbound variable:
(use-mosules ...
(gnu packages shells)
(guix gexp)
)
...
(user-account (name "mom") (group "users")
(supplementary-groups '("wheel" "netdev" "audio" "video"))
(home-directory "/home/mom")
(shell $~#$dash))
# guix system reconfigure config.scm
/root/config.scm:24:32: error: #{$~#$dash}#: unbound variable
hint: Did you forget a `use-modules' form?
For just a string 'shell dash' compilation is ok, but after user login in terminal it says 'dash is a directry' and does not allow login:
(user-account (name "mom") (group "users")
(supplementary-groups '("wheel" "netdev" "audio" "video"))
(home-directory "/home/mom")
(shell dash))
# guix system reconfigure config.scm
..ok...
bob $
bob $ su - mom
Password:
/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: Is a directory
bob $
Yes, I am not familiar with Guile. But this is very barrier for people to use Guix.
I want some tutorial or may be examples in one place.
May 4, 2019 6:11 AM, "rendaw" <7e9wc56emjakcm@s.rendaw.me> wrote:
> 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.
next prev parent reply other threads:[~2019-05-04 10:53 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
2019-05-04 10:53 ` znavko [this message]
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=768fb29d220fa00af3cb133b0909b870@disroot.org \
--to=znavko@disroot.org \
--cc=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.