* Alternatives for defining package that install files to ~/.config/ibus/rime
@ 2023-03-26 20:21 Rodrigo Morales
2023-03-26 20:33 ` (
0 siblings, 1 reply; 2+ messages in thread
From: Rodrigo Morales @ 2023-03-26 20:21 UTC (permalink / raw)
To: help-guix
Table of Contents
_________________
1. Prologue
2. What I tried
.. 1. Looking into rime
.. 2. Looking into guix home
3. What I'm trying to do
4. The question
5. The workaround
1 Prologue
==========
On 18 Mar 2023, I created [a thread] to ask how to define a package
that installs files to `~/.config/'. I asked because I want to
download two files from [a git repo] and I want those files to exist
in `~/.config/ibus/rime' so that they are read by rime, an Input
Method Engine.
Someone [replied] that it is not possible to install files outside of
the store and recommended me to look into ibus in order to find out
whether there was an environmental variable that I could set so that I
could modify the behavior of ibus and make it search files in that
directory. Another user [recommended] me to look into `guix home' (I
already did).
[a thread]
<https://lists.gnu.org/archive/html/help-guix/2023-03/msg00144.html>
[a git repo] <https://github.com/rdrg109/wubi_8105>
[replied]
<https://lists.gnu.org/archive/html/help-guix/2023-03/msg00145.html>
[recommended]
<https://lists.gnu.org/archive/html/help-guix/2023-03/msg00172.html>
2 What I tried
==============
2.1 Looking into rime
~~~~~~~~~~~~~~~~~~~~~
I looked into the source code of rime and discovered that rime has a
compilation option which can be used to set the directory that are
searched. The compilation option is called `RIME_DATA_DIR' and in fact
is set by the guix package `ibus-rime' (see package definition below)
to the directory where the Guix package `rime-data' exists.
,----
| (define-public ibus-rime
| (package
| (name "ibus-rime")
| (version "1.5.0")
| (source
| (origin
| (method git-fetch)
| (uri (git-reference
| (url "https://github.com/rime/ibus-rime")
| (commit version)))
| (file-name (git-file-name name version))
| (sha256
| (base32
"1vl3m6ydf7mvmalpdqqmrnnmqdi6l8yyac3bv19pp8a5q3qhkwlg"))))
| (build-system cmake-build-system)
| (arguments
| `(#:tests? #f ; no tests
| #:configure-flags
| (list (string-append "-DRIME_DATA_DIR="
| (assoc-ref %build-inputs "rime-data")
| "/share/rime-data"))
| #:phases
| (modify-phases %standard-phases
| (add-after 'unpack 'patch-source
| (lambda _
| (substitute* "CMakeLists.txt"
| (("DESTINATION....RIME_DATA_DIR..")
| "DESTINATION \"${CMAKE_INSTALL_DATADIR}/rime-data\""))
| #t)))))
| (inputs
| (list gdk-pixbuf
| glib
| ibus
| libnotify
| librime
| rime-data))
| (native-inputs
| `(("cmake" ,cmake-minimal)
| ("pkg-config" ,pkg-config)))
| (home-page "https://rime.im/")
| (synopsis "Rime Input Method Engine for IBus")
| (description "@dfn{ibus-rime} provides the Rime input method engine
for
| IBus. Rime is a lightweight, extensible input method engine supporting
| various input schemas including glyph-based input methods,
romanization-based
| input methods as well as those for Chinese dialects. It has the
ability to
| compose phrases and sentences intelligently and provide very accurate
| traditional Chinese output.")
| (license gpl3)))
`----
2.2 Looking into guix home
~~~~~~~~~~~~~~~~~~~~~~~~~~
I'm currently using `guix home' to manage my dotfiles. I thought that
I could find a way to download the files from the git repo if those
files didn't existed. However, I thought that defining a Guix package
for that git repo could be of better use since that way I could share
my package with other users.
3 What I'm trying to do
=======================
Basically, I want the two files that exist in [this repository]
(i.e. `wubi86_8105.dict.yaml' and `wubi86_8105.schema.yaml') to be
read by `ibus-rime'. One way to do this would be to modify the package
definition of `ibus-rime' in order to set the value of
`RIME_DATA_DIR'. I don't want to do this, because that would imply
maintaining a package definition and to me, it is not a solution that
scales well.
To me, a solution that scales better is to define a Guix package for
that repository and find a way that Guix copies those files to
`~/.config/ibus/rime' which leads us to the same question I posted on
18 Mar 2023.
[this repository] <https://github.com/rdrg109/wubi_8105/>
4 The question
==============
How to define a Guix package that install files to ~/.config?
5 The workaround
================
If nobody proposes an alternative and I don't find one, I guess I will
make a Guix package that download those two files and save it in a
location (which wouldn't work by itself) and then use `guix home' to
download that package and create symlinks from `~/.config/ibus/rime'
to the directory where those files were downloaded whenever I execute
`guix home reconfigure'. This is a hacky way and I'd rather I used a
more simpler way.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Alternatives for defining package that install files to ~/.config/ibus/rime
2023-03-26 20:21 Alternatives for defining package that install files to ~/.config/ibus/rime Rodrigo Morales
@ 2023-03-26 20:33 ` (
0 siblings, 0 replies; 2+ messages in thread
From: ( @ 2023-03-26 20:33 UTC (permalink / raw)
To: Rodrigo Morales, help-guix
[-- Attachment #1: Type: text/plain, Size: 2515 bytes --]
Hi Rodrigo,
To be clear, modifying RIME_DATA_DIR will not require a commitment to maintaining
the package; Guix doesn't have package maintainers. What you're doing with the
attached package seems like the best possible way. I've done a small review of
it so you don't have to revise it that much if/after you send it in to be added.
On Sun Mar 26, 2023 at 9:21 PM BST, Rodrigo Morales wrote:
> ,----
> | (arguments
> | `(#:tests? #f ; no tests
> | #:configure-flags
> | (list (string-append "-DRIME_DATA_DIR="
> | (assoc-ref %build-inputs "rime-data")
> | "/share/rime-data"))
> | #:phases
> | (modify-phases %standard-phases
> | (add-after 'unpack 'patch-source
> | (lambda _
> | (substitute* "CMakeLists.txt"
> | (("DESTINATION....RIME_DATA_DIR..")
> | "DESTINATION \"${CMAKE_INSTALL_DATADIR}/rime-data\""))
> | #t)))))
If the RIME_DATA_DIR here is a use of the variable changed with -D above,
surely you don't need MODIFY-PHASES? (Also: don't put a #t here, and use
the gexp-style for ARGUMENTS; %OUTPUT, %OUTPUTS, and %BUILD-INPUTS are all
deprecated:
(arguments
(list #:tests? #f ;no tests
#:configure-flags
#~(list (string-append "-DRIME_DATA_DIR="
#$(this-package-input "rime-data")
"/share/rime-data"))
…))
> | (inputs
> | (list gdk-pixbuf
> | glib
> | ibus
> | libnotify
> | librime
> | rime-data))
> | (native-inputs
> | `(("cmake" ,cmake-minimal)
> | ("pkg-config" ,pkg-config)))
Make sure to use the new inputs style (just a LIST with packages, like in INPUTS).
> | (description "@dfn{ibus-rime} provides the Rime input method engine
> for
> | IBus. Rime is a lightweight, extensible input method engine supporting
> | various input schemas including glyph-based input methods,
> romanization-based
> | input methods as well as those for Chinese dialects. It has the
> ability to
> | compose phrases and sentences intelligently and provide very accurate
> | traditional Chinese output.")
> | (license gpl3)))
By the way, this description uses too much marketing-speak IMO.
-- (
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-26 20:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-26 20:21 Alternatives for defining package that install files to ~/.config/ibus/rime Rodrigo Morales
2023-03-26 20:33 ` (
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.