diff --git a/init.el b/init.el index e773b4f..76a7dc6 100644 --- a/init.el +++ b/init.el @@ -264,22 +264,44 @@ If the current window occupies the whole frame, split it." ;; straight.el: the better package manager? ;; minified bootstrap (split lines if you want) (or not) -;; (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) (setq straight-use-package-by-default t) +(defun straight-bootstrap () + "bootstrap the `straight' package manager." + (defvar bootstrap-version) + (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) + (straight-use-package 'use-package) + (setq straight-use-package-by-default t)) ;; actually, use elpaca instead ;; (require 'elpaca-bootstrap) +(defun elpaca-bootstrap () + "Bootstrap the `elpaca' package manager." + (setq elpaca-bootstrap-file (expand-file-name "elpaca-bootstrap.el" + user-emacs-directory)) + (unless (file-exists-p elpaca-bootstrap-file) + (with-current-buffer + (pop-to-buffer + (url-retrieve-synchronously "https://raw.githubusercontent.com/progfolio/elpaca/master/README.md")) + (re-search-forward (rx "### Installer\n")) + (let ((start (1+ (re-search-forward "```emacs-lisp"))) + (end (- (re-search-forward "\n```") 3))) + (write-region start end elpaca-bootstrap-file)))) + (load-file elpaca-bootstrap-file)) -(setq elpaca-bootstrap-file (expand-file-name "elpaca-bootstrap.el" - user-emacs-directory)) -(unless (file-exists-p elpaca-bootstrap-file) - (with-current-buffer - (pop-to-buffer - (url-retrieve-synchronously "https://raw.githubusercontent.com/progfolio/elpaca/master/README.md")) - (re-search-forward (rx "### Installer\n")) - (let ((start (1+ (re-search-forward "```emacs-lisp"))) - (end (- (re-search-forward "\n```") 3))) - (write-region start end elpaca-bootstrap-file)))) -(load-file elpaca-bootstrap-file) +(defun nix-bootstrap () + "placeholder function. Ideally, load nix packages" + (message "you never set up nix packages, baka!")) + +(if (executable-find "home-manager") + (nix-bootstrap) + (if (eq system-type 'windows-nt) + (straight-bootstrap) + (elpaca-bootstrap))) + +(fset #'use-package--orig #'use-package) +(defmacro use-package (&rest args) + "re-definition of use-package to replace the downloader depending on system" + (require 'dash) + `(use-package--orig ,@())) ;; see https://www.reddit.com/r/emacs/comments/1937vaz/emacs_291_on_windows_install_magit_requires_seq/?rdt=48529 ;; ;; seq version workaround