* G-Expressions manual. change user shell in guix config.scm
@ 2019-05-03 15:36 znavko
2019-05-04 3:11 ` rendaw
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: znavko @ 2019-05-03 15:36 UTC (permalink / raw)
To: help-guix
[-- Attachment #1: Type: text/plain, Size: 2634 bytes --]
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"))?
[-- Attachment #2: config-znavko.scm --]
[-- Type: application/octet-stream, Size: 2817 bytes --]
;-*- mode: Scheme; -*-
;;this is znavko's cute config
(use-modules (gnu) (gnu system nss)
(gnu system locale) ;;for locale-definition
(gnu services desktop)
(srfi srfi-1) ;;for remove function
(gnu services networking) ;;for remove ntp
(gnu services avahi) ;;for remove avahi
(gnu services xorg)
(gnu packages admin) ;;for wpa_supplicant
(gnu packages shells)
(guix gexp)
)
(use-service-modules desktop)
(use-package-modules certs gnome)
(operating-system (host-name "antelope") (timezone "Europe/Moscow") (locale "en_US.utf8")
(bootloader (bootloader-configuration (bootloader grub-bootloader) (target "/dev/sda")))
(file-systems (cons (file-system (device "/dev/sda1") (mount-point "/") (type "ext4")) %base-file-systems))
(swap-devices '("/dev/sda2"))
(users (cons* (user-account (name "bob") (group "users")
(supplementary-groups '("wheel" "netdev" "audio" "video"))
(home-directory "/home/bob"))
(user-account (name "mom") (group "users")
(supplementary-groups '("wheel" "netdev" "audio" "video"))
(home-directory "/home/mom")
(shell #~(#$dash)))
%base-user-accounts))
;; This is where we specify system-wide packages.
(packages (cons* nss-certs ;for HTTPS access
gvfs ;for user mounts
wpa-supplicant
zsh
%base-packages))
(services (cons*
(service xfce-desktop-service-type)
(service dhcp-client-service-type)
(service slim-service-type
(slim-configuration
(xorg-configuration
(xorg-configuration
(extra-config
'("Section \"InputClass\"
Identifier \"touchpad\"
Driver \"libinput\"
MatchIsTouchpad \"on\"
Option \"Tapping\" \"on\"
EndSection")
))))
)
(modify-services
(remove (lambda (service)
(member (service-kind service)
(list ntp-service-type avahi-service-type
bluetooth-service network-manager-service-type
gdm-service-type)))
%desktop-services) ;end of remove lambda services
(wpa-supplicant-service-type config =>
(wpa-supplicant-configuration
(interface "wlp2s0")
(config-file "/etc/wpa_supplicant/wpa_supplicant.conf")))
(elogind-service-type
c => (elogind-configuration (handle-lid-switch 'ignore)))
) ;;end of modify-services
)) ;;end of services
;; Allow resolution of '.local' host names with mDNS.
(name-service-switch %mdns-host-lookup-nss)
;;blacklist ugly sound speaker, blacklist ideapad_laptop for prevent soft blocking wlan
(kernel-arguments '("modprobe.blacklist=pcspkr,snd_pcsp,bluetooth,ideapad_laptop"))
) ;;end of operating-system
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
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
2 siblings, 1 reply; 12+ messages in thread
From: rendaw @ 2019-05-04 3:11 UTC (permalink / raw)
To: help-guix
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
2019-05-04 3:11 ` rendaw
@ 2019-05-04 3:13 ` rendaw
0 siblings, 0 replies; 12+ messages in thread
From: rendaw @ 2019-05-04 3:13 UTC (permalink / raw)
To: help-guix
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
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 6:11 ` rendaw
2019-05-04 10:53 ` znavko
2 siblings, 0 replies; 12+ messages in thread
From: rendaw @ 2019-05-04 6:11 UTC (permalink / raw)
To: help-guix
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
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 6:11 ` rendaw
@ 2019-05-04 10:53 ` znavko
2019-05-04 11:06 ` rendaw
2019-05-04 11:19 ` znavko
2 siblings, 2 replies; 12+ messages in thread
From: znavko @ 2019-05-04 10:53 UTC (permalink / raw)
To: rendaw, help-guix
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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
2019-05-04 10:53 ` znavko
@ 2019-05-04 11:06 ` rendaw
2019-05-04 11:19 ` znavko
1 sibling, 0 replies; 12+ messages in thread
From: rendaw @ 2019-05-04 11:06 UTC (permalink / raw)
To: znavko, help-guix
On 5/4/19 7:53 PM, znavko@disroot.org wrote:
> 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?
You have $~#$ but you should have #~#$ instead. But this is the same as
just having `(shell dash)` which causes the next error:
>
>
> 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 $
`dash` is a package object which is "lowered" and becomes a string of
the path to the directory:
`/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2`
`(shell ...)` needs a path to an executable (the shell program), that
is: `/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2/bin/dash`
Therefore you need the string-append or file-append expressions to add
the final "/bin/dash". See the examples from my previous email.
Cheers,
rendaw
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
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
1 sibling, 2 replies; 12+ messages in thread
From: znavko @ 2019-05-04 11:19 UTC (permalink / raw)
To: rendaw, help-guix
(shell #~#$dash) -- compiles too, but again:
bob $ su - mom
Password:
/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: Is a directory
bob $
this works all right: (shell (file-append dash "/bin/dash"))
May 4, 2019 11:12 AM, "rendaw" <7e9wc56emjakcm@s.rendaw.me> wrote:
> On 5/4/19 7:53 PM, znavko@disroot.org wrote:
>
>> 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?
>
> You have $~#$ but you should have #~#$ instead. But this is the same as
> just having `(shell dash)` which causes the next error:
>
>> 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 $
>
> `dash` is a package object which is "lowered" and becomes a string of
> the path to the directory:
> `/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2`
>
> `(shell ...)` needs a path to an executable (the shell program), that
> is: `/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2/bin/dash`
>
> Therefore you need the string-append or file-append expressions to add
> the final "/bin/dash". See the examples from my previous email.
>
> Cheers,
> rendaw
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
2019-05-04 11:19 ` znavko
@ 2019-05-04 11:24 ` rendaw
2019-05-04 11:29 ` znavko
1 sibling, 0 replies; 12+ messages in thread
From: rendaw @ 2019-05-04 11:24 UTC (permalink / raw)
To: znavko, help-guix
On 5/4/19 8:19 PM, znavko@disroot.org wrote:
> (shell #~#$dash) -- compiles too, but again:
>
> bob $ su - mom
> Password:
> /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: Is a directory
> bob $
>
Could you perhaps provide some details on what you are expecting to
happen here? This error is expected - shell needs a path to an
executable, not a directory. Both `#~#$dash` and `dash` become paths to
directories.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
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
1 sibling, 2 replies; 12+ messages in thread
From: znavko @ 2019-05-04 11:29 UTC (permalink / raw)
To: rendaw, help-guix
I just want to change user shell. So i know how to do it. And you have cleared a bit for me what is formed object and what is file, and what is file-append function.
May 4, 2019 11:24 AM, "rendaw" <7e9wc56emjakcm@s.rendaw.me> wrote:
> On 5/4/19 8:19 PM, znavko@disroot.org wrote:
>
>> (shell #~#$dash) -- compiles too, but again:
>>
>> bob $ su - mom
>> Password:
>> /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2:
>> /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: Is a directory
>> bob $
>
> Could you perhaps provide some details on what you are expecting to
> happen here? This error is expected - shell needs a path to an
> executable, not a directory. Both `#~#$dash` and `dash` become paths to
> directories.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
2019-05-04 11:29 ` znavko
@ 2019-05-04 11:36 ` rendaw
2019-05-04 11:48 ` znavko
1 sibling, 0 replies; 12+ messages in thread
From: rendaw @ 2019-05-04 11:36 UTC (permalink / raw)
To: znavko, help-guix
On 5/4/19 8:29 PM, znavko@disroot.org wrote:
> I just want to change user shell. So i know how to do it. And you have cleared a bit for me what is formed object and what is file, and what is file-append function.
>
> May 4, 2019 11:24 AM, "rendaw" <7e9wc56emjakcm@s.rendaw.me> wrote:
>
>> On 5/4/19 8:19 PM, znavko@disroot.org wrote:
>>
>>> (shell #~#$dash) -- compiles too, but again:
>>>
>>> bob $ su - mom
>>> Password:
>>> /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2:
>>> /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: Is a directory
>>> bob $
>> Could you perhaps provide some details on what you are expecting to
>> happen here? This error is expected - shell needs a path to an
>> executable, not a directory. Both `#~#$dash` and `dash` become paths to
>> directories.
(file-append obj "some string") is a convenient alternative to
#~(string-append #$obj "some string").
In the latter "obj" becomes (for example)
"/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2", and
"(string-append ...)" combines
"/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2" and
"/bin/dash" to produce
"/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2/bin/dash"
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
2019-05-04 11:29 ` znavko
2019-05-04 11:36 ` rendaw
@ 2019-05-04 11:48 ` znavko
2019-05-04 11:50 ` rendaw
1 sibling, 1 reply; 12+ messages in thread
From: znavko @ 2019-05-04 11:48 UTC (permalink / raw)
To: rendaw, help-guix
This two equivalents work:
(shell (file-append dash "/bin/dash")) -- this is advanced guix variant with new file-append function, this variant does not need (use-modules (guix gexp))
(shell #~(string-append #$dash "/bin/dash")) -- this is guile function string-append and gexp, ungexp functions, this variant does not need (use-modules (guix gexp)) too.
May 4, 2019 11:36 AM, "rendaw" <7e9wc56emjakcm@s.rendaw.me> wrote:
> On 5/4/19 8:29 PM, znavko@disroot.org wrote:
>
>> I just want to change user shell. So i know how to do it. And you have cleared a bit for me what is
>> formed object and what is file, and what is file-append function.
>>
>> May 4, 2019 11:24 AM, "rendaw" <7e9wc56emjakcm@s.rendaw.me> wrote:
>>
>>> On 5/4/19 8:19 PM, znavko@disroot.org wrote:
>>
>> (shell #~#$dash) -- compiles too, but again:
>>
>> bob $ su - mom
>> Password:
>> /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2:
>> /gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2: Is a directory
>> bob $
>>> Could you perhaps provide some details on what you are expecting to
>>> happen here? This error is expected - shell needs a path to an
>>> executable, not a directory. Both `#~#$dash` and `dash` become paths to
>>> directories.
>
> (file-append obj "some string") is a convenient alternative to
> #~(string-append #$obj "some string").
>
> In the latter "obj" becomes (for example)
> "/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2", and
> "(string-append ...)" combines
> "/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2" and
> "/bin/dash" to produce
> "/gnu/store/bqmib4vf9mr8dkqx4dqpcqrnb93giwci-dash-0.5.10.2/bin/dash"
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: G-Expressions manual. change user shell in guix config.scm
2019-05-04 11:48 ` znavko
@ 2019-05-04 11:50 ` rendaw
0 siblings, 0 replies; 12+ messages in thread
From: rendaw @ 2019-05-04 11:50 UTC (permalink / raw)
To: znavko, help-guix
On 5/4/19 8:48 PM, znavko@disroot.org wrote:
> This two equivalents work:
>
> (shell (file-append dash "/bin/dash")) -- this is advanced guix variant with new file-append function, this variant does not need (use-modules (guix gexp))
>
> (shell #~(string-append #$dash "/bin/dash")) -- this is guile function string-append and gexp, ungexp functions, this variant does not need (use-modules (guix gexp)) too.
Great! I'm glad that helped!
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-05-04 11:50 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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.