From 2b8d9b868044f39cfdd3d3a8291782801f51ee4b Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Tue, 26 Dec 2023 18:40:08 +0400 Subject: [PATCH] okay --- config/emacs/emacs.org | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/config/emacs/emacs.org b/config/emacs/emacs.org index 82de6a87..54c7432a 100644 --- a/config/emacs/emacs.org +++ b/config/emacs/emacs.org @@ -90,20 +90,28 @@ Should make startup faster, taken from doom-emacs (require `package) (setq package-archives `(("mepla" . "https://melpa.org/packages/") - ("org" . "https://orgmode.org/elpa/") - ("elpa" . "https://elpa.gnu.org/packages/"))) + ("org" . "https://orgmode.org/elpa/") + ("elpa" . "https://elpa.gnu.org/packages/"))) (package-initialize) - (if (executable-find "nix") - (message "skipping use-package install") - (else - (unless (package-installed-p 'use-package) - (progn - (package-refresh-contents) - (package-install 'use-package))) - )) + (defun get-distro-or-os () + "Return the Linux distribution or OS Emacs is running on." + (if (eq system-type 'darwin) + "Darwin" + (when (eq system-type 'gnu/linux) + (if (file-exists-p "/etc/os-release") + (substring (shell-command-to-string "source /etc/os-release && echo $NAME") 0 -1) + (substring (car (cdr (process-exit-code-and-output "uname" "-o"))) 0 -1))))) + + (let (os-name (get-distro-or-os)) + (if (string= os-name "NixOS") + (message "skipping use-package installation") + (unless (package-installed-p 'use-package) + (progn + (package-refresh-contents) + (package-install 'use-package))))) (require 'use-package) (setq use-package-always-ensure t) #+end_src