2018-01-04 11:16:35 +01:00
|
|
|
(defun nix--profile-paths ()
|
|
|
|
"Returns a list of all paths in the NIX_PROFILES environment
|
|
|
|
variable, ordered from more-specific (the user profile) to the
|
|
|
|
least specific (the system profile)"
|
|
|
|
(reverse (split-string (or (getenv "NIX_PROFILES") ""))))
|
|
|
|
|
|
|
|
;;; Extend `load-path' to search for elisp files in subdirectories of
|
|
|
|
;;; all folders in `NIX_PROFILES'
|
2015-03-07 12:03:26 +01:00
|
|
|
(setq load-path
|
2018-01-04 11:16:35 +01:00
|
|
|
(append (mapcar (lambda (x) (concat x "/share/emacs/site-lisp/"))
|
|
|
|
(nix--profile-paths))
|
2015-03-07 12:03:26 +01:00
|
|
|
load-path))
|
|
|
|
|
|
|
|
;;; Make `woman' find the man pages
|
|
|
|
(eval-after-load 'woman
|
|
|
|
'(setq woman-manpath
|
2018-01-04 11:16:35 +01:00
|
|
|
(append (mapcar (lambda (x) (concat x "/share/man/"))
|
|
|
|
(nix--profile-paths))
|
2015-03-07 12:03:26 +01:00
|
|
|
woman-manpath)))
|
|
|
|
|
2016-09-27 21:57:52 +02:00
|
|
|
;;; Make tramp work for remote NixOS machines
|
2015-03-07 12:03:26 +01:00
|
|
|
(eval-after-load 'tramp
|
2018-01-04 11:16:35 +01:00
|
|
|
;; TODO: We should also add the other `NIX_PROFILES' to this path.
|
|
|
|
;; However, these are user-specific, so we would need to discover
|
|
|
|
;; them dynamically after connecting via `tramp'
|
2015-03-07 12:03:26 +01:00
|
|
|
'(add-to-list 'tramp-remote-path "/run/current-system/sw/bin"))
|
2016-09-27 21:57:52 +02:00
|
|
|
|
|
|
|
;;; C source directory
|
|
|
|
;;;
|
|
|
|
;;; Computes the location of the C source directory from the path of
|
|
|
|
;;; the current file:
|
|
|
|
;;; from: /nix/store/<hash>-emacs-<version>/share/emacs/site-lisp/site-start.el
|
|
|
|
;;; to: /nix/store/<hash>-emacs-<version>/share/emacs/<version>/src/
|
|
|
|
(let ((emacs
|
2018-01-04 11:16:35 +01:00
|
|
|
(file-name-directory ; .../emacs/
|
|
|
|
(directory-file-name ; .../emacs/site-lisp
|
|
|
|
(file-name-directory load-file-name)))) ; .../emacs/site-lisp/
|
2016-09-27 21:57:52 +02:00
|
|
|
(version
|
|
|
|
(file-name-as-directory
|
|
|
|
(concat
|
|
|
|
(number-to-string emacs-major-version)
|
|
|
|
"."
|
|
|
|
(number-to-string emacs-minor-version))))
|
|
|
|
(src (file-name-as-directory "src")))
|
|
|
|
(setq find-function-C-source-directory (concat emacs version src)))
|