rime / ibus-rime

【中州韻】Rime for Linux/IBus
https://rime.im
GNU General Public License v3.0
718 stars 103 forks source link

Environment variable for location of files *.dict.yaml and *.schema.yaml #159

Open rodrigomorales1 opened 1 year ago

rodrigomorales1 commented 1 year ago

The problem

Does anyone know if there's an environment variable in RIME that I can set to a directory so that RIME searches in that directory the files with extension *.dict.yaml and *.schema.yaml?

I'm asking because I have written a Guix package that installs a schema that I have defined, but it seems that in Guix packages can't copy files to the ~/.config directory (therefore, it is not possible to copy them to ~/.config/ibus/rime. A possible way to solve this problem is by making RIME lookup such files in a directory which could be possible by setting an environment variable, that way my package doesn't need to copy files to ~/.config/ibus/rime instead I'd make Guix copy them to any directory and that directory would be referenced in the environment variable.

Additional information

This is the definition of my package in Guix.

(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-8105
  (package
   (name "rime-wubi-8105")
   (version "1.0")
   (source (origin
            (method git-fetch)
            (uri (git-reference
                  (url "https://github.com/rdrg109/wubi-8105")
                  (commit "3e81f26ac6f261ad5bb361ef23bc4a7df6a088d1")))
            (file-name (git-file-name name version))
            (sha256
             (base32
              "133vf7gsicqikv4kyl1rx0d1yiblgihis1x8gm9h21k59ql8gadn"))))
   (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_8105.dict.yaml" (string-append #$output "/share/rime-data"))
         (install-file "wubi86_8105.schema.yaml" (string-append #$output "/share/rime-data")))))
   (synopsis "Wubi86 input method of standard Chinese characters for RIME")
   (description "This package contains a RIME dictionary and schema for the 86 version
of Wubi, a shape-based input method for Chinese characters. The domain
of characters are those characters from the Table of General Standard
Chinese Characters (https://www.wikidata.org/wiki/Q14941454).")
   (home-page "https://github.com/rdrg109/wubi-8105")
   (license lgpl3)))

I can install that package by executing

$ guix package -L ~/my/packages/ -i rime-wubi-8105

which result in the following directory

$ tree -a ~/.guix-profile/share/rime-data
/home/rdrg/.guix-profile/share/rime-data
├── wubi86_8105.dict.yaml
└── wubi86_8105.schema.yaml

1 directory, 2 files

However, this directory is not look up by RIME. As far as I'm concerned, the only directory that is looked up by RIME is ~/.config/ibus/rime. I wish there were a variable that I could set so that I can make RIME look up my dictionaries at /home/rdrg/.guix-profile/share/rime-data.

rodrigomorales1 commented 1 year ago

Just in case this helps, I asked this question in the GNU/Guix China Telegram group and some user mentioned the following

可以参考 nixpkgs 的打包 https://github.com/NixOS/nixpkgs/pull/224042