home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

builder.nix (857B)


      1 { stdenv
      2 , lib
      3 , emacs
      4 , name
      5 , src
      6 , buildInputs ? [ ]
      7 , patches ? [ ]
      8 , preBuild ? ""
      9 }:
     10 
     11 stdenv.mkDerivation {
     12   inherit name src patches;
     13   unpackCmd = ''
     14     test -f "${src}" && mkdir el && cp -p ${src} el/${name}
     15   '';
     16   buildInputs = [ emacs ] ++ buildInputs;
     17   buildPhase = ''
     18     ${preBuild}
     19     ARGS=$(find ${lib.concatStrings (builtins.map (arg: arg + "/share/emacs/site-lisp ") buildInputs)} \
     20                  -type d -exec echo -L {} \;)
     21     mkdir $out
     22     export HOME=$out
     23     ${emacs}/bin/emacs -Q -nw -L . $ARGS --batch -f batch-byte-compile *.el
     24   '';
     25   installPhase = ''
     26     mkdir -p $out/share/emacs/site-lisp
     27     install *.el* $out/share/emacs/site-lisp
     28   '';
     29   meta = {
     30     description = "Emacs projects from the Internet that just compile .el files";
     31     homepage = http://www.emacswiki.org;
     32     platforms = lib.platforms.all;
     33   };
     34 }