* skeleton files in sub-directories
@ 2019-05-26 10:08 Reza Alizadeh Majd
2019-05-26 19:46 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Reza Alizadeh Majd @ 2019-05-26 10:08 UTC (permalink / raw)
To: help-guix
Hi Guix,
I want to add a series of configuration files to each user's home directory. for this
I could use skeletons in operating system definitions.
the problem is that some of these skeletons are located in sub-directories, for
example `~/.local/share/foo/bar.cfg`. and when I run `guix system reconfigure`
I receive errors about missing parent directory (`~/.local/share/foo` in this example).
is there any way to create parent directories before copying the skeleton files?
Thanks,
Reza
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: skeleton files in sub-directories
2019-05-26 10:08 skeleton files in sub-directories Reza Alizadeh Majd
@ 2019-05-26 19:46 ` Ludovic Courtès
2019-05-26 23:33 ` ison
2019-05-27 6:43 ` Reza Alizadeh Majd
0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-05-26 19:46 UTC (permalink / raw)
To: Reza Alizadeh Majd; +Cc: help-guix
Hi,
"Reza Alizadeh Majd" <r.majd@pantherx.org> skribis:
> the problem is that some of these skeletons are located in sub-directories, for
> example `~/.local/share/foo/bar.cfg`. and when I run `guix system reconfigure`
> I receive errors about missing parent directory (`~/.local/share/foo` in this example).
>
> is there any way to create parent directories before copying the skeleton files?
I think you can do something like:
(define dot-config
(compute-file "dot-config-skeleton"
#~(begin
(mkdir #$output)
(mkdir (string-append #$output "/guix"))
…)))
and then add it in the list of skeletons like so:
`(…
(".config" ,dot-config))
Does that make sense?
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: skeleton files in sub-directories
2019-05-26 19:46 ` Ludovic Courtès
@ 2019-05-26 23:33 ` ison
2019-05-27 6:43 ` Reza Alizadeh Majd
1 sibling, 0 replies; 4+ messages in thread
From: ison @ 2019-05-26 23:33 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: help-guix
I think mkdir-p is a better option here.
It will create all missing directories so there's no need to run 2 mkdir
commands, and won't give an error if the directories already exist.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: skeleton files in sub-directories
2019-05-26 19:46 ` Ludovic Courtès
2019-05-26 23:33 ` ison
@ 2019-05-27 6:43 ` Reza Alizadeh Majd
1 sibling, 0 replies; 4+ messages in thread
From: Reza Alizadeh Majd @ 2019-05-27 6:43 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: help-guix
Hi,
using `computed-file` to create the parent directories for config files, fixed the issue.
Thanks,
Reza
On Mon, May 27, 2019, at 12:16 AM, Ludovic Courtès wrote:
> Hi,
>
> "Reza Alizadeh Majd" <r.majd@pantherx.org> skribis:
>
> > the problem is that some of these skeletons are located in sub-directories, for
> > example `~/.local/share/foo/bar.cfg`. and when I run `guix system reconfigure`
> > I receive errors about missing parent directory (`~/.local/share/foo` in this example).
> >
> > is there any way to create parent directories before copying the skeleton files?
>
> I think you can do something like:
>
> (define dot-config
> (compute-file "dot-config-skeleton"
> #~(begin
> (mkdir #$output)
> (mkdir (string-append #$output "/guix"))
> …)))
>
> and then add it in the list of skeletons like so:
>
> `(…
> (".config" ,dot-config))
>
> Does that make sense?
>
> Ludo’.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-27 6:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-26 10:08 skeleton files in sub-directories Reza Alizadeh Majd
2019-05-26 19:46 ` Ludovic Courtès
2019-05-26 23:33 ` ison
2019-05-27 6:43 ` Reza Alizadeh Majd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).