unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Newbie: How to define a package that install files to ~/.config?
@ 2023-03-18  5:02 Rodrigo Morales
  2023-03-18  9:31 ` Martin Castillo
  2023-03-20  7:48 ` Martin Castillo
  0 siblings, 2 replies; 3+ messages in thread
From: Rodrigo Morales @ 2023-03-18  5:02 UTC (permalink / raw)
  To: help-guix

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/'?

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-20  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-18  5:02 Newbie: How to define a package that install files to ~/.config? Rodrigo Morales
2023-03-18  9:31 ` Martin Castillo
2023-03-20  7:48 ` Martin Castillo

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).