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.

64 lines
1.9KB

  1. { sources ? import ./nix/sources.nix, pkgs ? import sources.nixpkgs { } }:
  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. };
  10. ##############################################################################
  11. # Emacs + all of the packages I need:
  12. emacsAndPackages = pkgs.callPackage ./nix/packages.nix { };
  13. ################################################################################
  14. # The actual Nix package definition:
  15. in pkgs.stdenv.mkDerivation rec {
  16. name = "emacsrc";
  17. src = ./.;
  18. phases = [ "installPhase" "fixupPhase" ];
  19. buildInputs = [
  20. emacsAndPackages # Emacs!
  21. pkgs.gitAndTools.gitFull # Needed to compile magit config
  22. pkgs.imagemagick # For image-mode and eimp-mode
  23. pkgs.wmctrl # For bin/e
  24. pkgs.netcat # For bin/e
  25. pkgs.python3 # For treemacs
  26. pkgs.graphviz # For org-roam
  27. pkgs.gnuplot # For org-mode
  28. pkgs.sqlite # For org-roam
  29. ];
  30. propagatedUserEnvPkgs = buildInputs;
  31. installPhase = with pkgs.lib;
  32. let path = concatMapStringsSep ":" (p: "${p}/bin") buildInputs;
  33. in ''
  34. mkdir -p "$out/bin" "$out/emacs.d"
  35. export path="${path}"
  36. export loadpathel="$out/emacs.d/lisp/loadpath.el"
  37. substituteAll ${src}/dot.emacs.el "$out/dot.emacs.el"
  38. cp -r ${src}/lisp ${src}/modes ${src}/snippets "$out/emacs.d/"
  39. chmod u+w "$out"/emacs.d/*
  40. cp -r "${src}/share" "$out/"
  41. chmod -R u+r "$out/share"
  42. for f in ${src}/bin/*; do
  43. substituteAll "$f" "$out/bin/$(basename "$f")"
  44. chmod 0555 "$out/bin/$(basename "$f")"
  45. done
  46. for f in $(find "$out/emacs.d" -type f -name "*.el"); do
  47. emacs -Q --quick --batch -f package-initialize \
  48. --load "$loadpathel" -f batch-byte-compile "$f"
  49. done
  50. '';
  51. }