unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Reza Alizadeh Majd <r.majd@pantherx.org>
To: help-guix@gnu.org
Subject: writable skeleton files in sub-directories
Date: Wed, 14 Oct 2020 22:34:59 +0330
Message-ID: <20201014223459.3b7829cd@pantherx.org> (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`
extension.

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)
  `((".config/test"
     ,(computed-file "test-config-dir"
                     (with-imported-modules
                      '((guix build utils))
                      #~(begin
                          (use-modules (guix build utils))
                          (mkdir-p #$output)))))
    (".config/test/foo.conf" ,(plain-file "foo.conf" "this is readonly"))
    (".config/test/bar.conf"
     ,(computed-file "bar.conf"
                     (with-imported-modules
                      '((guix build utils))
                      #~(begin
                          (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
  (service-type
   (name 'test-service)
   (extensions
    (list (service-extension account-service-type
                             (const (test-skeletons)))))
   (default-value (test-config))
   (description "test service for skeleton files issue")))

;;
;; Operating system definition
;;
(operating-system
  (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"))
                      %base-file-systems))

  (services (cons* (service test-service-type)
                   %base-services)))
--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.


Regards, 
Reza

-- 
Reza Alizadeh Majd
PantherX Team
https://www.pantherx.org/


                 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20201014223459.3b7829cd@pantherx.org \
    --to=r.majd@pantherx.org \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

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

unofficial mirror of help-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-user/0 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/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git