From mboxrd@z Thu Jan 1 00:00:00 1970 From: znavko@disroot.org Subject: Re: G-Expressions manual. change user shell in guix config.scm Date: Sat, 04 May 2019 10:53:37 +0000 Message-ID: <768fb29d220fa00af3cb133b0909b870@disroot.org> References: <020ade7dd57cfe2182b3aa360a8cf13d@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:37274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMsIa-0004VL-8x for help-guix@gnu.org; Sat, 04 May 2019 06:53:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMsIY-0001Yz-Om for help-guix@gnu.org; Sat, 04 May 2019 06:53:44 -0400 Received: from knopi.disroot.org ([178.21.23.139]:39612) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hMsIY-0001XX-8b for help-guix@gnu.org; Sat, 04 May 2019 06:53:42 -0400 In-Reply-To: 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: rendaw <7e9wc56emjakcm@s.rendaw.me>, help-guix@gnu.org For $~#$dash it says unbound variable:=0A=0A(use-mosules ...=0A (gnu= packages shells)=0A (guix gexp)=0A )=0A...=0A (user-account= (name "mom") (group "users")=0A (supplementary-groups '("wheel= " "netdev" "audio" "video"))=0A (home-directory "/home/mom")=0A= (shell $~#$dash))=0A=0A# guix system reconfigure config.scm=0A= /root/config.scm:24:32: error: #{$~#$dash}#: unbound variable=0Ahint: Did= you forget a `use-modules' form?=0A=0A=0AFor just a string 'shell dash' = compilation is ok, but after user login in terminal it says 'dash is a di= rectry' and does not allow login:=0A=0A (user-account (name "mom") (gr= oup "users")=0A (supplementary-groups '("wheel" "netdev" "audio= " "video"))=0A (home-directory "/home/mom")=0A (shell= dash))=0A=0A# guix system reconfigure config.scm=0A..ok...=0A=0Abob $=0A= bob $ su - mom=0APassword: =0A/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci= -dash-0.5.10.2: /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2= : Is a directory=0Abob $=0A=0A=0AYes, I am not familiar with Guile. But t= his is very barrier for people to use Guix.=0AI want some tutorial or may= be examples in one place.=0A=0A=0AMay 4, 2019 6:11 AM, "rendaw" <7e9wc56= emjakcm@s.rendaw.me> wrote:=0A=0A> On 5/4/19 12:36 AM, znavko@disroot.org= wrote:=0A> =0A>> I want to try to use G-expressions to change 'mom' user= shell to dash.=0A>> I have this error:=0A>> =0A>> # guix system reconfig= ure config-znavko.scm=0A>> ...=0A>> building /gnu/store/zhmd8fr5v86wnaf6a= pcz4281c008fjv5-shepherd-user-homes.scm.drv...=0A>> building /gnu/store/6= wnbkfdqy3qmbcjz00d1w5p8mw1rkyaa-shells.drv...=0A>> /builder for `/gnu/sto= re/6wnbkfdqy3qmbcjz00d1w5p8mw1rkyaa-shells.drv' failed with exit code 1= =0A>> build of /gnu/store/6wnbkfdqy3qmbcjz00d1w5p8mw1rkyaa-shells.drv fai= led=0A>> View build log at '/var/log/guix/drvs/6w/nbkfdqy3qmbcjz00d1w5p8m= w1rkyaa-shells.drv.bz2'.=0A>> cannot build derivation `/gnu/store/36ah9x5= q8nj6y01fs32brcndmkgyvqmv-etc.drv': 1 dependencies=0A>> couldn't be built= =0A>> building /gnu/store/kvdsb795wn1ic8p9kcdsbkd9vw5v4dm2-shepherd.conf.= drv...=0A>> cannot build derivation `/gnu/store/cmfly4pn3hs2y38km0l3yn3ph= kxy84xj-system.drv': 1 dependencies=0A>> couldn't be built=0A>> guix syst= em: error: build of `/gnu/store/cmfly4pn3hs2y38km0l3yn3phkxy84xj-system.d= rv' failed=0A>> =0A>> # tail -n1 /var/log/guix/drvs/6w/nbkfdqy3qmbcjz00d1= w5p8mw1rkyaa-shells.drv=0A>> ERROR: Wrong type to apply: "/gnu/store/bqmi= b4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2"=0A>> it is here:=0A>> (user-a= ccount (name "mom") (group "users")=0A>> (supplementary-groups '("wheel" = "netdev" "audio" "video"))=0A>> (home-directory "/home/mom")=0A>> (shell = #~(#$dash)))=0A>> I read Guix Refernce Manual 'G-Expressions' section, bu= t there types described quite a little:=0A>> Scheme Syntax: #~exp Scheme = Syntax: (gexp exp)=0A>> =0A>> Return a G-expression containing exp. exp m= ay contain one or more of the following forms: #$obj=0A>> (ungexp obj)=0A= >> =0A>> Introduce a reference to obj. obj may have one of the supported = types, for example a package or a=0A>> derivation, in which case the unge= xp form is replaced by its output file name=E2=80=94e.g.,=0A>> "/gnu/stor= e/=E2=80=A6-coreutils-8.22.=0A>> =0A>> If obj is a list, it is traversed = and references to supported objects are substituted similarly.=0A>> =0A>>= If obj is another gexp, its contents are inserted and its dependencies a= re added to those of the=0A>> containing gexp.=0A>> =0A>> If obj is anoth= er kind of object, it is inserted as is.=0A>> My wrong config is attached= .=0A>> =0A>> But I've found on github workable example=0A>> https://githu= b.com/meiyopeng/guix-config/blob/master/meiyo/systems/default.scm=0A>> = =0A>> And rewrite config with file-append Scheme procedure. This works:= =0A>> =0A>> (user-account (name "mom") (group "users")=0A>> (supplementar= y-groups '("wheel" "netdev" "audio" "video"))=0A>> (home-directory "/home= /mom")=0A>> (shell (file-append dash "/bin/dash")))=0A>> =0A>> But I am c= onfused, cause I do not know why config works without #~ and #~ but only = file-append=0A>> function? Is it still G-Expression (shell (file-append d= ash "/bin/dash"))?=0A> =0A> I'm not 100% sure I'm correct, but I think th= ere are a couple issues here.=0A> =0A> So first of all, I think you have = extra parentheses. You're saying you=0A> want the gexp of the "form" whe= re the lowered dash is the first element,=0A> but you actually want the g= exp of the lowered dash itself (no form).=0A> It's the difference between= `("/gnu/store/...-dash/")` and=0A> `"/gnu/store/...-dash/"` (the former = might be evaluated as an invalid=0A> function call).=0A> =0A> So try:=0A>= =0A> #~#$dash=0A> =0A> instead of=0A> =0A> #~(#$dash)=0A> =0A> However, = `dash` is already an object that lowers to a string, and since=0A> `(shel= l ...)` needs a (n object that lowers to a) path string the #~#$=0A> is u= nnecessary - you can just do `(shell dash)`.=0A> =0A> That being said, th= e lowered form of `dash` is the string of the path to=0A> the derivation = directory rather than the string of the path to an=0A> executable, so you= either need to do `#~(string-append #$dash=0A> "/bin/dash")` to get the = executable path string or else `(file-append=0A> dash "/bin/dash")` as a = shortcut. `(file-append ...)` returns an object=0A> that lowers to a str= ing.=0A> =0A> I hope this helps slightly - it's a really good question an= d I think I=0A> learned from it too.=0A> =0A> ... ah, and it makes sense = that `(shell ...)` is evaluated in a=0A> g-expression context (and thus w= ill lower lowerable objects) --=0A> g-expressions are usually evaluated a= t boot time rather than=0A> build/reconfigure time, and in disk-image at = least the user accounts are=0A> created at boot.