 				      "~/homebrew/Cellar/llvm/HEAD/bin"
 				      "/usr/local/bin"))))
 
+;;;; Set up package tls
+
+(require 'cl)
+(require 'package)
+(require 'tls)
+
+(assert (executable-find "gnutls-cli") nil
+	"Need brew install gnutls or apt-get install gnutls-bin")
+(assert (eq 0 (call-process-shell-command "python -c \"import certifi\"")) nil
+	"Need python -m pip install --user certifi")
+
+(let ((trustfile
+       (replace-regexp-in-string
+        "\\\\" "/"
+        (replace-regexp-in-string
+         "\n" ""
+	 (shell-command-to-string "python -m certifi")))))
+  (setq tls-program
+        (list
+         (format "gnutls-cli --x509cafile %s -p %%p %%h" trustfile)))
+  (setq gnutls-trustfiles (list trustfile)))
+
+(setq tls-checktrust t)
+(setq package-archives `(("gnu" . "https://elpa.gnu.org/packages/")
+                         ("melpa" . "https://melpa.org/packages/")))
+(package-initialize)
+
+;;;;
+
 ;;;; Set up use-package - START
-
-;; TODO: Can we optimize ar-package?
-(require 'ar-package)
-(ar/package-initialize)
 
 (unless (package-installed-p 'use-package)
   (package-refresh-contents)


;;;; Init helpers - START

(use-package validate :ensure t)

;;;; Init helpers - END



;; Additional load paths.
(add-to-list 'load-path "~/.emacs.d/ar")
(add-to-list 'load-path "~/.emacs.d/local")
(add-to-list 'load-path "~/.emacs.d/external")

;; Ask shell for PATH, MANPATH, and exec-path and update Emacs environment.
