Advertisement
WhittlesJr

Untitled

Aug 23rd, 2017
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.81 KB | None | 0 0
  1. { stdenv, fetchFromGitHub, emacs }:
  2.  
  3. let
  4.   spacemacsVersion = "v0.200.9";
  5.   spacemacsFuncsVersion = "0.2";
  6.   version = "${spacemacsFuncsVersion}";
  7.  
  8. in stdenv.mkDerivation {
  9.   name = "spacemacs-funcs-${version}";
  10.  
  11.   srcs = [
  12.     (fetchFromGitHub {
  13.       owner = "syl20bnr";
  14.       repo = "spacemacs";
  15.       rev = "${spacemacsVersion}";
  16.       sha256 = "0ks39xricv1b3qkdhghwj2gzqn0ljx9w15l4i9k0hdc4i2s96i6i";
  17.      })
  18.     (fetchFromGitHub {
  19.       owner = "WhittlesJr";
  20.       repo = "spacemacs-functions";
  21.       rev = "${spacemacsFuncsVersion}";
  22.       sha256 = "1zf1bp546a8mwzyjpmzqkm8wlhdw2mi47720vp3lk7yml2mlfqqd";
  23.      })
  24.   ];
  25.  
  26.   sourceRoot = "spacemacs-functions-${spacemacsFuncsVersion}-src";
  27.   buildInputs = [ emacs ];
  28.  
  29.   # The following is ported from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=emacs-spacemacs-funcs.
  30.   buildPhase = ''
  31.     emacs -q --no-splash -batch -L . -f batch-byte-compile spacemacs-funcs.el
  32.  
  33.     cd ../spacemacs-${spacemacsVersion}-src
  34.     shopt -s globstar
  35.     shopt -s extglob
  36.     emacs -q --no-splash -batch -L . -f batch-byte-compile {core,layers}/**/*funcs*.el
  37.   '';
  38.  
  39.   preInstall = ''
  40.     install -d $out/share/emacs/site-lisp
  41.   '';
  42.  
  43.   installPhase = ''
  44.     dest="$out/share/emacs/site-lisp"
  45.  
  46.     install -m644 spacemacs-funcs.el{c,} $dest
  47.  
  48.     cd ../spacemacs-${spacemacsVersion}-src
  49.     shopt -s globstar
  50.     shopt -s extglob
  51.     find {core,layers}/ -name *funcs.el* -exec bash -c 'file=''${1#./}; install -m644 "$file" "$dest''${file//\//_}"' _ '{}' \;
  52.   '';
  53.  
  54.   meta = {
  55.     description = "Useful functions from the Spacemacs project";
  56.     homepage = https://github.com/WhittlesJr/spacemacs-functions;
  57.     license = stdenv.lib.licenses.gpl3;
  58.     platforms = stdenv.lib.platforms.all;
  59.     maintainers = [ stdenv.lib.maintainers.WhittlesJr ];
  60.   };
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement