Guix 打包 emacs-rime

发现Guix特别适合各种包的管理 vim,emacs,python,等等

然后需要的包都写了Guix打包

有Guix需要安装emacs-rime的可以看一下。

guix 处理这种需要动态模块的包还是挺不错的。

放好代码后直接

guix build emacs-rime && guix package -i  emacs-rime
(define-public emacs-rime
  (let ((version "0")
        (revision "1")
        (commit "daf956df30d4007f70a4495560d656e517ab69a9"))
    (package
      (name "emacs-rime")
      (version (git-version version revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/DogLooksGood/emacs-rime.git")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "0wr1ski9j7m7mwizdgxnnj61z1nqpyjp6gc7dniaac0m6svxf1rf"))))
      (build-system emacs-build-system)
      (arguments
       `(#:modules ((guix build emacs-build-system)
                    (guix build emacs-utils)
                    (guix build utils))
         #:imported-modules (,@%emacs-build-system-modules)
         #:phases
         (modify-phases %standard-phases
			(add-before 'add-source-to-load-path 'substitute-rime-module-path
				    (lambda* (#:key outputs #:allow-other-keys)
				      (chmod "rime.el" #o644)
				      (emacs-substitute-sexps "rime.el"
							      ("(defvar rime--module-path"
							       (string-append (assoc-ref outputs "out")
									      "/lib/librime-emacs.so")))
				      #t))
			(add-before 'add-source-to-load-path 'substitute-rime-data-path
				    (lambda* (#:key inputs #:allow-other-keys)
				      (chmod "rime.el" #o644)       
				      (emacs-substitute-sexps "rime.el"
							      ("(defcustom rime-share-data-dir"
							       (string-append (assoc-ref inputs "rime-data")
									      "/share/rime-data/")))
				      #t))
           (add-after 'configure 'make
             ;; Run make.
             (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
               ;; Compile the shared object file.
               (apply invoke "make" "lib" make-flags)
               ;; Move the file into /lib.
               (install-file
                "librime-emacs.so"
                (string-append (assoc-ref outputs "out") "/lib"))
               #t)))
         #:tests? #f))
      (inputs
       `(("librime" ,librime)
	 ("rime-data" ,rime-data))
       )
      (propagated-inputs
       `(("dash" ,emacs-dash))
	)
      (home-page "https://github.com/DogLooksGood/emacs-rime.git")
      (synopsis "Emacs 下的 Rime 输入法")
      (description "Emacs 下的 Rime 输入法")
      (license license:gpl3+))))

https://github.com/nniixxoossccnn/my-guix/blob/github/packages/luhux/packages/emacs-xyz.scm

2赞

也许可以加到 faq 里面

?? 哪个faq?

我指 readme 中的 faq 里面,加一项,然后在 installation 那里提一下。

感觉用guix替代Emacs自己的鶸鸡包管理应该可行(还可以顺便管理不同版本的Emacs)

我已经替代了melpa了,现在正在打包各种lsp实现和vim插件. 比起编辑器里面的弱鸡包管理器还是系统的好用

Guix实际上就是个用Scheme写的简化Nix而已,Nix管理Emacs包也是通过写*.nix文件管理的,对于Emacs来说只要写.emacs.d中的配置就行,省去了package.el的配置