Peter's Emacs configuration files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

default.nix 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. { pkgs ? (import <nixpkgs> {}).pkgs }:
  2. let
  3. ##############################################################################
  4. # Custom build of Emacs with the settings I like:
  5. emacs = pkgs.emacs.override {
  6. withX = true;
  7. withGTK2 = false;
  8. withGTK3 = true;
  9. imagemagick = pkgs.imagemagick;
  10. };
  11. ##############################################################################
  12. # Emacs + all of the packages I need:
  13. emacsAndPackages = pkgs.callPackage ./nix/packages.nix { };
  14. in
  15. ################################################################################
  16. # The actual Nix package definition:
  17. pkgs.stdenv.mkDerivation rec {
  18. name = "emacsrc";
  19. src = ./.;
  20. phases = [ "installPhase" "fixupPhase" ];
  21. buildInputs = [ emacsAndPackages
  22. pkgs.gitAndTools.gitFull # Needed to compile magit config
  23. pkgs.imagemagick # For image-mode and eimp-mode
  24. ];
  25. propagatedUserEnvPkgs = [ emacsAndPackages ];
  26. installPhase = ''
  27. mkdir -p "$out/bin" "$out/emacs.d"
  28. export loadpathel="$out/emacs.d/lisp/loadpath.el"
  29. export emacspath="${emacsAndPackages}/bin"
  30. substituteAll ${src}/dot.emacs.el "$out/dot.emacs.el"
  31. cp -r ${src}/lisp ${src}/modes ${src}/hydras "$out/emacs.d/"
  32. chmod u+w "$out"/emacs.d/*
  33. for f in ${src}/bin/*; do
  34. substituteAll "$f" "$out/bin/$(basename "$f")"
  35. chmod 0555 "$out/bin/$(basename "$f")"
  36. done
  37. for f in $(find "$out/emacs.d" -type f -name "*.el"); do
  38. emacs -Q --quick --batch -f package-initialize \
  39. --load "$loadpathel" -f batch-byte-compile "$f"
  40. done
  41. '';
  42. }