emacs config, change theme, doom modeline, latex stuff

This commit is contained in:
willemml 2023-02-16 20:06:35 -08:00
parent 91637f5dea
commit e370ae3a16
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
9 changed files with 341 additions and 184 deletions

66
flake.lock generated
View file

@ -20,6 +20,21 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"locked": {
"lastModified": 1642700792,
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -41,6 +56,23 @@
"type": "github" "type": "github"
} }
}, },
"mach-nix": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"pypi-deps-db": "pypi-deps-db"
},
"locked": {
"lastModified": 0,
"narHash": "sha256-mia90VYv/YTdWNhKpvwvFW9RfbXZJSWhJ+yva6EnLE8=",
"path": "/nix/store/rzbap34038bwk7vxgz0zmh9hbgl6h6mr-source",
"type": "path"
},
"original": {
"id": "mach-nix",
"type": "indirect"
}
},
"nixos-apple-silicon": { "nixos-apple-silicon": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -63,6 +95,21 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1676300157,
"narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "545c7a31e5dedea4a6d372712a18e00ce097d462",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1675454231, "lastModified": 1675454231,
"narHash": "sha256-5rgcWq1nFWlbR3NsLqY7i/7358uhkSeMQJ/LEHk3BWA=", "narHash": "sha256-5rgcWq1nFWlbR3NsLqY7i/7358uhkSeMQJ/LEHk3BWA=",
@ -93,12 +140,29 @@
"type": "github" "type": "github"
} }
}, },
"pypi-deps-db": {
"flake": false,
"locked": {
"lastModified": 1661155889,
"narHash": "sha256-t00mBTZhmZBT4jteO6pJbU0wyRS6/ep4pKmQNeztEms=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "49c620f3de2b557c9d5c44f58a00fee59f27d1b0",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"darwin": "darwin", "darwin": "darwin",
"home-manager": "home-manager", "home-manager": "home-manager",
"mach-nix": "mach-nix",
"nixos-apple-silicon": "nixos-apple-silicon", "nixos-apple-silicon": "nixos-apple-silicon",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"nur": "nur" "nur": "nur"
} }
}, },

View file

