help-guix
[Top][All Lists]
Advanced

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

Alternatives for defining package that install files to ~/.config/ibus/r


From: Rodrigo Morales
Subject: Alternatives for defining package that install files to ~/.config/ibus/rime
Date: Sun, 26 Mar 2023 20:21:54 +0000

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.


reply via email to

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