unofficial mirror of 
 help / color / mirror / Atom feed
From: Reza Alizadeh Majd <>
Subject: writable skeleton files in sub-directories
Date: Wed, 14 Oct 2020 22:34:59 +0330
Message-ID: <> (raw)

Hi Guix,

working on a new service for `lxqt-desktop`, I need to provide a series
of predefined configurations for that. so I defined a series of
skeleton files and add them to the service using `account-service-type`

the problem is that when the location of a skeleton file is a path other
than user's home directory, it will be created in read-only mode.

I also tried  to use `computed-file` and `chmod` the created file. but
the permission still didn't apply.

I also provided a test configuration to reproduce this issue:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu) (guix records))

;; Test service definition
(define-record-type* <test-config> test-config
  make-test-config test-config?)

(define (test-skeletons)
     ,(computed-file "test-config-dir"
                      '((guix build utils))
                          (use-modules (guix build utils))
                          (mkdir-p #$output)))))
    (".config/test/foo.conf" ,(plain-file "foo.conf" "this is readonly"))
     ,(computed-file "bar.conf"
                      '((guix build utils))
                          (use-modules (guix build utils))
                          (call-with-output-file #$output
                            (lambda (port)
                              (display "this is also readonly" port)))
                          (chmod #$output #o644)))))
    ("baz.txt" ,(plain-file "baz.txt" "this is writable"))))

(define test-service-type
   (name 'test-service)
    (list (service-extension account-service-type
                             (const (test-skeletons)))))
   (default-value (test-config))
   (description "test service for skeleton files issue")))

;; Operating system definition
  (host-name "guix.local")
  (timezone "Asia/Tehran")
  (locale "en_US.utf8")

  (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
                (target "/dev/sda")))
  (file-systems (cons (file-system
                        (device (file-system-label "my-root"))
                        (mount-point "/")
                        (type "ext4"))

  (services (cons* (service test-service-type)
--8<---------------cut here---------------end--------------->8---

running the above configuration, `~/baz.txt` is writable, but
`foo.conf` and `bar.conf` files which are located in `~/.config/test/`
are both read-only:

--8<---------------cut here---------------start------------->8---
root@guix ~# ll
-rw-r--r-- 1 root root 29 Oct 14 21:18 baz.txt

root@guix ~# ll .config/test/
-r--r--r-- 1 root root   20 Oct 14 21:18 foo.conf
-r--r--r-- 1 root root   40 Oct 14 21:18 bar.conf
--8<---------------cut here---------------end--------------->8---

is there anything that I might be missed in definition of skeleton
files? or it might be a bug in creation of skeleton files.


Reza Alizadeh Majd
PantherX Team

                 reply	other threads:[~2020-10-14 19:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

unofficial mirror of 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror guix-user/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-user guix-user/ \
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:

AGPL code for this site: git clone