summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init.org45
1 files changed, 25 insertions, 20 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 028efcd..0958b5b 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -58,28 +58,35 @@ the buffer to be empty.
 
 #+BEGIN_SRC emacs-lisp
 (eval-and-compile
+  (defvar nix-emacs (and (string-match "^/nix/store" invocation-directory)
+                         (string-equal emacs-build-system system-name)))
+
   (setq tls-checktrust t
         gnutls-verify-error t
-        package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
-                           ("melpa-stable" . "https://stable.melpa.org/packages/")
-                           ("melpa" . "https://melpa.org/packages/"))
-        package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")
-        package-pinned-packages '(("use-package" . melpa-stable)
-                                  ("diminish" . melpa-stable)
-                                  ("bind-key" . melpa-stable))
-        package-archive-priorities '(("melpa" . 10)
-                                     ("gnu" . 10)
-                                     ("melpa-stable" . 5)
-                                     ("marmalade" . 0))
         package-menu-async t
+        package-user-dir (concat "~/.emacs.d/packages/" emacs-version "/elpa")
         package-menu-hide-low-priority t)
+  (if nix-emacs
+      (progn (setq package-archives nil)
+             (package-initialize))
+    (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
+                             ("melpa-stable" . "https://stable.melpa.org/packages/")
+                             ("melpa" . "https://melpa.org/packages/"))
+          package-pinned-packages '(("use-package" . melpa-stable)
+                                    ("diminish" . melpa-stable)
+                                    ("bind-key" . melpa-stable))
+          package-archive-priorities '(("melpa" . 10)
+                                       ("gnu" . 10)
+                                       ("melpa-stable" . 5)
+                                       ("marmalade" . 0))))
   (when (eq system-type 'darwin)
     (with-eval-after-load "gnutls"
       (add-to-list 'gnutls-trustfiles "/etc/ssl/cert.pem")))
-  (package-initialize)
-  (unless (package-installed-p 'use-package)
-    (package-refresh-contents)
-    (package-install 'use-package)))
+  (unless nix-emacs
+    (package-initialize)
+    (unless (package-installed-p 'use-package)
+      (package-refresh-contents)
+      (package-install 'use-package))))
 (eval-when-compile (require 'use-package))
 (unless (featurep 'use-package)
   (require 'diminish)
@@ -87,7 +94,7 @@ the buffer to be empty.
   (use-package use-package
     :commands (use-package-autoload-keymap)
     :defer 5))
-(setq use-package-always-ensure t
+(setq use-package-always-ensure (not nix-emacs)
       package-enable-at-startup nil)
 #+END_SRC
 
@@ -2077,15 +2084,13 @@ really seem to use it.
 Let’s try using Scala.
 
 #+BEGIN_SRC emacs-lisp
-(use-package scala-mode
-  :pin melpa-stable)
+(use-package scala-mode)
 #+END_SRC
 
 And add ensime, an IDE-style environment.
 
 #+BEGIN_SRC emacs-lisp
-(use-package ensime
-  :pin melpa-stable)
+(use-package ensime)
 #+END_SRC
 
 ** Web development