Add shortcut for opening /etc/nixos/flake.nix if present, warn otherwise

This commit is contained in:
Evie Litherland-Smith 2024-02-17 20:00:10 +00:00
parent 2bae5e2973
commit 82f720260b

View file

@ -82,6 +82,16 @@
(find-file (locate-user-emacs-file "init.el")))
(keymap-global-set "C-c w c" #'my/open-init-file)
;; NixOS flake shortcut
(defun my/open-nixos-flake ()
"Open NixOS system config flake"
(interactive)
(let ((flake "/etc/nixos/flake.nix"))
(if (file-exists-p flake)
(find-file flake)
(warn (concat flake " not found")))))
(keymap-global-set "C-c w n" #'my/open-nixos-flake)
;; Scratch buffer shortcut
(keymap-global-set "C-c w x" #'scratch-buffer)