help-guix
[Top][All Lists]
Advanced

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

Re: Newbie: How to define a package that install files to ~/.config?


From: Martin Castillo
Subject: Re: Newbie: How to define a package that install files to ~/.config?
Date: Sat, 18 Mar 2023 10:31:03 +0100
User-agent: K-9 Mail for Android

Am 18. März 2023 06:02:27 MEZ schrieb Rodrigo Morales 
<moralesrodrigo1100@gmail.com>:
>Table of Contents
>_________________
>
>1. What I'm trying to do
>2. What I've tried
>3. The problem
>4. The question
>
>
>Newbie: How to define a package that creates files in ~/.config?
>
>
>1 What I'm trying to do
>=======================
>
>  I want to define a package that downloads a file from a git repository
>  and puts the file under a directory in `~/.config/' (specifically,
>  `~/.config/ibus/rime/')
>
>
>2 What I've tried
>=================
>
>  I've defined a module containing the definition of a package that
>  tries to accomplish that goal. It uses `install-file' to copy the
>  downloaded files to the desired location (please see code block below)
>
>  ,----
>  | cat ~/my/packages/rime.scm
>  `----
>
>  ,----
>  | (define-module (rime)
>  |   #:use-module (guix licenses)
>  |   #:use-module (guix packages)
>  |   #:use-module (guix gexp)
>  |   #:use-module (guix build-system trivial)
>  |   #:use-module (guix git-download))
>  |
>  | (define-public rime-wubi
>  |   (package
>  |    (name "rime-wubi")
>  |    (version "1.0")
>  |    (source (origin
>  |             (method git-fetch)
>  |             (uri (git-reference
>  |                   (url "https://github.com/rime/rime-wubi";)
>  |                   (commit "f1876f08f1d4a9696395be0070c0e8e4353c44cb")))
>  |             (file-name (git-file-name name version))
>  |             (sha256
>  |              (base32
>  |               "1d9y9rqssacria9d0hla96czsqv2wkfm6z926m1x269ryv96zxvk"))))
>  |    (build-system trivial-build-system)
>  |    (arguments
>  |     (list
>  |      #:modules `((guix build utils))
>  |      #:builder
>  |      #~(begin
>  |          (use-modules (guix build utils))
>  |          (chdir (assoc-ref %build-inputs "source"))
>  |          (install-file "wubi86.dict.yaml" (string-append #$output
>"/.config/ibus/rime"))
>  |          (install-file "wubi86.schema.yaml" (string-append #$output
>"/.config/ibus/rime")))))
>  |    (synopsis "Wubi86 schema and dictionary for RIME")
>  |    (description "This package contains a dictionary and a schema
>definition for the 86
>  | version of Wubi, a shape-based input method for Chinese characters.")
>  |    (home-page "https://github.com/rime/rime-wubi";)
>  |    (license lgpl3)))
>  `----
>
>  The package is installed without no problems.
>
>  ,----
>  | export GUIX_PACKAGE_PATH="$HOME/my/packages"
>  | guix package -i rime-wubi
>  `----
>
>  ,----
>  | The following package will be installed:
>  |    rime-wubi 1.0
>  |
>  `----
>
>  ,----
>  | echo $?
>  `----
>
>  ,----
>  | 0
>  `----
>
>
>3 The problem
>=============
>
>  However, the files `wubi86.dict.yaml' and `wubi86.schema.yaml' are
>  installed in `~/.guix-profile/.config/ibus/rime' (see code block
>  below)
>
>  ,----
>  | find -L /home/rdrg/.guix-profile/.config
>  `----
>
>  ,----
>  | /home/rdrg/.guix-profile/.config
>  | /home/rdrg/.guix-profile/.config/ibus
>  | /home/rdrg/.guix-profile/.config/ibus/rime
>  | /home/rdrg/.guix-profile/.config/ibus/rime/wubi86.dict.yaml
>  | /home/rdrg/.guix-profile/.config/ibus/rime/wubi86.schema.yaml
>  `----
>
>  Those files don't appear in `~/.config/ibus/rime' (the location I want
>  them to exist in)
>
>  ,----
>  | find ~/.config/ibus/rime
>  `----
>
>  ,----
>  | /home/rdrg/.config/ibus/rime
>  | /home/rdrg/.config/ibus/rime/default.custom.yaml
>  `----
>
>
>4 The question
>==============
>
>  How to define a package that install files to any directory under
>  `~/.config/'?

Hi,

I think packages cannot install files outside the store.

Maybe you could try and see, whether ibus looks at a special environment 
variable to find configs in another directory, too. Then you could define that 
environment variable in your package and it will be added to your guix profile.

I dont know ibus, but:
Otherwise you may need to adjust the system-wide installed ibus package and add 
that configuration that you want to it.


Martin



reply via email to

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