An open API service indexing awesome lists of open source software.

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

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.