unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Martin Castillo <castilma@uni-bremen.de>
To: help-guix@gnu.org
Subject: Re: Newbie: How to define a package that install files to ~/.config?
Date: Sat, 18 Mar 2023 10:31:03 +0100	[thread overview]
Message-ID: <4BDC1A6D-9951-4D01-A1B2-785F7A029A82@uni-bremen.de> (raw)
In-Reply-To: <CAGxMbPZ50gkRKByXgMx-asnySXGPLgTppcsjMC+VUdkKfLPgXQ@mail.gmail.com>

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	other threads:[~2023-03-18  9:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-03-20  7:48 ` Martin Castillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BDC1A6D-9951-4D01-A1B2-785F7A029A82@uni-bremen.de \
    --to=castilma@uni-bremen.de \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).