all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* Re: Newbie: How to define a package that install files to ~/.config?
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Castillo @ 2023-03-18  9:31 UTC (permalink / raw)
  To: help-guix

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


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

* Re: Newbie: How to define a package that install files to ~/.config?
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Castillo @ 2023-03-20  7:48 UTC (permalink / raw)
  To: Rodrigo Morales, help-guix

Hi,

Am 18.03.23 um 06:02 schrieb Rodrigo Morales:
> 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?

I just remembered there is something called guix home, which should be 
what you are looking for.
I haven't used it, so I can't give you anymore hints than
`info guix home`

Martin


^ 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

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.