unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* writable skeleton files in sub-directories
@ 2020-10-14 19:04 Reza Alizadeh Majd
  0 siblings, 0 replies; only message in thread
From: Reza Alizadeh Majd @ 2020-10-14 19:04 UTC (permalink / raw)
  To: help-guix

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/


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-14 19:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 19:04 writable skeleton files in sub-directories Reza Alizadeh Majd

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