@ -12,11 +12,12 @@
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
}; };
outputs = inputs@{ self, nixpkgs, home-manager, darwin, nixos-apple-silicon, nur, ... }: outputs = inputs@{ self, darwin, home-manager, mach-nix, nixos-apple-silicon, nixpkgs, nur, ... }:
let let
pkgsfunc = ({ system, overlays ? [ ] }: import nixpkgs pkgsfunc = ({ system, overlays ? [ ] }: import nixpkgs
{ {
inherit system overlays; inherit system;
overlays = [ (import ./overlays) ] ++ overlays;
config = { config = {
allowUnfree = true; allowUnfree = true;
packageOverrides = pkgs: { packageOverrides = pkgs: {
@ -46,7 +47,10 @@
system = "aarch64-darwin"; system = "aarch64-darwin";
pkgs = pkgsfunc { inherit system; overlays = [ (import ./overlays) ]; }; pkgs = pkgsfunc {
inherit system;
overlays = [ (import ./overlays/darwin.nix) ];
};
modules = [ modules = [
./modules/nix.nix ./modules/nix.nix
@ -76,7 +80,10 @@
nixosConfigurations.zeus-asahi = nixpkgs.lib.nixosSystem rec { nixosConfigurations.zeus-asahi = nixpkgs.lib.nixosSystem rec {
system = "aarch64-linux"; system = "aarch64-linux";
pkgs = pkgsfunc { inherit system; overlays = [ nixos-apple-silicon.overlays ]; }; pkgs = pkgsfunc {
inherit system;
overlays = [ nixos-apple-silicon.overlays ];
};
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };

View file

@ -36,87 +36,79 @@ in {
''; '';
prelude = '' prelude = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
;; Disable startup message. ;; Disable startup message.
(setq inhibit-startup-screen t (setq inhibit-startup-screen t
inhibit-startup-echo-area-message (user-login-name)) inhibit-startup-echo-area-message (user-login-name))
(setq package-archives '(("melpa" . "https://melpa.org/packages/") (setq package-archives '(("melpa" . "https://melpa.org/packages/")
("melpa-stable" . "https://stable.melpa.org/packages/") ("melpa-stable" . "https://stable.melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/"))) ("nongnu" . "https://elpa.nongnu.org/nongnu/")))
;; Empty initial scratch buffer. ;; Empty initial scratch buffer.
(setq initial-major-mode 'fundamental-mode (setq initial-major-mode 'emacs-lisp-mode
initial-scratch-message nil) initial-scratch-message nil)
(setenv "PATH" (concat "${config.home.profileDirectory}/bin:" (getenv "PATH"))) (setenv "PATH" (concat "${config.home.profileDirectory}/bin:" (getenv "PATH")))
;; Accept 'y' and 'n' rather than 'yes' and 'no'. ;; Accept 'y' and 'n' rather than 'yes' and 'no'.
(defalias 'yes-or-no-p 'y-or-n-p) (defalias 'yes-or-no-p 'y-or-n-p)
;; Typically, I only want spaces when pressing the TAB key. I also ;; Typically, I only want spaces when pressing the TAB key. I also
;; want 4 of them. ;; want 4 of them.
(setq-default indent-tabs-mode nil (setq-default indent-tabs-mode nil
tab-width 4 tab-width 4
c-basic-offset 4) c-basic-offset 4)
;; Increase emacs data read limit (default too low for LSP) ;; Increase emacs data read limit (default too low for LSP)
(setq read-process-output-max (* 1024 1024)) (setq read-process-output-max (* 1024 1024))
;; Reduce wrist pain '';
(global-set-key (kbd "M-n") "~")
(global-set-key (kbd "M-N") "`") postlude = ''
;; Stop creating backup and autosave files. ;-*-emacs-lisp-*-
(setq make-backup-files nil ;; Stop creating backup and autosave files.
auto-save-default nil) (setq make-backup-files nil
;; Always show line and column number in the mode line. auto-save-default nil)
(line-number-mode) ;; Always show line and column number in the mode line.
(column-number-mode) (line-number-mode)
;; Soft wrap lines (column-number-mode)
(visual-line-mode) ;; Soft wrap lines
;; Use one space to end sentences. (visual-line-mode)
(setq sentence-end-double-space nil) ;; Use one space to end sentences.
;; I typically want to use UTF-8. (setq sentence-end-double-space nil)
(prefer-coding-system 'utf-8) ;; I typically want to use UTF-8.
;; Enable highlighting of current line. (prefer-coding-system 'utf-8)
(global-hl-line-mode 1) ;; Enable highlighting of current line.
;; When finding file in non-existing directory, offer to create the (global-hl-line-mode 1)
;; parent directory. ;; When finding file in non-existing directory, offer to create the
(defun with-buffer-name-prompt-and-make-subdirs () ;; parent directory.
(let ((parent-directory (file-name-directory buffer-file-name))) (defun with-buffer-name-prompt-and-make-subdirs ()
(when (and (not (file-exists-p parent-directory)) (let ((parent-directory (file-name-directory buffer-file-name)))
(y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) (when (and (not (file-exists-p parent-directory))
(make-directory parent-directory t)))) (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory)))
(add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs) (make-directory parent-directory t))))
;; Bind Emacs built in completion using completion-at-point to "C-M-i" (add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs)
(global-set-key (kbd "C-M-i") 'completion-at-point) ;; Reduce wrist pain
;; Keybind to format/prettify document, uses either format-all or (global-set-key (kbd "M-n") "~")
;; lsp-mode depending on availability (global-set-key (kbd "M-N") "`")
(global-set-key (kbd "C-c C-y") 'my/format-document) ;; Keybind to format/prettify document, uses either format-all or
;; Don't warn when cannot guess python indent level ;; lsp-mode depending on availability
(setq-default python-indent-guess-indent-offset-verbose nil) (global-set-key (kbd "C-c C-y") 'my/format-document)
(defun my/define-multiple-keys (map keys) ;; Don't warn when cannot guess python indent level
"Define multiple KEYS in a keymap. (setq-default python-indent-guess-indent-offset-verbose nil)
Argument MAP keymap in which to bind the keys." ;; Disable scroll + C to zoom
(dolist (key keys nil) (global-unset-key (kbd "C-<wheel-down>"))
(define-key map (kbd (car key)) (nth 1 key)))) (global-unset-key (kbd "C-<wheel-up>"))
(defun my/customize-set-variables (variables) (load-theme 'doom-gruvbox t)
"Set multiple Customize VARIABLES at once."
(dolist (variable variables nil)
(customize-set-variable (car variable) (nth 1 variable))))
(defun my/find-file-in-folder-shortcut (folder)
"Interactively call `find-file' after using 'cd' into 'FOLDER'."
(cd (expand-file-name folder))
(call-interactively #'find-file))
(defun my/electric-mode ()
"Enable some basic features for coding."
(interactive)
(electric-pair-local-mode)
(electric-indent-local-mode))
(defun dev ()
"Shortcut to '~/dev' folder."
(interactive)
(my/find-file-in-folder-shortcut "~/dev"))
;; Disable scroll + C to zoom
(global-unset-key (kbd "C-<wheel-down>"))
(global-unset-key (kbd "C-<wheel-up>"))
''; '';
usePackage = { usePackage = {
all-the-icons = {
enable = true;
extraConfig = ":if (display-graphic-p)";
};
all-the-icons-dired = {
enable = true;
hook = [ "(dired-mode . all-the-icons-dired-mode)" ];
};
calibredb = { calibredb = {
enable = true; enable = true;
config = '' config = ''
@ -131,9 +123,7 @@ Argument MAP keymap in which to bind the keys."
cdlatex = { cdlatex = {
enable = true; enable = true;
after = [ "latex" ]; after = [ "latex" ];
init = '' hook = [ "(LaTeX-mode . turn-on-cdlatex)" ];
(add-hook 'LaTeX-mode-hook #'turn-on-cdlatex)
'';
}; };
citeproc.enable = true; citeproc.enable = true;
@ -185,6 +175,16 @@ Argument MAP keymap in which to bind the keys."
}; };
}; };
doom-modeline = {
enable = true;
hook = [ "(after-init . doom-modeline-mode)" ];
config = ''
(setq doom-modeline-icon t)
'';
};
doom-themes.enable = true;
edit-indirect.enable = true; edit-indirect.enable = true;
editorconfig = { editorconfig = {
@ -210,7 +210,6 @@ Argument MAP keymap in which to bind the keys."
config = '' config = ''
(setq-default format-all-formatters format-all-default-formatters) (setq-default format-all-formatters format-all-default-formatters)
''; '';
bindLocal.c-mode-map = { "C-c C-y" = "format-all-buffer"; };
}; };
gnuplot = { gnuplot = {
@ -236,10 +235,10 @@ Argument MAP keymap in which to bind the keys."
ivy = { ivy = {
enable = true; enable = true;
command = [ "ivy-mode" ]; command = [ "ivy-mode" ];
extraConfig = '' init = ''
:custom (setq ivy-use-virtual-buffers t)
(ivy-use-virtual-buffers t) (setq ivy-use-selectable-prompt t)
(enable-recursive-minibuffers t) (setq enable-recursive-minibuffers t)
''; '';
bind = { "C-c C-r" = "ivy-resume"; }; bind = { "C-c C-r" = "ivy-resume"; };
hook = [ "(after-init . ivy-mode)" ]; hook = [ "(after-init . ivy-mode)" ];
@ -247,10 +246,12 @@ Argument MAP keymap in which to bind the keys."
ivy-bibtex = { ivy-bibtex = {
enable = true; enable = true;
after = [ "ivy" ];
init = '' init = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which ;; ivy-bibtex requires ivy's `ivy--regex-ignore-order` regex builder, which
;; ignores the order of regexp tokens when searching for matching candidates. ;; ignores the order of regexp tokens when searching for matching candidates.
(require 'ivy-bibtex)
(setq ivy-re-builders-alist (setq ivy-re-builders-alist
'((ivy-bibtex . ivy--regex-ignore-order) '((ivy-bibtex . ivy--regex-ignore-order)
(t . ivy--regex-plus))) (t . ivy--regex-plus)))
@ -514,7 +515,7 @@ Argument MAP keymap in which to bind the keys."
(quote (quote
((vm . vm-visit-folder) ((vm . vm-visit-folder)
(vm-imap . vm-visit-imap-folder) (vm-imap . vm-visit-imap-folder)
(gnus. gnus) (gnus . gnus)
(file . find-file) (file . find-file)
(wl . wl))) (wl . wl)))
)) ))
@ -526,7 +527,13 @@ Argument MAP keymap in which to bind the keys."
(if arg (if arg
(org-open-at-point) (org-open-at-point)
(my/org-force-open-current-window))) (my/org-force-open-current-window)))
(defun krofna-hack ()
(when (looking-back (rx "$ "))
(save-excursion
(backward-char 1)
(org-toggle-latex-fragment))))
''; '';
init = '' init = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
(require 'oc) (require 'oc)
@ -534,43 +541,11 @@ Argument MAP keymap in which to bind the keys."
(require 'oc-csl) (require 'oc-csl)
(require 'oc-natbib) (require 'oc-natbib)
(require 'ox-latex) (require 'ox-latex)
(setq org-src-window-setup 'current-window)
(setq org-confirm-babel-evaluate nil) (add-hook 'org-mode-hook
(setq org-src-fontify-natively t) (lambda ()
(setq org-src-tab-acts-natively t) (add-hook 'post-self-insert-hook #'krofna-hack 'append 'local)))
(setq org-src-preserve-indentation t)
(setq org-export-with-tags nil)
(setq org-publish-project-alist
'(("root"
:base-directory "${config.home.sessionVariables.ORGDIR}"
:publishing-function org-html-publish-to-html
:publishing-directory (expand-file-name "~/public_html")
:section-numbers nil
:with-author nil
:with-creator t
:with-toc t
:time-stamp-file nil)))
;; Configure HTML export
(setq org-html-validation-link nil)
(setq org-html-head-include-scripts nil)
(setq org-html-head-include-default-style nil)
(setq org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />")
(setq org-html-section)
(setq bibtex-completion-notes-path "${config.home.sessionVariables.ORGDIR}/notes.org")
(setq org-cite-global-bibliography '("${config.home.sessionVariables.ORGDIR}/zotero.bib"))
(setq org-cite-export-processors '((t basic)))
(setq org-cite-follow-processor 'ivy-bibtex-org-cite-follow)
(setq org-cite-csl-styles-dir "~/Zotero/styles")
(setq bibtex-completion-pdf-open-function
(lambda (fpath)
(call-process "open" nil 0 nil "-a" "/Applications/Preview.app" fpath)))
(defun org-export-latex-no-toc (depth)
(when depth
(format "%% Org-mode is exporting headings to %s levels.\n"
depth)))
(setq org-export-latex-format-toc-function 'org-export-latex-no-toc)
(setq org-latex-pdf-process
'("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
(add-to-list 'exec-path "${config.home.profileDirectory}/bin") (add-to-list 'exec-path "${config.home.profileDirectory}/bin")
(add-to-list 'org-latex-classes (add-to-list 'org-latex-classes
'("apa6" '("apa6"
@ -588,11 +563,65 @@ Argument MAP keymap in which to bind the keys."
("\\subsubsection{%s}" . "\\subsubsection*{%s}") ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}") ("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
(plist-put org-format-latex-options :scale 3)
(setq org-agenda-block-separator ?)
(setq org-agenda-current-time-string " now ")
(setq org-agenda-files '("${config.home.sessionVariables.ORGDIR}" "${config.home.sessionVariables.UBCDIR}")) (setq org-agenda-files '("${config.home.sessionVariables.ORGDIR}" "${config.home.sessionVariables.UBCDIR}"))
(setq org-agenda-tags-column 0)
(setq org-auto-align-tags nil)
(setq org-catch-invisible-edits 'show-and-error)
(setq org-cite-csl-styles-dir "~/Zotero/styles")
(setq org-cite-export-processors '((t basic)))
(setq org-cite-global-bibliography '("${config.home.sessionVariables.ORGDIR}/zotero.bib"))
(setq org-confirm-babel-evaluate nil)
(setq org-ellipsis "")
(setq org-export-with-tags nil)
(setq org-hide-emphasis-markers t)
(setq org-highlight-latex-and-related '(latex))
(setq org-html-head "<link rel=\"stylesheet\" href=\"https://cdn.simplecss.org/simple.min.css\" />")
(setq org-html-head-include-default-style nil)
(setq org-html-head-include-scripts nil)
(setq org-html-validation-link nil)
(setq org-image-actual-width 300)
(setq org-insert-heading-respect-content t)
(setq org-latex-pdf-process '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
(setq org-pretty-entities t)
(setq org-preview-latex-default-process 'dvisvgm)
(setq org-special-ctrl-a/e t)
(setq org-src-fontify-natively t)
(setq org-src-preserve-indentation t)
(setq org-src-tab-acts-natively t)
(setq org-src-window-setup 'current-window)
(setq org-tags-column 0)
(setq org-agenda-time-grid
'((daily today require-timed)
(800 1000 1200 1400 1600 1800 2000)
" " ""))
(setq org-publish-project-alist
'(("html"
:base-directory "${config.home.sessionVariables.ORGDIR}"
:base-extension "org"
:htmlized-source t
:recursive t
:publishing-directory "${config.home.sessionVariables.ORGDIR}/exports"
:publishing-function org-html-publish-to-html)
("pdf"
:base-directory "${config.home.sessionVariables.ORGDIR}"
:base-extension "org"
:recursive t
:publishing-directory "${config.home.sessionVariables.ORGDIR}/exports"
:publishing-function org-latex-publish-to-pdf)
("all" :components ("html" "pdf"))
))
''; '';
hook = [ hook = [
"(org-babel-after-execute . org-redisplay-inline-images)" "(org-babel-after-execute . org-redisplay-inline-images)"
"(org-mode . visual-line-mode)" "(org-mode . visual-line-mode)"
"(org-mode . org-cdlatex-mode)"
]; ];
bind = { bind = {
"C-c n c" = "org-id-get-create"; "C-c n c" = "org-id-get-create";
@ -605,24 +634,45 @@ Argument MAP keymap in which to bind the keys."
}; };
}; };
org-auctex = {
enable = true;
package = epkgs: epkgs.trivialBuild {
pname = "org-auctex";
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
packageRequires = [ epkgs.auctex ];
src = pkgs.fetchFromGitHub {
owner = "karthink";
repo = "org-auctex";
rev = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
sha256 = "sha256-cMAhwybnq5HA1wOaUqDPML3nnh5m1iwEETTPWqPbAvw=";
};
};
hook = [ "(org-mode . org-auctex-mode)" ];
};
org-contrib.enable = true; org-contrib.enable = true;
org-download = { org-download = {
enable = true; enable = true;
after = [ "org" ];
init = '' init = ''
(require 'org-download) (require 'org-download)
(setq-default org-download-image-dir "${config.home.sessionVariables.ORGDIR}/images") (setq-default org-download-image-dir "${config.home.sessionVariables.ORGDIR}/images")
''; '';
hook = [ "(dired-mode-hook . org-download-enable)" ]; hook = [ "(dired-mode . org-download-enable)" ];
}; };
org-fragtog ={ org-modern = {
enable = true; enable = true;
hook = [ "(org-mode-hook . org-fragtog-mode)" ]; after = [ "org" ];
hook = [ "(org-mode . org-modern-mode)" ];
}; };
org-ref = { org-ref = {
enable = true; enable = true;
after = [ "org" "ivy" ];
init = '' init = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
(setq org-ref-insert-cite-function (setq org-ref-insert-cite-function
@ -630,6 +680,7 @@ Argument MAP keymap in which to bind the keys."
(org-cite-insert nil))) (org-cite-insert nil)))
(setq org-ref-default-bibliography "${config.home.sessionVariables.ORGDIR}/zotero.bib") (setq org-ref-default-bibliography "${config.home.sessionVariables.ORGDIR}/zotero.bib")
(setq bibtex-completion-bibliography '("${config.home.sessionVariables.ORGDIR}/zotero.bib")) (setq bibtex-completion-bibliography '("${config.home.sessionVariables.ORGDIR}/zotero.bib"))
(setq bibtex-completion-notes-path "${config.home.sessionVariables.ORGDIR}/notes.org")
(require 'org-ref) (require 'org-ref)
(require 'org-ref-ivy) (require 'org-ref-ivy)
''; '';
@ -683,6 +734,7 @@ Argument MAP keymap in which to bind the keys."
tree-sitter = { tree-sitter = {
enable = true; enable = true;
package = epkgs: epkgs.tsc;
init = '' init = ''
(setq tree-sitter-major-mode-language-alist '((arduino-mode . c))) (setq tree-sitter-major-mode-language-alist '((arduino-mode . c)))
''; '';
@ -695,7 +747,10 @@ Argument MAP keymap in which to bind the keys."
]; ];
}; };
tree-sitter-langs.enable = true; tree-sitter-langs = {
enable = true;
package = epkgs: epkgs.tree-sitter-langs;
};
yasnippet = { yasnippet = {
enable = true; enable = true;
@ -716,20 +771,12 @@ Argument MAP keymap in which to bind the keys."
enable = true; enable = true;
config = '' config = ''
(require 'flycheck-arduino) (require 'flycheck-arduino)
(add-hook 'arduino-mode-hook #'flycheck-arduino-setup)
''; '';
hook = [ "(arduino-mode . flycheck-arduino-setup)" ];
init = '' init = ''
(setq arduino-executable "/Applications/Arduino.app/Contents/MacOS/Arduino") (setq arduino-executable "/Applications/Arduino.app/Contents/MacOS/Arduino")
''; '';
}; };
dracula-theme = {
enable = true;
config = ''
(load-theme 'dracula t)
'';
};
}; };
}; };
} }

View file

@ -22,6 +22,8 @@
direnv = { direnv = {
enable = true; enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
nix-direnv = { enable = true; }; nix-direnv = { enable = true; };
}; };
@ -97,6 +99,7 @@
zoxide = { zoxide = {
enable = true; enable = true;
enableBashIntegration = true;
enableZshIntegration = true; enableZshIntegration = true;
}; };
@ -120,30 +123,55 @@
historySubstringSearch.enable = true; historySubstringSearch.enable = true;
loginExtra = '' loginExtra = ''
#!/usr/bin/env zsh # -*-sh-*-
export GPG_TTY=$(tty) export GPG_TTY=$(tty)
eval $(gpg-agent --daemon -q 2>/dev/null) eval $(gpg-agent --daemon -q 2>/dev/null)
function gsearch() { function gsearch() {
open -a Safari "https://google.com/search?q=$(echo $@ | sed -e 's/ /%20/g')" open -a Safari "https://google.com/search?q=$(echo $@ | sed -e 's/ /%20/g')"
} }
function plistxml2nix() { nixify() {
tail -n +4 | if [ ! -e ./.envrc ]; then
sed -e "s/<dict>/{/g" \ echo "use nix" > .envrc
-e "s/<\/dict>/\}\;/g" \ direnv allow
-e "s/<key>/\"/g" \ fi
-e "s/<\/key>/\"=/g" \ if [[ ! -e shell.nix ]] && [[ ! -e default.nix ]]; then
-e "s/<real>//g" \ cat > default.nix <<'EOF'
-e "s/<\/real>/;/g" \ with import <nixpkgs> {};
-e "s/<integer>//g" \ mkShell {
-e "s/<\/integer>/;/g" \ nativeBuildInputs = [
-e "s/<string>/\"/g" \ bashInteractive
-e "s/<\/string>/\"\;/g" \ ];
-e "s/<array>/\[/g" \ }
-e "s/<\/array>/\];/g" \ EOF
-e "s/<true\/>/true;/g" \ ${config.home.sessionVariables.EDITOR} default.nix
-e "s/<false\/>/false;/g" \ fi
-e "$ d" | }
sed \-e "$ s/;//" nixifypy() {
if [ ! -e ./.envrc ]; then
echo "use nix" > .envrc
direnv allow
fi
if [[ ! -e shell.nix ]] && [[ ! -e default.nix ]]; then
cat > default.nix <<'EOF'
with import <nixpkgs> {};
mkShell {
nativeBuildInputs = [
bashInteractive
(pkgs.python310.withPackages (p: with p; [ ]))
];
}
EOF
${config.home.sessionVariables.EDITOR} default.nix
fi
}
flakify() {
if [ ! -e flake.nix ]; then
nix flake new -t github:nix-community/nix-direnv .
elif [ ! -e .envrc ]; then
echo "use flake" > .envrc
direnv allow
fi
${config.home.sessionVariables.EDITOR} flake.nix
} }
''; '';

11
overlays/darwin.nix Normal file
View file

@ -0,0 +1,11 @@
self: super: {
chromium-mac = super.callPackage ./chromium-mac.nix { pkgs = super; };
darwin-zsh-completions = import ./darwin-zsh-completions.nix { pkgs = super; };
firefox-mac = super.callPackage ./firefox-mac.nix { pkgs = super; };
freecad-mac = super.callPackage ./freecad-mac.nix { pkgs = super; };
pinentry-mac = super.callPackage ./pinentry-mac.nix { pkgs = super; };
pinentry-touchid = super.callPackage ./pinentry-touchid.nix { pkgs = super; };
qbittorrent-mac = super.callPackage ./qbittorrent-mac.nix { pkgs = super; };
spotify-mac = super.callPackage ./spotify-mac.nix { pkgs = super; };
vlc-mac = super.callPackage ./vlc-mac.nix { pkgs = super; };
}

View file

@ -1,11 +1,11 @@
self: super: { self: super: {
chromium-mac = super.callPackage ./chromium-mac.nix { pkgs = super; }; tree-sitter-grammars = super.tree-sitter-grammars // {
darwin-zsh-completions = import ./darwin-zsh-completions.nix { pkgs = super; }; tree-sitter-python = super.tree-sitter-grammars.tree-sitter-python.overrideAttrs (_: {
firefox-mac = super.callPackage ./firefox-mac.nix { pkgs = super; }; nativeBuildInputs = [ self.nodejs self.tree-sitter ];
freecad-mac = super.callPackage ./freecad-mac.nix { pkgs = super; }; configurePhase = ''
pinentry-mac = super.callPackage ./pinentry-mac.nix { pkgs = super; }; tree-sitter generate --abi 13 src/grammar.json
pinentry-touchid = super.callPackage ./pinentry-touchid.nix { pkgs = super; }; '';
qbittorrent-mac = super.callPackage ./qbittorrent-mac.nix { pkgs = super; }; });
spotify-mac = super.callPackage ./spotify-mac.nix { pkgs = super; }; };
vlc-mac = super.callPackage ./vlc-mac.nix { pkgs = super; }; org-auctex = super.callPackage ./org-auctex.nix { pkgs = super; };
} }

13
overlays/org-auctex.nix Normal file
View file

@ -0,0 +1,13 @@
{ pkgs }:
pkgs.emacsPackages.trivialBuild {
pname = "org-auctex";
version = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
src = pkgs.fetchFromGitHub {
owner = "karthink";
repo = "org-auctex";
rev = "e1271557b9f36ca94cabcbac816748e7d0dc989c";
sha256 = "sha256-cMAhwybnq5HA1wOaUqDPML3nnh5m1iwEETTPWqPbAvw=";
};
}

View file

@ -17,24 +17,12 @@
settings.trusted-users = [ "root" "willem" ]; settings.trusted-users = [ "root" "willem" ];
}; };
programs.nix-index.enable = true; programs.nix-index.enable = true;
programs.zsh.enable = true; programs.zsh.enable = true;
programs.zsh.enableBashCompletion = true; programs.zsh.enableBashCompletion = true;
programs.zsh.promptInit = ''
autoload -U promptinit && promptinit
setopt PROMPTSUBST
_prompt_nix() {
[ -z "$IN_NIX_SHELL" ] || echo "%F{yellow}%B[''${name:+$name}]%b%f "
}
PS1='%F{red}%B%(?..%? )%b%f%# '
RPS1='$(_prompt_nix)%F{green}%~%f'
if [ -n "$IN_NIX_SANDBOX" ]; then
PS1+='%F{red}[sandbox]%f '
fi
'';
time.timeZone = "America/Vancouver"; time.timeZone = "America/Vancouver";
users.users.willem.shell = pkgs.zsh; users.users.willem.shell = pkgs.zsh;

View file

@ -19,7 +19,6 @@
environment.loginShell = "${pkgs.zsh}/bin/zsh -l"; environment.loginShell = "${pkgs.zsh}/bin/zsh -l";
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
colima colima
darwin-zsh-completions
discord discord
freecad-mac freecad-mac
iterm2 iterm2