summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-09-09 16:16:49 +0200
committerAlan Pearce2017-09-09 16:49:30 +0200
commit1eb55b1642a209feb1b8a245edabe3361c62cb5d (patch)
tree1cbfcec489ef53f3b55c12b9d481c602157daea4
parentf1a49dcee9df5c96ec5c261373c43c6da70701e4 (diff)
downloadnixfiles-1eb55b1642a209feb1b8a245edabe3361c62cb5d.tar.lz
nixfiles-1eb55b1642a209feb1b8a245edabe3361c62cb5d.tar.zst
nixfiles-1eb55b1642a209feb1b8a245edabe3361c62cb5d.zip
user-interface: Import Emacs setup
-rw-r--r--modules/user-interface.nix21
-rw-r--r--packages/emacs.nix166
2 files changed, 187 insertions, 0 deletions
diff --git a/modules/user-interface.nix b/modules/user-interface.nix
index ef05abbf..9d216d50 100644
--- a/modules/user-interface.nix
+++ b/modules/user-interface.nix
@@ -1,5 +1,9 @@
 { config, pkgs, ... }:
 
+let
+  pkgsUnstable = import <nixos-unstable> {};
+  # pkgsUnstable = pkgs;
+in
 { # programs.browserpass.enable = true;
   programs.info.enable = true;
 
@@ -30,6 +34,23 @@
 
   services.devmon.enable = true;
 
+  services.emacs = {
+    enable = true;
+    defaultEditor = true;
+    package = import ./emacs.nix {
+      inherit (pkgs) stdenv;
+      pkgs = pkgsUnstable;
+      emacs = pkgs.lib.overrideDerivation (pkgs.emacs.override {
+          withGTK2 = false;
+          withGTK3 = true;
+        }) (attrs: {
+          postInstall = attrs.postInstall + ''
+            rm $out/share/applications/emacs.desktop
+          '';
+        });
+    };
+  };
+
   services.redshift = {
     enable = true;
     temperature = {
diff --git a/packages/emacs.nix b/packages/emacs.nix
new file mode 100644
index 00000000..30b21c2d
--- /dev/null
+++ b/packages/emacs.nix
@@ -0,0 +1,166 @@
+{
+  pkgs,
+  emacs ? pkgs.emacs,
+  stdenv
+}:
+
+let
+  myEmacs = emacs;
+  emacsWithPackages = (pkgs.emacsPackagesNgGen myEmacs).emacsWithPackages;
+
+  elpaBuild = import <nixpkgs/pkgs/build-support/emacs/elpa.nix> {
+    inherit (pkgs) fetchurl lib stdenv texinfo;
+    emacs = myEmacs;
+  };
+
+  hook-helpers = pkgs.callPackage ({ elpaBuild, fetchurl, lib }: elpaBuild {
+    pname = "hook-helpers";
+    version = "1.1";
+    src = fetchurl {
+      url = "http://elpa.gnu.org/packages/hook-helpers-1.1.tar";
+      sha256 = "0xvabl0lfc0ijr98clsyh0bqk2fdi1ncl0knn58j2p30gn9958i5";
+    };
+    packageRequires = [];
+    meta = {
+      homepage = https://savannah.nongnu.org/projects/hook-helpers-el/;
+      license = lib.licenses.free;
+    };
+  }) {
+    inherit elpaBuild;
+    inherit (pkgs) fetchurl lib;
+  };
+
+  dired-du = pkgs.callPackage ({ elpaBuild, fetchurl, lib }: elpaBuild {
+    pname = "dired-du";
+    version = "0.5";
+    src = fetchurl {
+      url = "http://elpa.gnu.org/packages/dired-du-0.5.tar";
+      sha256 = "09yj37p2fa5f81fqrzwghjkyy2ydsf4rbkfwpn2yyvzd5nd97bpl";
+    };
+    packageRequires = [];
+    meta = {
+      homepage = https://github.com/calancha/dired-du;
+      license = lib.licenses.free;
+    };
+  }) {
+    inherit elpaBuild;
+    inherit (pkgs) fetchurl lib;
+  };
+in
+  emacsWithPackages (epkgs: (with epkgs.melpaStablePackages; [
+    diminish
+    bind-key
+    use-package
+    smartparens
+  ]) ++ (with epkgs.melpaPackages; [
+    ace-link
+    ace-window
+    add-node-modules-path
+    ag
+    auto-compile
+    avy
+    bbdb
+    beginend
+    cider
+    clj-refactor
+    clojure-mode
+    cmd-to-echo
+    command-log-mode
+    company
+    company-go
+    company-restclient
+    company-tern
+    company-web
+    counsel
+    counsel-projectile
+    crux
+    cyphejor
+    dired-narrow
+    dired-subtree
+    discover-my-major
+    dockerfile-mode
+    dtrt-indent
+    dumb-jump
+    easy-hugo
+    editorconfig
+    elisp-slime-nav
+    emmet-mode
+    ensime
+    exec-path-from-shell
+    expand-region
+    eyebrowse
+    flow-minor-mode
+    flycheck
+    flycheck-flow
+    flycheck-pos-tip
+    flycheck-vale
+    fontawesome
+    geiser
+    ggtags
+    ghq
+    git-gutter-fringe
+    git-messenger
+    git-timemachine
+    go-eldoc
+    go-mode
+    go-projectile
+    goto-chg
+    haskell-mode
+    highlight-stages
+    helpful
+    imenu-anywhere
+    indium
+    jinja2-mode
+    js2-mode
+    js2-refactor
+    json-mode
+    ledger-mode
+    lua-mode
+    magit
+    markdown-mode
+    move-text
+    multiple-cursors
+    nginx-mode
+    nix-mode
+    nix-sandbox
+    outorg
+    outshine
+    navi-mode
+    org-journal
+    page-break-lines
+    paredit
+    password-store
+    projectile
+    projectile-ripgrep
+    quickrun
+    redshank
+    relative-buffers
+    restclient
+    ripgrep
+    rjsx-mode
+    scala-mode
+    scss-mode
+    shrink-whitespace
+    slime
+    smart-tabs-mode
+    smex
+    suggest
+    swiper
+    tern
+    toml-mode
+    undo-tree
+    visual-regexp
+    volatile-highlights
+    web-mode
+    white-theme
+    wgrep-ag
+    which-key
+    yaml-mode
+  ]) ++ (with epkgs.elpaPackages; [
+    rainbow-mode
+  ]) ++ [
+    # defined above
+    hook-helpers
+    dired-du
+    # From main packages set
+  ])