This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathsetup.el
41 lines (35 loc) · 1.8 KB
/
setup.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
;;; -*- lexical-binding: t; -*-
(require 'json)
(defun nix-straight-get-used-packages (init-file)
(let ((nix-straight--packages nil))
(advice-add 'straight-use-package
:override (lambda (recipe &rest r)
(let ((pkg (if (listp recipe)
(car recipe)
recipe)))
(message "[nix-straight.el] Collectiong package '%s' from recipe '%s'" pkg recipe)
(add-to-list 'nix-straight--packages pkg))))
(load init-file nil nil t)
(princ (if (null nix-straight--packages)
"[]"
(json-encode nix-straight--packages)))
nix-straight--packages))
(defun nix-straight-build-packages (init-file)
(setq straight-default-files-directive '("*" (:exclude "*.elc")))
(advice-add 'straight-use-package
:around (lambda (orig-fn &rest r)
(message " [nix-straight.el] Overriding recipe for '%s'" (car r))
(let* ((pkg (car r))
(pkg-name (symbol-name pkg))
(recipe (if (file-exists-p (straight--repos-dir pkg-name))
(list pkg :local-repo pkg-name :repo pkg-name :type 'git)
(list pkg :type 'built-in))))
(message " --> [nix-straight.el] Recipe generated: %s" recipe)
(straight-override-recipe recipe))
(apply orig-fn r)))
(load init-file nil nil t))
(advice-add 'straight--executable-find
;; straight doesn't use git in this setup
:override (lambda (name) (eq name "git")))
(provide 'setup)
;;; setup.el ends here