* home-files-service-type file permissions @ 2021-11-02 11:31 phodina via 2021-11-03 7:24 ` Andrew Tropin 0 siblings, 1 reply; 4+ messages in thread From: phodina via @ 2021-11-02 11:31 UTC (permalink / raw) To: andrew@trop.in, help-guix 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/wallpaper-change.sh" ,(local-file "config/sway/wallpaper-change.sh")))) 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? Or do I have to patch it in order to keep the permissions? Petr ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: home-files-service-type file permissions 2021-11-02 11:31 home-files-service-type file permissions phodina via @ 2021-11-03 7:24 ` Andrew Tropin 2021-11-08 6:44 ` phodina 0 siblings, 1 reply; 4+ messages in thread From: Andrew Tropin @ 2021-11-03 7:24 UTC (permalink / raw) To: phodina, help-guix [-- Attachment #1: Type: text/plain, Size: 1935 bytes --] On 2021-11-02 11:31, phodina@protonmail.com 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/wallpaper-change.sh" ,(local-file "config/sway/wallpaper-change.sh")))) > > 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. http://guix.gnu.org/en/manual/devel/en/guix.html#index-local_002dfile 1. Use program-file http://guix.gnu.org/en/manual/devel/en/guix.html#index-program_002dfile For example I do it for generating screenshot scripts: https://git.sr.ht/~abcdw/rde/tree/master/item/rde/features/wm.scm#L188 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 #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: home-files-service-type file permissions 2021-11-03 7:24 ` Andrew Tropin @ 2021-11-08 6:44 ` phodina 2021-11-08 8:42 ` Andrew Tropin 0 siblings, 1 reply; 4+ messages in thread From: phodina @ 2021-11-08 6:44 UTC (permalink / raw) To: Andrew Tropin; +Cc: help-guix Hi Andrew, On Wednesday, November 3rd, 2021 at 8:24 AM, Andrew Tropin <andrew@trop.in> wrote: > On 2021-11-02 11:31, phodina@protonmail.com 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/wallpaper-change.sh" ,(local-file "config/sway/wallpaper-change.sh")))) > > > > 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. Thanks, I've now looked more at the implementation and spend time understanding the differences between local-file, plain-file, computed-file, program-file. > > 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) > Nice and simple solution. > The quote from documentation: > > > if file designates a flat file and recursive? is true, its contents > > > > are added, and its permission bits are kept. > > http://guix.gnu.org/en/manual/devel/en/guix.html#index-local_002dfile > > 1. Use program-file > > http://guix.gnu.org/en/manual/devel/en/guix.html#index-program_002dfile > > For example I do it for generating screenshot scripts: > > https://git.sr.ht/~abcdw/rde/tree/master/item/rde/features/wm.scm#L188 Thanks for this example! This is what I've been looking for. > 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. > > -- This is also super useful as it allows to do what's needed to the file. > > Best regards, > > Andrew Tropin ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: home-files-service-type file permissions 2021-11-08 6:44 ` phodina @ 2021-11-08 8:42 ` Andrew Tropin 0 siblings, 0 replies; 4+ messages in thread From: Andrew Tropin @ 2021-11-08 8:42 UTC (permalink / raw) To: phodina; +Cc: help-guix [-- Attachment #1: Type: text/plain, Size: 2752 bytes --] On 2021-11-08 06:44, phodina wrote: > Hi Andrew, > > On Wednesday, November 3rd, 2021 at 8:24 AM, Andrew Tropin <andrew@trop.in> wrote: > >> On 2021-11-02 11:31, phodina@protonmail.com 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/wallpaper-change.sh" ,(local-file "config/sway/wallpaper-change.sh")))) >> > >> > 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. > > Thanks, I've now looked more at the implementation and spend time understanding the differences between local-file, plain-file, computed-file, program-file. >> >> 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) >> > > Nice and simple solution. > >> The quote from documentation: >> >> > if file designates a flat file and recursive? is true, its contents >> > >> > are added, and its permission bits are kept. >> >> http://guix.gnu.org/en/manual/devel/en/guix.html#index-local_002dfile >> >> 1. Use program-file >> >> http://guix.gnu.org/en/manual/devel/en/guix.html#index-program_002dfile >> >> For example I do it for generating screenshot scripts: >> >> https://git.sr.ht/~abcdw/rde/tree/master/item/rde/features/wm.scm#L188 > > Thanks for this example! This is what I've been looking for. > >> 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. >> >> -- > > This is also super useful as it allows to do what's needed to the file. > >> >> Best regards, >> >> Andrew Tropin Sure, glad to help :) -- Best regards, Andrew Tropin [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 832 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-08 8:51 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-11-02 11:31 home-files-service-type file permissions phodina via 2021-11-03 7:24 ` Andrew Tropin 2021-11-08 6:44 ` phodina 2021-11-08 8:42 ` Andrew Tropin
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).