commit 7965b0987aec49c7316c081ffd7fe1b9d7e8ec1f
parent 31cbfa1565380d80dae9baeabb04d9abcd9690f2
Author: Crazazy <crazazy@tilde.cafe>
Date: Sun, 13 Feb 2022 18:09:48 +0100
re-formatted a lot of source code
Diffstat:
M | emacs.org | | | 378 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
M | nixos.org | | | 196 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
2 files changed, 287 insertions(+), 287 deletions(-)
diff --git a/emacs.org b/emacs.org
@@ -43,45 +43,45 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
Simple. Nice. default config. (almost)
#+begin_src emacs-lisp :tangle emacsconfig/extras.el
(use-package magit
- :defer t
- :config
- (magit-add-section-hook 'magit-status-sections-hook
- 'magit-insert-modules
- 'magit-insert-stashes
- 'append)
- :bind
- ("C-x g" . magit-status))
+ :defer t
+ :config
+ (magit-add-section-hook 'magit-status-sections-hook
+ 'magit-insert-modules
+ 'magit-insert-stashes
+ 'append)
+ :bind
+ ("C-x g" . magit-status))
(use-package forge
- :after magit)
+ :after magit)
#+end_src
*** IRC
I use IRC in emacs, with ERC. There is even a small macro so that I can easily join new servers
with my preferred nickname
#+begin_src emacs-lisp :tangle emacsconfig/extras.el
(use-package erc
- :custom
- (erc-server-reconnect-attempts 10)
- (erc-nick "crazazy")
- :config
- (defmacro irc-quickjoin (servername url &optional nick)
- "create a function to quickly join a server. Servers can be joined with M-x SERVERNAME-irc"
- `(defun ,(intern (concat (symbol-name servername) "-irc")) (password)
- (interactive (list (password-read "Password: ")))
- (erc-tls :server ,url
- :nick ,(if nick
- nick
- "crazazy")
- :port 6697
- :password password)))
+ :custom
+ (erc-server-reconnect-attempts 10)
+ (erc-nick "crazazy")
+ :config
+ (defmacro irc-quickjoin (servername url &optional nick)
+ "create a function to quickly join a server. Servers can be joined with M-x SERVERNAME-irc"
+ `(defun ,(intern (concat (symbol-name servername) "-irc")) (password)
+ (interactive (list (password-read "Password: ")))
+ (erc-tls :server ,url
+ :nick ,(if nick
+ nick
+ "crazazy")
+ :port 6697
+ :password password)))
- (irc-quickjoin tilde "eu.tilde.chat")
- (irc-quickjoin libera "irc.libera.chat"))
+ (irc-quickjoin tilde "eu.tilde.chat")
+ (irc-quickjoin libera "irc.libera.chat"))
#+end_src
*** Dashboard
Gives me access to the most recent files I edited, and some other stuff that I don't really care about
#+begin_src emacs-lisp :tangle emacsconfig/extras.el
(use-package dashboard
- :config (dashboard-setup-startup-hook))
+ :config (dashboard-setup-startup-hook))
#+end_src
*** Elfeed
I don't use elfeed in emacs that much anymore, as I have switched to [[https://www.seamonkey-project.org/][seamonkey]] for my RSS needs.
@@ -89,58 +89,58 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
=:custom= option
#+begin_src emacs-lisp :tangle emacsconfig/extras.el
(use-package elfeed
- :bind
- ("C-x w" . elfeed)
- (:map elfeed-search-mode-map
- ("C-c a" . elfeed-add-feed)
- ("C-c u" . elfeed-update)
- ("C-c f" . elfeed-update-feed)
- ("C-c r" . elfeed-mark-all-as-read))
- :config
- (defun elfeed-mark-all-as-read ()
- (interactive)
- (mark-whole-buffer)
- (elfeed-search-untag-all-unread))
- :custom
- (elfeed-search-filter "@6-months-ago +quality")
- (elfeed-feeds '(("http://feeds.feedburner.com/tweakers/nieuws" NL tech exportable)
- ("https://discourse.nixos.org/c/announcements/8.rss" nixos programming quality)
- ("http://www.dnbradio.com/feeds" music podcasts)
- ("https://codepen.io/spark/feed/" programming quality)
- ("https://envs.net/~lucidiot/rsrsss/feed.xml" RSS quality)
- ("https://falseknees.tumblr.com/rss" comics quality)
- ("https://hackspace.raspberrypi.org/feed" tech programming)
- ("https://lobste.rs/rss" programming)
- ("https://news.rickcarlino.com/rss.rss" tech)
- ("https://nu.nl/rss" NL news exportable)
- ("https://planet.haskell.org/atom.xml" haskell programming)
- ("https://planet.nixos.org/atom.xml" nixos programming quality)
- ("https://reddit.com/r/dnb/.rss" reddit music)
- ("https://reddit.com/r/programming/.rss" reddit programming)
- ("https://reddit.com/r/realdubstep/.rss" reddit music)
- ("https://reddit.com/r/thenetherlands/.rss" NL reddit)
- ("https://sachachua.com/blog/category/emacs-news/feed" emacs quality programming)
- ("https://webzine.puffy.cafe/atom.xml" openbsd tech quality programming)
- ("https://www.fosskers.ca/en/rss" programming quality exportable)
- ("https://xkcd.com/atom.xml" comics)))
- (elfeed-feeds nil))
+ :bind
+ ("C-x w" . elfeed)
+ (:map elfeed-search-mode-map
+ ("C-c a" . elfeed-add-feed)
+ ("C-c u" . elfeed-update)
+ ("C-c f" . elfeed-update-feed)
+ ("C-c r" . elfeed-mark-all-as-read))
+ :config
+ (defun elfeed-mark-all-as-read ()
+ (interactive)
+ (mark-whole-buffer)
+ (elfeed-search-untag-all-unread))
+ :custom
+ (elfeed-search-filter "@6-months-ago +quality")
+ (elfeed-feeds '(("http://feeds.feedburner.com/tweakers/nieuws" NL tech exportable)
+ ("https://discourse.nixos.org/c/announcements/8.rss" nixos programming quality)
+ ("http://www.dnbradio.com/feeds" music podcasts)
+ ("https://codepen.io/spark/feed/" programming quality)
+ ("https://envs.net/~lucidiot/rsrsss/feed.xml" RSS quality)
+ ("https://falseknees.tumblr.com/rss" comics quality)
+ ("https://hackspace.raspberrypi.org/feed" tech programming)
+ ("https://lobste.rs/rss" programming)
+ ("https://news.rickcarlino.com/rss.rss" tech)
+ ("https://nu.nl/rss" NL news exportable)
+ ("https://planet.haskell.org/atom.xml" haskell programming)
+ ("https://planet.nixos.org/atom.xml" nixos programming quality)
+ ("https://reddit.com/r/dnb/.rss" reddit music)
+ ("https://reddit.com/r/programming/.rss" reddit programming)
+ ("https://reddit.com/r/realdubstep/.rss" reddit music)
+ ("https://reddit.com/r/thenetherlands/.rss" NL reddit)
+ ("https://sachachua.com/blog/category/emacs-news/feed" emacs quality programming)
+ ("https://webzine.puffy.cafe/atom.xml" openbsd tech quality programming)
+ ("https://www.fosskers.ca/en/rss" programming quality exportable)
+ ("https://xkcd.com/atom.xml" comics)))
+ (elfeed-feeds nil))
#+end_src
*** Evil mode
I am originally a vim user, and the standard vim bindings have not left my hands yet,
I am not a big configurer, so this is mostly just the standard configuration that [[https://github.com/emacs-evil/evil-collection#installation][evil-mode]] advices you to do
#+begin_src emacs-lisp :tangle emacsconfig/evil.el
(use-package evil
- :init
- (setq evil-want-integration t) ;; This is optional since it's already set to t by default.
- (setq evil-want-keybinding nil)
- :config
- (evil-define-key 'normal global-map "," 'evil-execute-in-god-state)
- (evil-mode 1))
+ :init
+ (setq evil-want-integration t) ;; This is optional since it's already set to t by default.
+ (setq evil-want-keybinding nil)
+ :config
+ (evil-define-key 'normal global-map "," 'evil-execute-in-god-state)
+ (evil-mode 1))
(use-package evil-collection
- :after evil
- :config
- (evil-collection-init))
+ :after evil
+ :config
+ (evil-collection-init))
#+end_src
**** God-mode
To further prove that I have no intentions at all to be busy with making evil bindings for eveything I find
@@ -148,8 +148,8 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
support
#+begin_src emacs-lisp :tangle emacsconfig/evil.el
(use-package evil-god-state
- :bind
- ("M-," . evil-god-state-bail))
+ :bind
+ ("M-," . evil-god-state-bail))
(use-package god-mode)
#+end_src
@@ -158,18 +158,18 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
is surprisingly painless, so I figured I'd just add it
#+begin_src emacs-lisp :tangle emacsconfig/evil.el
(use-package evil-tree-edit
- :hook
- (java-mode . evil-tree-edit-mode)
- (python-mode . evil-tree-edit-mode))
+ :hook
+ (java-mode . evil-tree-edit-mode)
+ (python-mode . evil-tree-edit-mode))
#+end_src
*** Which-key
Has god-mode support
#+begin_src emacs-lisp :tangle emacsconfig/extras.el
(use-package which-key
- :after god-mode
- :config
- (which-key-enable-god-mode-support)
- (which-key-mode))
+ :after god-mode
+ :config
+ (which-key-enable-god-mode-support)
+ (which-key-mode))
#+end_src
** Programming-related emacs tools
I do computer science, so from now and then I tend to program a bit. Here are all the tools I use to accomplish
@@ -179,26 +179,26 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
of language-servers, as I've had bad experiences with them when I was still using vim
#+begin_src emacs-lisp :tangle emacsconfig/extras.el
(use-package company
- :bind
- ("C-SPC" . company-complete))
+ :bind
+ ("C-SPC" . company-complete))
#+end_src
*** Matching of parentheses and other stuff
"ERROR: Unmatched parenteses/braces/whatever" is really a thing I would prefer to never see again
It has nix and lisp support, but other langages are fairly standards so not much configuration needed there
#+begin_src emacs-lisp :tangle emacsconfig/extras.el
(use-package smartparens
- :hook
- (emacs-lisp-mode . smartparens-mode)
- (nix-mode . smartparens-mode)
- (lisp-mode . smartparens-mode)
- :config
- (sp-with-modes '(lisp-mode emacs-lisp-mode)
- (sp-local-pair "'" nil :actions nil)
- (sp-local-pair "`" nil :actions nil))
+ :hook
+ (emacs-lisp-mode . smartparens-mode)
+ (nix-mode . smartparens-mode)
+ (lisp-mode . smartparens-mode)
+ :config
+ (sp-with-modes '(lisp-mode emacs-lisp-mode)
+ (sp-local-pair "'" nil :actions nil)
+ (sp-local-pair "`" nil :actions nil))
- (sp-with-modes '(nix-mode)
- (sp-local-pair "'" nil :actions nil)
- (sp-local-pair "''" "''")))
+ (sp-with-modes '(nix-mode)
+ (sp-local-pair "'" nil :actions nil)
+ (sp-local-pair "''" "''")))
#+end_src
*** Languages
Other than that, there are some language-specific setups that I want to do,which are a bit more complicated
@@ -210,74 +210,74 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
This config is just part of editing nix config. It is supposed to come with company support, but
the auto-completion backend turns out to not be that great. We'll see what I do with it
#+begin_src emacs-lisp :tangle emacsconfig/nix.el
- (use-package nix-mode
- :mode "\\.nix\\'"
- :hook
- (nix-mode . company-mode)
- :config
- ;; the company-nix backend is not available in melpa, but has no new dependencies
- (unless (package-installed-p 'company-nix)
- (with-temp-buffer
- (url-insert-file-contents "https://github.com/NixOS/nix-mode/raw/master/nix-company.el")
- (eval-buffer)))
- (add-hook 'nix-mode-hook (lambda ()
- (set (make-local-variable 'company-backends)
- '((company-nix)))))
- (add-hook 'nix-mode-hook 'company-mode))
+ (use-package nix-mode
+ :mode "\\.nix\\'"
+ :hook
+ (nix-mode . company-mode)
+ :config
+ ;; the company-nix backend is not available in melpa, but has no new dependencies
+ (unless (package-installed-p 'company-nix)
+ (with-temp-buffer
+ (url-insert-file-contents "https://github.com/NixOS/nix-mode/raw/master/nix-company.el")
+ (eval-buffer)))
+ (add-hook 'nix-mode-hook (lambda ()
+ (set (make-local-variable 'company-backends)
+ '((company-nix)))))
+ (add-hook 'nix-mode-hook 'company-mode))
#+end_src
***** Nix package management
I use nix-sandbox for managing nix package for other languages.
One of the functions doesn't work that well for me so I replaced it with something that does
#+begin_src emacs-lisp :tangle emacsconfig/nix.el
- (use-package nix-sandbox
- :config
- (defun nix-executable-find (sandbox executable)
- "finds an EXECUTABLE in SANDBOX"
- (set (make-local-variable 'exec-path) (nix-exec-path sandbox))
- (executable-find executable)))
+ (use-package nix-sandbox
+ :config
+ (defun nix-executable-find (sandbox executable)
+ "finds an EXECUTABLE in SANDBOX"
+ (set (make-local-variable 'exec-path) (nix-exec-path sandbox))
+ (executable-find executable)))
#+end_src
Beyond that, there is a helper function that makes it easy to quickly define environments with the required
packages for a programming language
#+begin_src emacs-lisp :tangle emacsconfig/nix.el
- (defun nix-env-from-packages (name &rest packages)
- "create a nix environment from nix packages. returns the location of the environment"
- (interactive (append
- (list (read-string "Environment name: " nil nil "nameless"))
- (split-string (read-string "Packages: "))))
- (with-temp-buffer
- (insert (format "
- { pkgs ? import %s {}}:
- pkgs.mkShell {
- buildInputs = with pkgs;[
- %s
- ];
- }
- " (or nix-nixpkgs-path "<nixpkgs>") (apply 'concat (intersperse "\n" packages))))
- (write-file (concat temporary-file-directory name "-env/shell.nix"))
- (nix-find-sandbox (concat temporary-file-directory name "-env"))))
+ (defun nix-env-from-packages (name &rest packages)
+ "create a nix environment from nix packages. returns the location of the environment"
+ (interactive (append
+ (list (read-string "Environment name: " nil nil "nameless"))
+ (split-string (read-string "Packages: "))))
+ (with-temp-buffer
+ (insert (format "
+ { pkgs ? import %s {}}:
+ pkgs.mkShell {
+ buildInputs = with pkgs;[
+ %s
+ ];
+ }
+ " (or nix-nixpkgs-path "<nixpkgs>") (apply 'concat (intersperse "\n" packages))))
+ (write-file (concat temporary-file-directory name "-env/shell.nix"))
+ (nix-find-sandbox (concat temporary-file-directory name "-env"))))
#+end_src
**** Python
Python is a bit weird. It had no intentions at all to do things the way I wanted it to do things with
use-package, so I had to find a weird work-arounds with add-hook and all that stuff
#+begin_src emacs-lisp :tangle emacsconfig/python.el :padline no :noweb no-export
(add-hook 'python-mode-hook (lambda ()
- <<el-python-config>>))
+ <<el-python-config>>))
#+end_src
First we set an interpreter with nix, it comes with all the python autocompletion tools we need
#+begin_src emacs-lisp :noweb-ref el-python-config :tangle no
(setq python-shell-interpreter
- (nix-executable-find
- (nix-env-from-packages "python" "(python3.withPackages (p: with p; [pygame virtualenvwrapper pip sqlite jedi flake8 yapf autopep8 black]))")
- "python"))
+ (nix-executable-find
+ (nix-env-from-packages "python" "(python3.withPackages (p: with p; [pygame virtualenvwrapper pip sqlite jedi flake8 yapf autopep8 black]))")
+ "python"))
#+end_src
Then we introduce elpy with so that it can use all the tools immidiately without downloading them
#+begin_src emacs-lisp :noweb-ref el-python-config :tangle no
(use-package elpy
- :config
- (elpy-enable)
- (setq elpy-rpc-python-command python-shell-interpreter))
+ :config
+ (elpy-enable)
+ (setq elpy-rpc-python-command python-shell-interpreter))
#+end_src
**** Web stuff
@@ -286,47 +286,47 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
***** Web mode
General xml stuff editing. Fairly standard
#+begin_src emacs-lisp :tangle emacsconfig/web.el
- (use-package web-mode
- :mode (("\\.x?html?\\'" . web-mode)
- ("\\.x[sm]l\\'" . web-mode)
- ("\\.css\\'" . web-mode)
- ("\\.jsx?\\'" . web-mode)
- ("\\.tsx?\\'" . web-mode)
- ("\\.json\\'" . web-mode))
- :custom
- (web-mode-markup-indent-offset 2) ; HTML
- (web-mode-css-indent-offset 2) ; CSS
- (web-mode-code-indent-offset 2) ; JS/JSX/TS/TSX
- (web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))))
- (use-package elnode)
+ (use-package web-mode
+ :mode (("\\.x?html?\\'" . web-mode)
+ ("\\.x[sm]l\\'" . web-mode)
+ ("\\.css\\'" . web-mode)
+ ("\\.jsx?\\'" . web-mode)
+ ("\\.tsx?\\'" . web-mode)
+ ("\\.json\\'" . web-mode))
+ :custom
+ (web-mode-markup-indent-offset 2) ; HTML
+ (web-mode-css-indent-offset 2) ; CSS
+ (web-mode-code-indent-offset 2) ; JS/JSX/TS/TSX
+ (web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))))
+ (use-package elnode)
#+end_src
***** Emmet mode
for quickly inserting a whole XML tree
#+begin_src emacs-lisp :tangle emacsconfig/web.el
- (use-package emmet-mode
- :hook
- (sgml-mode . emmet-mode)
- (web-mode . emmet-mode)
- (css-mode . emmet-mode)
- :bind
- (:map emmet-mode-keymap
- ("TAB" . emmet-dwim))
- :config
- (defun emmet-dwim (prefix)
- (interactive "p")
- (or
- (emmet-go-to-edit-point prefix)
- (emmet-expand-line prefix)
- (evil-jump-forward prefix))))
+ (use-package emmet-mode
+ :hook
+ (sgml-mode . emmet-mode)
+ (web-mode . emmet-mode)
+ (css-mode . emmet-mode)
+ :bind
+ (:map emmet-mode-keymap
+ ("TAB" . emmet-dwim))
+ :config
+ (defun emmet-dwim (prefix)
+ (interactive "p")
+ (or
+ (emmet-go-to-edit-point prefix)
+ (emmet-expand-line prefix)
+ (evil-jump-forward prefix))))
#+end_src
** Other, less useful stuff
*** Themes
I like to have a nice theme in my setup
#+begin_src emacs-lisp :tangle emacsconfig/misc.el
(use-package flatland-theme
- :config
- (load-theme 'flatland))
+ :config
+ (load-theme 'flatland))
#+end_src
Also I want to theme my config exports
#+begin_src emacs-lisp :tangle emacsconfig/extras.el
@@ -336,35 +336,35 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto
My discord buddies /have/ to know I'm using emacs whenever I have my computer running
#+begin_src emacs-lisp :tangle emacsconfig/misc.el
(use-package elcord
- :config
- (elcord-mode))
+ :config
+ (elcord-mode))
#+end_src
*** Emenu
Since I'm using emacs as a daemon, it can also be benefical to make an application launcer
#+begin_src emacs-lisp :tangle emacsconfig/misc.el
(defun all-commands ()
- "does a completing read of all the programs accessible to you in $PATH"
- (let ((ls-output (mapcan (lambda (path)
- (when (file-readable-p path)
- (cl-remove-if (lambda (file)
- (let ((fullpath (concat path "/" file)))
- (or (file-directory-p fullpath)
- (not (file-executable-p fullpath)))))
- (directory-files path nil directory-files-no-dot-files-regexp nil))))
- (split-string (getenv "PATH") ":" t)))
- (alias-output (split-string (shell-command-to-string "alias -p | sed -E 's/^alias ([^=]*)=.*$/\1/'") "\n")))
- (ido-completing-read "Command: " (append ls-output alias-output))))
+ "does a completing read of all the programs accessible to you in $PATH"
+ (let ((ls-output (mapcan (lambda (path)
+ (when (file-readable-p path)
+ (cl-remove-if (lambda (file)
+ (let ((fullpath (concat path "/" file)))
+ (or (file-directory-p fullpath)
+ (not (file-executable-p fullpath)))))
+ (directory-files path nil directory-files-no-dot-files-regexp nil))))
+ (split-string (getenv "PATH") ":" t)))
+ (alias-output (split-string (shell-command-to-string "alias -p | sed -E 's/^alias ([^=]*)=.*$/\1/'") "\n")))
+ (ido-completing-read "Command: " (append ls-output alias-output))))
(defun emenu ()
- "A dmenu-inspired application launcher using a separate emacs frame"
- (interactive)
- (with-selected-frame (make-frame '((name . "emenu")
- (minibuffer . only)
- (width . 151)
- (height . 1)))
- (unwind-protect
- (progn
- (call-process (all-commands) nil 0)
- (keyboard-quit))
- (delete-frame))))
+ "A dmenu-inspired application launcher using a separate emacs frame"
+ (interactive)
+ (with-selected-frame (make-frame '((name . "emenu")
+ (minibuffer . only)
+ (width . 151)
+ (height . 1)))
+ (unwind-protect
+ (progn
+ (call-process (all-commands) nil 0)
+ (keyboard-quit))
+ (delete-frame))))
#+end_src
diff --git a/nixos.org b/nixos.org
@@ -22,7 +22,7 @@ stuff
in
{
imports = [
- <<nixos-config>>
+ <<nixos-config>>
];
}
#+end_src
@@ -38,8 +38,8 @@ stuff
#+begin_src nix :noweb-ref nixos-config :tangle no
{
options.mainUser = with lib; mkOption {
- type = types.str;
- default = builtins.getEnv "USER";
+ type = types.str;
+ default = builtins.getEnv "USER";
};
}
#+end_src
@@ -59,10 +59,10 @@ stuff
users.mutableUsers = false;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.${config.mainUser} = {
- initialHashedPassword = "$6$XTH/sALyqg$G.bMWemErh4KGCAjUfT16DL96QMn/4NTmxlw6Z26wUVJn.tagQG.Fzmrz7uPkdiWZbBBFWP36.YA4hw9AcL8Q1";
- isNormalUser = true;
- extraGroups = [ "video" "wheel" "NetworkManager" ]; # Enable ‘sudo’ for the user.
- # shell = pkgs.nushell;
+ initialHashedPassword = "$6$XTH/sALyqg$G.bMWemErh4KGCAjUfT16DL96QMn/4NTmxlw6Z26wUVJn.tagQG.Fzmrz7uPkdiWZbBBFWP36.YA4hw9AcL8Q1";
+ isNormalUser = true;
+ extraGroups = [ "video" "wheel" "NetworkManager" ]; # Enable ‘sudo’ for the user.
+ # shell = pkgs.nushell;
};
}
#+end_src
@@ -81,9 +81,9 @@ stuff
nix.package = pkgs.nixFlakes;
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [
- (final: prev: {
- emacs = sources.emacs-ng.outputs.defaultPackage."x86_64-linux";
- })
+ (final: prev: {
+ emacs = (import sources.emacs-ng).outputs.defaultPackage."x86_64-linux";
+ })
];
}
#+end_src
@@ -92,28 +92,28 @@ stuff
We will create a small module for cachix before we put in the rest declaratively
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- options.nix.cacheAttrs = with lib; mkOption {
- type = with types; attrsOf str;
- default = {};
+ options.nix.cacheAttrs = with lib; mkOption {
+ type = with types; attrsOf str;
+ default = {};
- };
- config = with lib; {
- nix.binaryCaches = builtins.attrNames config.nix.cacheAttrs;
- nix.binaryCachePublicKeys = builtins.attrValues config.nix.cacheAttrs;
- };
+ };
+ config = with lib; {
+ nix.binaryCaches = builtins.attrNames config.nix.cacheAttrs;
+ nix.binaryCachePublicKeys = builtins.attrValues config.nix.cacheAttrs;
+ };
}
#+end_src
With the config in hand, we can now quickly and easily declare our substitute servers
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- nix.cacheAttrs = {
- "https://crazazy.cachix.org" = "crazazy.cachix.org-1:3KaIHK26pkvd5palJH5A4Re1Hn2+GDV+aXYnftMYAm4=";
- "https://emacsng.cachix.org" = "emacsng.cachix.org-1:i7wOr4YpdRpWWtShI8bT6V7lOTnPeI7Ho6HaZegFWMI=";
- "https://ethancedwards8.cachix.org" = "ethancedwards8.cachix.org-1:YMasjqyFnDreRQ9GXmnPIshT3tYyFHE2lUiNhbyIxOc=";
- "https://nix-community.cachix.org" = "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
- "https://nrdxp.cachix.org" = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4=";
- "https://rycee.cachix.org" = "rycee.cachix.org-1:TiiXyeSk0iRlzlys4c7HiXLkP3idRf20oQ/roEUAh/A=";
- };
+ nix.cacheAttrs = {
+ "https://crazazy.cachix.org" = "crazazy.cachix.org-1:3KaIHK26pkvd5palJH5A4Re1Hn2+GDV+aXYnftMYAm4=";
+ "https://emacsng.cachix.org" = "emacsng.cachix.org-1:i7wOr4YpdRpWWtShI8bT6V7lOTnPeI7Ho6HaZegFWMI=";
+ "https://ethancedwards8.cachix.org" = "ethancedwards8.cachix.org-1:YMasjqyFnDreRQ9GXmnPIshT3tYyFHE2lUiNhbyIxOc=";
+ "https://nix-community.cachix.org" = "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=";
+ "https://nrdxp.cachix.org" = "nrdxp.cachix.org-1:Fc5PSqY2Jm1TrWfm88l6cvGWwz3s93c6IOifQWnhNW4=";
+ "https://rycee.cachix.org" = "rycee.cachix.org-1:TiiXyeSk0iRlzlys4c7HiXLkP3idRf20oQ/roEUAh/A=";
+ };
}
#+end_src
** udev binds
@@ -124,49 +124,49 @@ stuff
generated temporary directories to the owner of the home folder
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- options = with lib; {
- homeBinds = mkOption {
- type = with types; listOf str;
- default = [ ];
- description = "Bind mounts in your home folder";
- };
- persistRoot = mkOption {
- type = types.str;
- default = "/nix/persist";
- };
- };
- config = with lib; mkIf (config.homeBinds != [ ]) {
- fileSystems = genAttrs (map (loc: "/home/${config.mainUser}/${loc}") config.homeBinds)
- (loc: {
- device = "${config.persistRoot}${loc}";
- fsType = "none";
- options = [ "bind" ];
- });
- systemd.services.fix-home-perms = {
- wantedBy = [ "multi-user.target" ];
- after = map (loc: "${builtins.replaceStrings ["/"] ["-"] loc}.mount") config.homeBinds;
- serviceConfig.Type = "oneshot";
- script = "chown -R ${config.mainUser} /home/${config.mainUser}";
- };
- };
+ options = with lib; {
+ homeBinds = mkOption {
+ type = with types; listOf str;
+ default = [ ];
+ description = "Bind mounts in your home folder";
+ };
+ persistRoot = mkOption {
+ type = types.str;
+ default = "/nix/persist";
+ };
+ };
+ config = with lib; mkIf (config.homeBinds != [ ]) {
+ fileSystems = genAttrs (map (loc: "/home/${config.mainUser}/${loc}") config.homeBinds)
+ (loc: {
+ device = "${config.persistRoot}${loc}";
+ fsType = "none";
+ options = [ "bind" ];
+ });
+ systemd.services.fix-home-perms = {
+ wantedBy = [ "multi-user.target" ];
+ after = map (loc: "${builtins.replaceStrings ["/"] ["-"] loc}.mount") config.homeBinds;
+ serviceConfig.Type = "oneshot";
+ script = "chown -R ${config.mainUser} /home/${config.mainUser}";
+ };
+ };
}
#+end_src
*** The binds
These are the binds themselves, they change frequently
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- homeBinds = [
- ".config/keybase"
- ".local/share/Steam"
- ".local/share/keybase"
- ".mozilla/seamonkey"
- ".ssh"
- ".wine"
- "Desktop"
- "Documents"
- "Music"
- "Videos"
- ];
+ homeBinds = [
+ ".config/keybase"
+ ".local/share/Steam"
+ ".local/share/keybase"
+ ".mozilla/seamonkey"
+ ".ssh"
+ ".wine"
+ "Desktop"
+ "Documents"
+ "Music"
+ "Videos"
+ ];
}
#+end_src
** Visual stuff
@@ -175,28 +175,28 @@ stuff
Enable printing, sound and a good keyboard, along with x11 itself
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- # Enable CUPS to print documents.
- services.printing.enable = true;
+ # Enable CUPS to print documents.
+ services.printing.enable = true;
- # Enable sound.
- sound.enable = true;
- hardware.pulseaudio.enable = true;
+ # Enable sound.
+ sound.enable = true;
+ hardware.pulseaudio.enable = true;
- # Enable the X11 windowing system.
- services.xserver.enable = true;
- services.xserver.layout = "us";
- services.xserver.xkbVariant = "altgr-intl";
- services.xserver.xkbOptions = "eurosign:e";
- # touchpad controls
- services.xserver.libinput.enable = true;
+ # Enable the X11 windowing system.
+ services.xserver.enable = true;
+ services.xserver.layout = "us";
+ services.xserver.xkbVariant = "altgr-intl";
+ services.xserver.xkbOptions = "eurosign:e";
+ # touchpad controls
+ services.xserver.libinput.enable = true;
}
#+end_src
*** XFCE
I have decided to be lazy and not install a fancy window manager or whatever into the system. Thats headache
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- services.xserver.displayManager.lightdm.enable = true;
- services.xserver.desktopManager.xfce.enable = true;
+ services.xserver.displayManager.lightdm.enable = true;
+ services.xserver.desktopManager.xfce.enable = true;
}
#+end_src
** Networking
@@ -214,44 +214,44 @@ stuff
These are the normal packages that I use for core maintenance
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- environment.systemPackages = with pkgs; [
- gitFull
- curl
- vim
- nur.repos.crazazy.seamonkey
- (wine.override { wineBuild = "wineWow"; })
- ];
+ environment.systemPackages = with pkgs; [
+ gitFull
+ curl
+ vim
+ nur.repos.crazazy.seamonkey
+ (wine.override { wineBuild = "wineWow"; })
+ ];
}
#+end_src
*** Steam
I like to play videogames sometimes, however steam also requires a little more special attention
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- imports = [
- nurModules.repos.crazazy.modules.private.steam-config
- ];
- environment.systemPackages = with pkgs; [
- steam
- ];
+ imports = [
+ nurModules.repos.crazazy.modules.private.steam-config
+ ];
+ environment.systemPackages = with pkgs; [
+ steam
+ ];
}
#+end_src
*** Emacs
Emacs needs to be integrated into the rest of the system. We are going to do that via a emacs daemon
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- services.emacs = {
- # package = import ./emacs.nix;
- enable = true;
- };
- homebinds = [
- ".config/emacs"
- ];
+ services.emacs = {
+ package = import ./emacs.nix;
+ enable = true;
+ };
+ homeBinds = [
+ ".config/emacs"
+ ];
}
#+end_src
*** QEMU & frens
I also sometimes run qemu vms. The qemu's manager will be libvirtd, but not sure if I will even use that
#+begin_src nix :noweb-ref nixos-config :tangle no
{
- virtualisation.libvirtd.enable = true;
+ virtualisation.libvirtd.enable = true;
}
#+end_src