help-guix
[Top][All Lists]
Advanced

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

Re: G-Expressions manual. change user shell in guix config.scm


From: rendaw
Subject: Re: G-Expressions manual. change user shell in guix config.scm
Date: Sat, 4 May 2019 12:13:49 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3

On 5/4/19 12:11 PM, rendaw wrote:
> On 5/4/19 12:36 AM, address@hidden 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.



reply via email to

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