https://github.com/thblt/borg-nix-shell
Build your Borg packages with Nix-Shell
https://github.com/thblt/borg-nix-shell
Last synced: about 1 year ago
JSON representation
Build your Borg packages with Nix-Shell
- Host: GitHub
- URL: https://github.com/thblt/borg-nix-shell
- Owner: thblt
- License: gpl-3.0
- Created: 2017-09-07T11:39:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-30T20:12:31.000Z (over 7 years ago)
- Last Synced: 2025-02-16T01:25:27.626Z (over 1 year ago)
- Language: Emacs Lisp
- Size: 22.5 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+TITLE: Borg-nix-shell: build Borg packages with Nix-Shell
[[https://github.com/emacscollective/borg][Borg]] is a package manager for Emacs storing packages as Git submodules. Unlike =package.el=, Borg requires that all packages be built locally. In most cases, all it takes is byte-compiling a few Emacs-Lisp files, which Borg can do in a totally transparent manner. But some packages require external build tools or libraries, which may not be available on all systems, or not easily installable.
=Borg-nix-shell= plugs into Borg to run [[https://emacsmirror.net/manual/borg/Git-variables.html#Git-variables][build-steps]] through =nix-shell=, from the [[https://nixos.org][Nix package manager]].
* Usage
Assimilate =borg-nix-shell= (or just copy its contents somewhere in your =init.el=) then:
#+BEGIN_SRC emacs-lisp
(setq borg-build-shell-command 'borg-nix-shell-build-command)
#+END_SRC
Then, for each package requiring it:
- Set =submodules.DRONE.build-nix-shell-packages= to a list of packages to pass to =nix-shell= with the =-p= argument.
- *Or* set =submodules.DRONE.build-nix-shell-file= to the path of a Nix file, which will be passed to =nix-shell= as the last positional argument.
- *Or* set =submodules.DRONE.build-nix-shell-disable= to any value to run the build-steps unmodified. This has been implemented for packages which provide Nix-aware build systems, like PDF-Tools.
If none of these variables are provided, =borg-nix-shell= adds an empty =-p= argument to =nix-shell= /unless/ the drone's work tree has a =shell.nix= or =default.nix= at its root, in which case no arguments are added and =nix-shell= should pick the correct file.
As an example, here's how I configure [[https://github.com/politza/pdf-tools][PDF Tools]]:
#+BEGIN_EXAMPLE
[submodule "pdf-tools"]
path = lib/pdf-tools
url = git@github.com:politza/pdf-tools.git
build-nix-shell-packages = gnumake automake autoconf pkgconfig libpng zlib poppler_gi
build-step = make ./server
#+END_EXAMPLE
* Configuration
There's a =borg-nix-shell-build-use-pure-shell= variable which determines if =nix-shell= should be passed the =--pure= flag. It defaults to =t=, and you really, really shouldn't change it.