From mboxrd@z Thu Jan 1 00:00:00 1970 From: rendaw Subject: Re: G-Expressions manual. change user shell in guix config.scm Date: Sat, 4 May 2019 12:13:49 +0900 Message-ID: <96209194-810d-66b0-4a8d-2bf9b1e789fb@fastmail.com> References: <020ade7dd57cfe2182b3aa360a8cf13d@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([209.51.188.92]:48663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMl7b-0007io-5t for help-guix@gnu.org; Fri, 03 May 2019 23:13:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMl7Z-0003lK-Sm for help-guix@gnu.org; Fri, 03 May 2019 23:13:55 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:34075) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hMl7Z-0003ko-KE for help-guix@gnu.org; Fri, 03 May 2019 23:13:53 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id A31FA37B for ; Fri, 3 May 2019 23:13:52 -0400 (EDT) Received: from [192.168.1.35] (y236169.dynamic.ppp.asahi-net.or.jp [118.243.236.169]) by mail.messagingengine.com (Postfix) with ESMTPA id 4391CE4122 for ; Fri, 3 May 2019 23:13:51 -0400 (EDT) In-Reply-To: Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: help-guix@gnu.org On 5/4/19 12:11 PM, rendaw 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.