feat(nixos): Add initial NixOS & EXWM configuration
Adds configuratio for using Emacs as a window manager, because clear that is an extremely sane thing to do.
This commit is contained in:
		
							parent
							
								
									6225c18914
								
							
						
					
					
						commit
						4e1661604d
					
				
					 3 changed files with 61 additions and 3 deletions
				
			
		
							
								
								
									
										5
									
								
								init.el
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								init.el
									
										
									
									
									
								
							|  | @ -30,6 +30,7 @@ | |||
|     dash | ||||
|     dockerfile-mode | ||||
|     erlang | ||||
|     exwm | ||||
|     flycheck | ||||
|     go-mode | ||||
|     gruber-darker-theme | ||||
|  | @ -90,11 +91,11 @@ | |||
| 
 | ||||
| ;; Load configuration that makes use of installed packages: | ||||
| 
 | ||||
| 
 | ||||
| ;; Emacs will automatically initialise all installed packages. | ||||
| ;; After initialisation, proceed to load configuration that requires packages: | ||||
| (defun load-other-settings () | ||||
|   (mapc 'require '(look-and-feel | ||||
|   (mapc 'require '(nixos | ||||
|                    look-and-feel | ||||
|                    functions | ||||
|                    settings | ||||
|                    modes | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ | |||
|  '(ns-right-command-modifier (quote meta)) | ||||
|  '(package-selected-packages | ||||
|    (quote | ||||
|     (fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) | ||||
|     (exwm which-key pandoc elnode fish-mode nix-mode yaml-mode undo-tree terraform-mode switch-window smart-mode-line rust-mode rainbow-mode rainbow-delimiters puppet-mode pkgbuild-mode password-store paredit multi-term multiple-cursors markdown-mode+ magit iy-go-to-char idle-highlight-mode hi2 helm haskell-mode gruber-darker-theme go-mode flycheck erlang dockerfile-mode confluence browse-kill-ring ag ace-jump-mode))) | ||||
|  '(require-final-newline (quote visit-save))) | ||||
| (custom-set-faces | ||||
|  ;; custom-set-faces was added by Custom. | ||||
|  |  | |||
							
								
								
									
										57
									
								
								init/nixos.el
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								init/nixos.el
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,57 @@ | |||
| ;; Configure additional settings if this is one of my NixOS machines | ||||
| ;; (i.e. if ExWM is required) | ||||
| ;; -*- lexical-binding: t; -*- | ||||
| 
 | ||||
| (require 's) | ||||
| (require 'f) | ||||
| 
 | ||||
| (defvar is-nixos | ||||
|   (let ((os-f "/etc/os-release")) | ||||
|     (s-contains? | ||||
|      "NixOS" (if (f-file? os-f) (f-read os-f))))) | ||||
| 
 | ||||
| (if is-nixos | ||||
|     (progn | ||||
|       (message "Running on NixOS, configuring ExWM.") | ||||
|       (require 'exwm) | ||||
|       (require 'exwm-config) | ||||
| 
 | ||||
|       ;; Start with one workspace (make more as needed) | ||||
|       (setq exwm-workspace-number 1) | ||||
|       ;; Make class name the buffer name | ||||
|       (add-hook 'exwm-update-class-hook | ||||
|                 (lambda () | ||||
|                   (exwm-workspace-rename-buffer exwm-class-name))) | ||||
| 
 | ||||
|       ;; 's-r': Reset | ||||
|       (exwm-input-set-key (kbd "s-r") #'exwm-reset) | ||||
|       ;; 's-w': Switch workspace | ||||
|       (exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch) | ||||
|       ;; 's-N': Switch to certain workspace | ||||
|       (dotimes (i 10) | ||||
|         (exwm-input-set-key (kbd (format "s-%d" i)) | ||||
|                             `(lambda () | ||||
|                                (interactive) | ||||
|                                (exwm-workspace-switch-create ,i)))) | ||||
| 
 | ||||
|       ;; Launch applications with completion (dmenu style!) | ||||
|       (exwm-input-set-key (kbd "s-p") #'helm-run-external-command) | ||||
| 
 | ||||
|       ;; Line-editing shortcuts | ||||
|       (exwm-input-set-simulation-keys | ||||
|        '(([?\C-b] . left) | ||||
|          ([?\C-f] . right) | ||||
|          ([?\C-p] . up) | ||||
|          ([?\C-n] . down) | ||||
|          ([?\C-a] . home) | ||||
|          ([?\C-e] . end) | ||||
|          ([?\M-v] . prior) | ||||
|          ([?\C-v] . next) | ||||
|          ([?\C-d] . delete) | ||||
|          ([?\C-k] . (S-end delete)))) | ||||
| 
 | ||||
|       ;; Enable EXWM | ||||
|       (exwm-enable) | ||||
|       (fringe-mode 1))) | ||||
| 
 | ||||
| (provide 'nixos) | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue