Commit 55387543987b

Vincent Demeester <vincent@sbr.pm>
2020-04-14 22:52:07
emacs: add bookmark+ and dired+
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent b3a6c5e
Changed files (3)
modules
profiles
overlays
modules/profiles/emacs.nix
@@ -56,6 +56,7 @@ in
             aggressive-indent
             async
             avy
+            pkgs.bookmark-plus
             company
             company-emoji
             company-go
@@ -66,6 +67,7 @@ in
             dired-quick-sort
             dired-narrow
             dired-rsync
+            pkgs.dired-plus
             direnv
             dockerfile-mode
             easy-kill
overlays/emacs/builder.nix
@@ -0,0 +1,34 @@
+{ stdenv
+, emacs
+, name
+, src
+, buildInputs ? []
+, patches ? []
+, preBuild ? ""
+}:
+
+stdenv.mkDerivation {
+  inherit name src patches;
+  unpackCmd = ''
+    test -f "${src}" && mkdir el && cp -p ${src} el/${name}
+  '';
+  buildInputs = [ emacs ] ++ buildInputs;
+  buildPhase = ''
+    ${preBuild}
+    ARGS=$(find ${stdenv.lib.concatStrings
+                  (builtins.map (arg: arg + "/share/emacs/site-lisp ") buildInputs)} \
+                 -type d -exec echo -L {} \;)
+    mkdir $out
+    export HOME=$out
+    ${emacs}/bin/emacs -Q -nw -L . $ARGS --batch -f batch-byte-compile *.el
+  '';
+  installPhase = ''
+    mkdir -p $out/share/emacs/site-lisp
+    install *.el* $out/share/emacs/site-lisp
+  '';
+  meta = {
+    description = "Emacs projects from the Internet that just compile .el files";
+    homepage = http://www.emacswiki.org;
+    platforms = stdenv.lib.platforms.all;
+  };
+}
overlays/sbr.nix
@@ -1,5 +1,8 @@
 self: super:
-{
+let
+  compileEmacsFiles = super.callPackage ./emacs/builder.nix;
+in
+rec {
   scripts = import ../pkgs/scripts {
     inherit (self) stdenv;
   };
@@ -9,18 +12,41 @@ self: super:
   vscodeliveshare = import ../pkgs/vscodeliveshare {
     inherit (self) stdenv vscode-utils autoPatchelfHook xorg gnome3 utillinux openssl icu zlib curl lttng-ust libsecret libkrb5 gcc libunwind binutils;
   };
-  emacs27 = (self.emacs.override { srcRepo = true; }).overrideAttrs(old: {
-    name = "emacs-dev";
-    version = "27.0.99";
+
+  emacs27 = (self.emacs.override { srcRepo = true; }).overrideAttrs (
+    old: {
+      name = "emacs-dev";
+      version = "27.0.99";
+      src = super.fetchFromGitHub {
+        owner = "emacs-mirror";
+        repo = "emacs";
+        rev = "emacs-27.0.90";
+        sha256 = "13n82lxbhmkcmlzbh0nml8ydxyfvz8g7wsdq7nszlwmq914gb5nk";
+      };
+      buildInputs = old.buildInputs ++ [ super.jansson ];
+      patches = [
+        ./patches/clean-env.patch
+      ];
+    }
+  );
+
+  bookmark-plus = compileEmacsFiles {
+    name = "bookmark-plus";
     src = super.fetchFromGitHub {
-      owner = "emacs-mirror";
-      repo = "emacs";
-      rev = "emacs-27.0.90";
-      sha256 = "13n82lxbhmkcmlzbh0nml8ydxyfvz8g7wsdq7nszlwmq914gb5nk";
+      owner = "emacsmirror";
+      repo = "bookmark-plus";
+      rev = "b6a71e8d153ae8b7bc9afed1cf7659765cfc1b0e";
+      sha256 = "1nj9dci6wgwc531vigirx70g3nsw33bsh6ni3bq4dl0x1s4zy6gz";
     };
-    buildInputs = old.buildInputs ++ [ super.jansson ];
-    patches = [
-      ./patches/clean-env.patch
-    ];
-  });
+  };
+  dired-plus = compileEmacsFiles {
+    name = "dired-plus";
+    src = super.fetchFromGitHub {
+      owner = "emacsmirror";
+      repo = "dired-plus";
+      rev = "b51974b84b861592c3519117f3f51ee557ca01ba";
+      sha256 = "0s59yd0axnja1zxc8snx013flf0f76n546i5ix5p0ngcbbhmm5kb";
+    };
+  };
+
 }