Skip to content

Instantly share code, notes, and snippets.

@Profpatsch
Last active August 24, 2020 20:21
Show Gist options
  • Save Profpatsch/ddff34d495f57b505a6b to your computer and use it in GitHub Desktop.
Save Profpatsch/ddff34d495f57b505a6b to your computer and use it in GitHub Desktop.

Spacemacs nix(os) mode

Problems:

  • Layers need system programs
  • Spacemacs does its own deterministic (but bad) package management
  • emacsWithPackages already exists in nixpkgs

API

Nixpkgs

Package spacemacs. Possible ways to do it:

  • Takes a list of layers
  • spacemacsWithLayers

Nixos module

  • Optional
<something>.spacemacs.enable = true;
spacemacs.layers = [ layer layer layer ];

Implementation

Spacemacs is normally cloned into user config dir. That can be stor-y-fied with a fetchgit. From then on all update functionality is gone (patch that out?).

Configuration

Parts of the .spacemacs is done by nix. How to load that and the user config? What if the user wants additional layers? How to manage private layers?

Packages

The Spacemacs packaging is simplistic, so the nixpkgs packaging should be used.

Layers

Layers consist of a fixed directory structure. They contain

  • elisp packages
  • implicit system packages (probably dependent on some variables)
  • init functions (probably with side-effects?)

The init functions may be a problem.

Naive way
Manually type in packages in the nix expr
Automatic
Extract package names and init from the layer definition
@CestDiego
Copy link

I think it is a little bit more complicated than this. There is no need to have an extra package...just using a wrapper is enough I guess. Worst thing is because we can't let NixOS modify and clone repos in our home dir (can we?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment