stockholm/jeschli/2configs/emacs.nix

122 lines
3.6 KiB
Nix
Raw Normal View History

2018-03-20 16:38:26 +00:00
{ config, pkgs, ... }:
let
2018-03-21 07:59:35 +00:00
packageRepos = ''
(require 'package) ;; You might already have this line
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(url (concat (if no-ssl "http" "https") "://melpa.org/packages/")))
(add-to-list 'package-archives (cons "melpa" url) t)
(add-to-list 'package-archives
'("org" . "http://orgmode.org/elpa/") t)
)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
'';
2018-11-02 08:43:08 +00:00
2018-03-21 07:59:35 +00:00
evilMode = ''
;; Evil Mode
(require 'evil)
(evil-mode 1)
2018-07-31 14:32:39 +00:00
;; (require 'evil-org)
;; (add-hook 'org-mode-hook 'evil-org-mode)
;; (evil-org-set-key-theme '(navigation insert textobjects additional calendar))
;; (require 'evil-org-agenda)
;; (evil-org-agenda-set-keys)
2018-03-21 07:59:35 +00:00
'';
2018-11-02 08:41:47 +00:00
goMode = ''
(add-to-list 'exec-path "~/go/bin")
(add-hook 'go-mode-hook
(lambda ()
(setq-default)
(setq tab-width 2)
(setq standard-indent 2)
(setq indent-tabs-mode nil)))
'';
2018-10-26 09:53:19 +00:00
ido = ''
(require 'ido)
(ido-mode t)
'';
2018-11-02 08:41:47 +00:00
2018-03-21 07:59:35 +00:00
windowCosmetics = ''
2018-07-31 14:32:39 +00:00
(menu-bar-mode -1)
2018-03-21 07:59:35 +00:00
(tool-bar-mode -1) ; Disable the button bar atop screen
(scroll-bar-mode -1) ; Disable scroll bar
2018-07-31 14:32:39 +00:00
(toggle-scroll-bar -1)
2018-03-21 07:59:35 +00:00
(setq inhibit-startup-screen t) ; Disable startup screen with graphics
(setq-default indent-tabs-mode nil) ; Use spaces instead of tabs
2018-03-26 08:15:29 +00:00
(setq default-tab-width 2) ; Two spaces is a tab
2018-03-21 07:59:35 +00:00
(setq tab-width 2) ; Four spaces is a tab
(setq visible-bell nil) ; Disable annoying visual bell graphic
(setq ring-bell-function 'ignore) ; Disable super annoying audio bell
'';
2018-11-02 08:43:08 +00:00
2018-03-22 15:19:29 +00:00
orgMode = ''
(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(global-set-key "\C-c L" 'org-insert-link-global)
(global-set-key "\C-c o" 'org-open-at-point-global)
2018-07-31 14:32:39 +00:00
(setq org-link-frame-setup '((file . find-file))) ; open link in same frame.
2018-03-22 15:19:29 +00:00
(if (boundp 'org-user-agenda-files)
(setq org-agenda-files org-user-agenda-files)
(setq org-agenda-files (quote ("~/projects/notes")))
)
'';
2018-11-02 08:41:47 +00:00
2018-07-31 14:32:39 +00:00
theme = ''
(load-theme 'monokai-alt t)
2018-07-31 14:32:39 +00:00
'';
2018-11-02 08:41:47 +00:00
2018-03-26 08:16:09 +00:00
recentFiles = ''
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
'';
2018-11-02 08:41:47 +00:00
2018-03-26 08:16:09 +00:00
dotEmacs = pkgs.writeText "dot-emacs" ''
2018-08-01 11:53:46 +00:00
${evilMode}
2018-11-02 08:41:47 +00:00
${goMode}
2018-10-26 09:53:19 +00:00
${ido}
2018-03-21 07:59:35 +00:00
${packageRepos}
2018-03-26 08:16:09 +00:00
${orgMode}
${recentFiles}
2018-07-31 14:32:39 +00:00
${theme}
2018-04-17 16:43:09 +00:00
${windowCosmetics}
2018-03-20 16:38:26 +00:00
'';
2018-03-26 08:16:09 +00:00
emacsWithCustomPackages = (pkgs.emacsPackagesNgGen pkgs.emacs).emacsWithPackages (epkgs: [
epkgs.melpaPackages.ag
2018-07-31 14:32:39 +00:00
epkgs.melpaPackages.evil
2018-03-21 07:59:35 +00:00
epkgs.melpaStablePackages.magit
epkgs.melpaPackages.nix-mode
2018-03-24 10:30:30 +00:00
epkgs.melpaPackages.go-mode
2018-10-26 10:17:28 +00:00
epkgs.melpaPackages.haskell-mode
2018-03-26 08:16:09 +00:00
epkgs.melpaPackages.google-this
2018-07-31 14:32:39 +00:00
epkgs.melpaPackages.monokai-alt-theme
epkgs.melpaPackages.rust-mode
2018-03-21 07:59:35 +00:00
]);
2018-03-20 19:16:12 +00:00
myEmacs = pkgs.writeDashBin "my-emacs" ''
2018-03-26 08:16:09 +00:00
exec ${emacsWithCustomPackages}/bin/emacs -q -l ${dotEmacs} "$@"
2018-03-20 19:16:12 +00:00
'';
myEmacsWithDaemon = pkgs.writeDashBin "my-emacs-daemon" ''
exec ${emacsWithCustomPackages}/bin/emacs -q -l ${dotEmacs} --daemon
'';
myEmacsClient = pkgs.writeDashBin "meclient" ''
exec ${emacsWithCustomPackages}/bin/emacsclient --create-frame
'';
2018-03-20 16:38:26 +00:00
in {
environment.systemPackages = [
myEmacs myEmacsWithDaemon myEmacsClient
2018-03-20 16:38:26 +00:00
];
}