[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: home-files-service-type file permissions

From: Andrew Tropin
Subject: Re: home-files-service-type file permissions
Date: Wed, 03 Nov 2021 10:24:43 +0300

On 2021-11-02 11:31, wrote:

> Hi Andrew,
> Thanks for the development of Guix home. I've recently switch to it from my 
> dotfiles.
> However, there is one thing that I do not know how to set.
> When using the service home-files-service-type I encountered a situation 
> where I'm copying a script:
> (simple-service 'dotfiles
> home-files-service-type
> (list
> ...
> `("config/sway/" ,(local-file 
> "config/sway/"))))
> However, after guix home reconfigure the file has only read flags set not 
> execute. Even though the original file has execute flags.
> Is the home-files-service-type the correct service to use?
> Petr

If there is no specific home service for your use case, which generates
all necessary configs and executables for you the answer is probably
yes, using home-files-service-type directly is a way to go.

> Or do I have to patch it in order to keep the permissions?

AFAIK, local-file, mixed-text-file create non-executable files in the
store by design.

If you want to make an executable file you have at least a few options:

0. You can use recursive? flag to keep permissions.
(local-file "blabla" #:recursive? #t)

The quote from documentation:
> if file designates a flat file and recursive? is true, its contents
> are added, and its permission bits are kept.

1. Use program-file
For example I do it for generating screenshot scripts:

2. Use computed-file, which will call chmod with apropriate arguments
inside gexp.  Take a look at "empty-tree" example in the manual, you can
create a file and set apropriate permissions in the same way.

Best regards,
Andrew Tropin

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]