mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 00:57:22 +01:00
13020 lines
416 KiB
HTML
13020 lines
416 KiB
HTML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
|
<head>
|
|
<!-- 2024-07-20 Sa 00:16 -->
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>SwarselSystems: NixOS + Emacs Configuration</title>
|
|
<meta name="author" content="Leon Schwarzäugl" />
|
|
<meta name="generator" content="Org Mode" />
|
|
<style type="text/css">
|
|
#content { max-width: 60em; margin: auto; }
|
|
.title { text-align: center;
|
|
margin-bottom: .2em; }
|
|
.subtitle { text-align: center;
|
|
font-size: medium;
|
|
font-weight: bold;
|
|
margin-top:0; }
|
|
.todo { font-family: monospace; color: red; }
|
|
.done { font-family: monospace; color: green; }
|
|
.priority { font-family: monospace; color: orange; }
|
|
.tag { background-color: #eee; font-family: monospace;
|
|
padding: 2px; font-size: 80%; font-weight: normal; }
|
|
.timestamp { color: #bebebe; }
|
|
.timestamp-kwd { color: #5f9ea0; }
|
|
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
|
|
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
|
|
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
|
|
.underline { text-decoration: underline; }
|
|
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
|
p.verse { margin-left: 3%; }
|
|
pre {
|
|
border: 1px solid #e6e6e6;
|
|
border-radius: 3px;
|
|
background-color: #f2f2f2;
|
|
padding: 8pt;
|
|
font-family: monospace;
|
|
overflow: auto;
|
|
margin: 1.2em;
|
|
}
|
|
pre.src {
|
|
position: relative;
|
|
overflow: auto;
|
|
}
|
|
pre.src:before {
|
|
display: none;
|
|
position: absolute;
|
|
top: -8px;
|
|
right: 12px;
|
|
padding: 3px;
|
|
color: #555;
|
|
background-color: #f2f2f299;
|
|
}
|
|
pre.src:hover:before { display: inline; margin-top: 14px;}
|
|
/* Languages per Org manual */
|
|
pre.src-asymptote:before { content: 'Asymptote'; }
|
|
pre.src-awk:before { content: 'Awk'; }
|
|
pre.src-authinfo::before { content: 'Authinfo'; }
|
|
pre.src-C:before { content: 'C'; }
|
|
/* pre.src-C++ doesn't work in CSS */
|
|
pre.src-clojure:before { content: 'Clojure'; }
|
|
pre.src-css:before { content: 'CSS'; }
|
|
pre.src-D:before { content: 'D'; }
|
|
pre.src-ditaa:before { content: 'ditaa'; }
|
|
pre.src-dot:before { content: 'Graphviz'; }
|
|
pre.src-calc:before { content: 'Emacs Calc'; }
|
|
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
|
pre.src-fortran:before { content: 'Fortran'; }
|
|
pre.src-gnuplot:before { content: 'gnuplot'; }
|
|
pre.src-haskell:before { content: 'Haskell'; }
|
|
pre.src-hledger:before { content: 'hledger'; }
|
|
pre.src-java:before { content: 'Java'; }
|
|
pre.src-js:before { content: 'Javascript'; }
|
|
pre.src-latex:before { content: 'LaTeX'; }
|
|
pre.src-ledger:before { content: 'Ledger'; }
|
|
pre.src-lisp:before { content: 'Lisp'; }
|
|
pre.src-lilypond:before { content: 'Lilypond'; }
|
|
pre.src-lua:before { content: 'Lua'; }
|
|
pre.src-matlab:before { content: 'MATLAB'; }
|
|
pre.src-mscgen:before { content: 'Mscgen'; }
|
|
pre.src-ocaml:before { content: 'Objective Caml'; }
|
|
pre.src-octave:before { content: 'Octave'; }
|
|
pre.src-org:before { content: 'Org mode'; }
|
|
pre.src-oz:before { content: 'OZ'; }
|
|
pre.src-plantuml:before { content: 'Plantuml'; }
|
|
pre.src-processing:before { content: 'Processing.js'; }
|
|
pre.src-python:before { content: 'Python'; }
|
|
pre.src-R:before { content: 'R'; }
|
|
pre.src-ruby:before { content: 'Ruby'; }
|
|
pre.src-sass:before { content: 'Sass'; }
|
|
pre.src-scheme:before { content: 'Scheme'; }
|
|
pre.src-screen:before { content: 'Gnu Screen'; }
|
|
pre.src-sed:before { content: 'Sed'; }
|
|
pre.src-sh:before { content: 'shell'; }
|
|
pre.src-sql:before { content: 'SQL'; }
|
|
pre.src-sqlite:before { content: 'SQLite'; }
|
|
/* additional languages in org.el's org-babel-load-languages alist */
|
|
pre.src-forth:before { content: 'Forth'; }
|
|
pre.src-io:before { content: 'IO'; }
|
|
pre.src-J:before { content: 'J'; }
|
|
pre.src-makefile:before { content: 'Makefile'; }
|
|
pre.src-maxima:before { content: 'Maxima'; }
|
|
pre.src-perl:before { content: 'Perl'; }
|
|
pre.src-picolisp:before { content: 'Pico Lisp'; }
|
|
pre.src-scala:before { content: 'Scala'; }
|
|
pre.src-shell:before { content: 'Shell Script'; }
|
|
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
|
|
/* additional language identifiers per "defun org-babel-execute"
|
|
in ob-*.el */
|
|
pre.src-cpp:before { content: 'C++'; }
|
|
pre.src-abc:before { content: 'ABC'; }
|
|
pre.src-coq:before { content: 'Coq'; }
|
|
pre.src-groovy:before { content: 'Groovy'; }
|
|
/* additional language identifiers from org-babel-shell-names in
|
|
ob-shell.el: ob-shell is the only babel language using a lambda to put
|
|
the execution function name together. */
|
|
pre.src-bash:before { content: 'bash'; }
|
|
pre.src-csh:before { content: 'csh'; }
|
|
pre.src-ash:before { content: 'ash'; }
|
|
pre.src-dash:before { content: 'dash'; }
|
|
pre.src-ksh:before { content: 'ksh'; }
|
|
pre.src-mksh:before { content: 'mksh'; }
|
|
pre.src-posh:before { content: 'posh'; }
|
|
/* Additional Emacs modes also supported by the LaTeX listings package */
|
|
pre.src-ada:before { content: 'Ada'; }
|
|
pre.src-asm:before { content: 'Assembler'; }
|
|
pre.src-caml:before { content: 'Caml'; }
|
|
pre.src-delphi:before { content: 'Delphi'; }
|
|
pre.src-html:before { content: 'HTML'; }
|
|
pre.src-idl:before { content: 'IDL'; }
|
|
pre.src-mercury:before { content: 'Mercury'; }
|
|
pre.src-metapost:before { content: 'MetaPost'; }
|
|
pre.src-modula-2:before { content: 'Modula-2'; }
|
|
pre.src-pascal:before { content: 'Pascal'; }
|
|
pre.src-ps:before { content: 'PostScript'; }
|
|
pre.src-prolog:before { content: 'Prolog'; }
|
|
pre.src-simula:before { content: 'Simula'; }
|
|
pre.src-tcl:before { content: 'tcl'; }
|
|
pre.src-tex:before { content: 'TeX'; }
|
|
pre.src-plain-tex:before { content: 'Plain TeX'; }
|
|
pre.src-verilog:before { content: 'Verilog'; }
|
|
pre.src-vhdl:before { content: 'VHDL'; }
|
|
pre.src-xml:before { content: 'XML'; }
|
|
pre.src-nxml:before { content: 'XML'; }
|
|
/* add a generic configuration mode; LaTeX export needs an additional
|
|
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
|
|
pre.src-conf:before { content: 'Configuration File'; }
|
|
|
|
table { border-collapse:collapse; }
|
|
caption.t-above { caption-side: top; }
|
|
caption.t-bottom { caption-side: bottom; }
|
|
td, th { vertical-align:top; }
|
|
th.org-right { text-align: center; }
|
|
th.org-left { text-align: center; }
|
|
th.org-center { text-align: center; }
|
|
td.org-right { text-align: right; }
|
|
td.org-left { text-align: left; }
|
|
td.org-center { text-align: center; }
|
|
dt { font-weight: bold; }
|
|
.footpara { display: inline; }
|
|
.footdef { margin-bottom: 1em; }
|
|
.figure { padding: 1em; }
|
|
.figure p { text-align: center; }
|
|
.equation-container {
|
|
display: table;
|
|
text-align: center;
|
|
width: 100%;
|
|
}
|
|
.equation {
|
|
vertical-align: middle;
|
|
}
|
|
.equation-label {
|
|
display: table-cell;
|
|
text-align: right;
|
|
vertical-align: middle;
|
|
}
|
|
.inlinetask {
|
|
padding: 10px;
|
|
border: 2px solid gray;
|
|
margin: 10px;
|
|
background: #ffffcc;
|
|
}
|
|
#org-div-home-and-up
|
|
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
|
textarea { overflow-x: auto; }
|
|
.linenr { font-size: smaller }
|
|
.code-highlighted { background-color: #ffff00; }
|
|
.org-info-js_info-navigation { border-style: none; }
|
|
#org-info-js_console-label
|
|
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
|
.org-info-js_search-highlight
|
|
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
|
.org-svg { }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="content" class="content">
|
|
<h1 class="title">SwarselSystems: NixOS + Emacs Configuration</h1>
|
|
<div id="table-of-contents" role="doc-toc">
|
|
<h2>Table of Contents</h2>
|
|
<div id="text-table-of-contents" role="doc-toc">
|
|
<ul>
|
|
<li><a href="#h:a86fe971-f169-4052-aacf-15e0f267c6cd">1. Introduction (no code)</a></li>
|
|
<li><a href="#h:d39b8dfb-536d-414f-9fc0-7d67df48cee4">2. Noweb-Ref blocks</a>
|
|
<ul>
|
|
<li><a href="#h:237b9f25-1fa3-484e-952e-99175dbb91c5">2.1. Non-NixOS</a>
|
|
<ul>
|
|
<li><a href="#h:5bc1b0c9-dc59-4c81-b5b5-e60699deda78">2.1.1. Theme (stylix)</a></li>
|
|
<li><a href="#h:f3cf9bdc-6826-4d8e-ba5a-253ef098a9b8">2.1.2. Waybar items - LAPTOPS</a></li>
|
|
<li><a href="#h:47749e76-3f25-485a-9e98-c7ce3a4ad444">2.1.3. Waybar items - PC</a></li>
|
|
<li><a href="#h:515cfeb6-3b16-4fb2-9222-3557555a6cc1">2.1.4. Sway Startup commands</a></li>
|
|
<li><a href="#h:66fd578f-d4a0-4e17-bf3d-a9eb64bc7103">2.1.5. gpg-agent</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:996e9c5f-ed65-4f4f-b043-5a901ed74358">2.2. NixOS</a>
|
|
<ul>
|
|
<li><a href="#h:4ae8b4ed-47a8-4d79-a12c-894118ea57e1">2.2.1. Wrap with hardware-configuration</a></li>
|
|
<li><a href="#h:a4585ec3-8fa0-472c-a0db-1b34917591ea">2.2.2. Virtual hosts init</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:c7588c0d-2528-485d-b2df-04d6336428d7">2.3. flake.nix</a>
|
|
<ul>
|
|
<li><a href="#h:8a411ee2-a58e-4b5b-99bd-4ba772f8f0a2">2.3.1. Inputs & Inputs@Outputs</a></li>
|
|
<li><a href="#h:df0072bc-853f-438f-bd85-bfc869501015">2.3.2. let</a></li>
|
|
<li><a href="#h:9c9b9e3b-8771-44fa-ba9e-5056ae809655">2.3.3. nixosConfigurations</a></li>
|
|
<li><a href="#h:f881aa05-a670-48dd-a57b-2916abdcb692">2.3.4. homeConfigurations</a></li>
|
|
<li><a href="#h:5f6ef553-59f9-4239-b6f3-63d33b57f335">2.3.5. nixOnDroidConfigurations</a></li>
|
|
<li><a href="#h:6a08495a-8566-4bb5-9fac-b03df01f6c81">2.3.6. nixos-generators</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:02cd20be-1ffa-4904-9d5a-da5a89ba1421">3. System</a>
|
|
<ul>
|
|
<li><a href="#h:88bf4b90-e94b-46fb-aaf1-a381a512860d">3.1. System specific configuration</a>
|
|
<ul>
|
|
<li><a href="#h:29a3066d-4da6-4f61-b835-5e4a43e2d34d">3.1.1. Template (for new machines)</a></li>
|
|
<li><a href="#h:58dc6384-0d19-4f71-9043-4014bd033ba2">3.1.2. Physical hosts</a></li>
|
|
<li><a href="#h:4dc59747-9598-4029-aa7d-92bf186d6c06">3.1.3. Virtual hosts</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:1c1250cd-e9b4-4715-8d9f-eb09e64bfc7f">3.2. Common NixOS</a>
|
|
<ul>
|
|
<li><a href="#h:5a114da6-ef8d-404d-b31b-b51472908e77">3.2.1. General</a></li>
|
|
<li><a href="#h:d87d80fd-2ac7-4f29-b338-0518d06b4deb">3.2.2. sops</a></li>
|
|
<li><a href="#h:0e7e8bea-ec58-499c-9731-09dddfc39532">3.2.3. System Packages</a></li>
|
|
<li><a href="#h:2bbf5f31-246d-4738-925f-eca40681f7b6">3.2.4. Programs (including zsh setup)</a></li>
|
|
<li><a href="#h:79f3258f-ed9d-434d-b50a-e58d57ade2a7">3.2.5. Services</a></li>
|
|
<li><a href="#h:7a89b5e3-b700-4167-8b14-2b8172f33936">3.2.6. Hardware compatibility settings (Yubikey, Ledger) - udev rules</a></li>
|
|
<li><a href="#h:eae45839-223a-4027-bce3-e26e092c9096">3.2.7. System Login</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:f0a6b5e0-2157-4522-b5e1-3f0abd91c05e">3.3. Common Home-Manager</a>
|
|
<ul>
|
|
<li><a href="#h:893a7f33-7715-415b-a895-2687ded31c18">3.3.1. Installed packages</a></li>
|
|
<li><a href="#h:d87d80fd-2ac7-4f29-b338-0518d06b4deb">3.3.2. sops</a></li>
|
|
<li><a href="#h:edd6720e-1f90-40bf-b6f9-30a19d4cae08">3.3.3. SSH Machines</a></li>
|
|
<li><a href="#h:a92318cd-413e-4e78-a478-e63b09df019c">3.3.4. Fonts + Theme</a></li>
|
|
<li><a href="#h:867556e6-5a24-4c43-9d47-3edca2f16488">3.3.5. Desktop Entries</a></li>
|
|
<li><a href="#h:5ef03803-e150-41bc-b603-e80d60d96efc">3.3.6. Linking dotfiles</a></li>
|
|
<li><a href="#h:4486b02f-4fb8-432b-bfa2-2e786206341d">3.3.7. Sourcing environment variables</a></li>
|
|
<li><a href="#h:070a75ce-e209-4cda-aa25-e979bbf75d47">3.3.8. Programs</a></li>
|
|
<li><a href="#org05cfe0c">3.3.9. nix-index</a></li>
|
|
<li><a href="#h:ac0e5e62-0dbf-4782-9a96-9e558eae86ae">3.3.10. password-store</a></li>
|
|
<li><a href="#h:1ab84307-b3fb-4c32-9def-4b89a53a8547">3.3.11. direnv</a></li>
|
|
<li><a href="#h:1bd6b0c7-f201-43e2-9624-6c50de00a1f6">3.3.12. eza</a></li>
|
|
<li><a href="#h:419675ec-3310-438e-80ae-9eaa798a319d">3.3.13. git</a></li>
|
|
<li><a href="#h:069cabf3-df14-49ba-8d17-75f2bcf34fbf">3.3.14. Fuzzel</a></li>
|
|
<li><a href="#h:55212502-c8f6-43af-ae99-55c8377ef34e">3.3.15. Starship</a></li>
|
|
<li><a href="#h:5f1287db-d2e8-49aa-8c58-730129c7795c">3.3.16. Kitty</a></li>
|
|
<li><a href="#h:91dd4cc4-aada-4e74-be23-0cc69ed85af5">3.3.17. zsh</a></li>
|
|
<li><a href="#h:506d01fc-c20b-473a-ac78-bce4b53fe0e3">3.3.18. Mail</a></li>
|
|
<li><a href="#h:c05d1b64-7110-4151-b436-46bc447113b4">3.3.19. Home-manager: Emacs</a></li>
|
|
<li><a href="#h:0bf51f63-01c0-4053-a591-7f0c5697c690">3.3.20. Waybar</a></li>
|
|
<li><a href="#h:fbec0bd4-690b-4f79-8b2b-a40263760a96">3.3.21. Firefox</a></li>
|
|
<li><a href="#h:387c3a82-1fb1-4c0f-8051-874e2acb8804">3.3.22. Services</a></li>
|
|
<li><a href="#h:02df9dfc-d1af-4a37-a7a0-d8da0af96a20">3.3.23. Sway</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:aee5ec75-7ca6-40d8-b6ac-a3e7e33a474b">3.4. flake.nix template and Closing Parenthesis (this needs to be the last heading in the Systems header)</a>
|
|
<ul>
|
|
<li><a href="#h:24e2a65b-b0cc-42cb-8e61-5a4cc39d6b2f">3.4.1. Closing parentheses for common/home.nix and common/nixos.nix</a></li>
|
|
<li><a href="#h:4f89db68-a21c-415d-87a5-21c66f2b6ded">3.4.2. flake.nix</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:ed4cd05c-0879-41c6-bc39-3f1246a96f04">4. Emacs</a>
|
|
<ul>
|
|
<li><a href="#h:2c331451-45ed-4592-9e00-d36b5bf31248">4.1. Initialization (early-init.el)</a>
|
|
<ul>
|
|
<li><a href="#h:38e03b65-9dfc-4547-b27d-236664d7dc15">4.1.1. Increase startup performance</a></li>
|
|
<li><a href="#h:782b3632-afb2-4c67-8c46-ff94408aef5d">4.1.2. Setup frames</a></li>
|
|
<li><a href="#h:396c47f2-7e2f-4fad-ae71-6483bf7e3e42">4.1.3. Make C-i, C-m, C-[ available in graphic sessions</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:601ba407-b906-4869-8ef6-67a9fc285fba">4.2. Personal settings</a>
|
|
<ul>
|
|
<li><a href="#h:b7b5976a-db2b-493d-8794-1924a0e12aec">4.2.1. Custom functions</a></li>
|
|
<li><a href="#h:2b827c27-0de7-45ed-9d9e-6c511e2c6bb5">4.2.2. Custom Keybindings</a></li>
|
|
<li><a href="#h:07951589-54ba-4e3e-bd7b-4106cd22ff6a">4.2.3. Directory setup / File structure</a></li>
|
|
<li><a href="#h:0cf30b76-91d9-41da-a10b-74199bc36d40">4.2.4. Unclutter .emacs.d</a></li>
|
|
<li><a href="#h:329f529a-ef9f-4787-b311-1c485e05b754">4.2.5. Move backup files to another location</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:786b447d-03ad-4c1d-b114-c37caa2d591c">4.3. General init.el setup + UI</a>
|
|
<ul>
|
|
<li><a href="#h:76a5bd78-a20d-4068-bea8-a38fdb26428e">4.3.1. General setup</a></li>
|
|
<li><a href="#h:0debe8fd-b319-4ab7-a92c-784fa7896b75">4.3.2. Mark all themes as safe</a></li>
|
|
<li><a href="#h:b587e869-9911-443b-bc6d-8fb3ce31908d">4.3.3. Show less compilation warnings</a></li>
|
|
<li><a href="#h:6527b3ce-b76d-431a-9960-a57da7c53e1b">4.3.4. Indentation</a></li>
|
|
<li><a href="#h:3dc9fb1d-cd16-4bd0-a9ac-55a944415a90">4.3.5. Scrolling</a></li>
|
|
<li><a href="#h:5bf9f014-ee96-42da-b285-7b34f04e6bb1">4.3.6. Evil</a></li>
|
|
<li><a href="#h:e888d7a7-1755-4109-af11-5358b8cf140e">4.3.7. ispell</a></li>
|
|
<li><a href="#h:60f87342-0491-4c56-8057-6f075cf35753">4.3.8. Font Configuration</a></li>
|
|
<li><a href="#h:72a9704b-83d2-4b74-a1f6-d333203f62db">4.3.9. Theme</a></li>
|
|
<li><a href="#h:eb0ea526-a83a-4664-b3a1-2b40d3a31493">4.3.10. Icons</a></li>
|
|
<li><a href="#h:455ed7ac-ee7f-4f94-b857-f2c58b2282d0">4.3.11. Variable Pitch Mode</a></li>
|
|
<li><a href="#h:ed585848-875a-4673-910c-d2e1901dd95b">4.3.12. Modeline</a></li>
|
|
<li><a href="#h:39ae01e9-8053-4f76-aa77-8cbbbcff9652">4.3.13. Helper Modes</a></li>
|
|
<li><a href="#h:bbbd9cc8-3a84-4810-a3d5-b8536a5fbda1">4.3.14. Ligatures</a></li>
|
|
<li><a href="#h:e9d40e63-0e1f-47df-98f7-5427992588a4">4.3.15. Popup (popper) + Shackle Buffers</a></li>
|
|
<li><a href="#h:a6d23c8c-125f-4e36-af30-ff0a1e0d5a28">4.3.16. Indicate first and last line of buffer</a></li>
|
|
<li><a href="#h:053a36bf-168f-4f63-a0c4-f0139dc6cc3b">4.3.17. Authentication</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:f2622fd3-7f14-47a8-8c21-33574fcbf14b">4.4. Modules</a>
|
|
<ul>
|
|
<li><a href="#h:99544398-72af-4382-b8e1-01b2221baff4">4.4.1. Org Mode</a></li>
|
|
<li><a href="#h:406c2ecc-0e3e-4d9f-9ae3-3eb1f8b87d1b">4.4.2. Nix Mode</a></li>
|
|
<li><a href="#orgc3f7bff">4.4.3. nixpkgs-fmt</a></li>
|
|
<li><a href="#h:50327461-a11b-4e81-830a-90febc720cfa">4.4.4. Markdown Mode</a></li>
|
|
<li><a href="#h:65e69741-9860-4ed0-bbed-7b7be9a2a9d6">4.4.5. Olivetti</a></li>
|
|
<li><a href="#h:94d4a0dc-b0d7-4702-b760-beeaa6da2b8f">4.4.6. darkroom</a></li>
|
|
<li><a href="#h:87453f1c-8ea5-4d0a-862d-8973d5bc5405">4.4.7. Ripgrep</a></li>
|
|
<li><a href="#h:543641d0-02a9-459e-a2d6-96c8fcc06864">4.4.8. Tree-sitter</a></li>
|
|
<li><a href="#h:82ddeef2-99f8-465b-ba36-07c3eaad717b">4.4.9. direnv (envrc)</a></li>
|
|
<li><a href="#h:efb3f0fd-e846-4df9-ba48-2e45d776f68f">4.4.10. avy</a></li>
|
|
<li><a href="#h:1c1821c6-98de-4079-a4f3-6ba6e6dcb668">4.4.11. crdt (Collaborative Editing)</a></li>
|
|
<li><a href="#h:d9a6cb44-736e-4608-951f-e928e1b757c0">4.4.12. devdocs</a></li>
|
|
<li><a href="#h:5cde5032-251e-4cc4-9202-b4ce996f92c2">4.4.13. Projectile</a></li>
|
|
<li><a href="#h:d2c7323d-f8c6-4f23-b70a-930e3e4ecce5">4.4.14. Magit</a></li>
|
|
<li><a href="#h:d78709dd-4f79-441c-9166-76f61f90359a">4.4.15. Yubikey support</a></li>
|
|
<li><a href="#h:1a8585ed-d9f2-478f-a132-440ada1cde2c">4.4.16. Forge</a></li>
|
|
<li><a href="#h:cf5b0e6b-56a5-4a93-99fb-258eb7cb2eb4">4.4.17. git-timemachine</a></li>
|
|
<li><a href="#h:d9671ab7-a75a-47c6-a1f4-376d126c9b0a">4.4.18. Delimiters (brackets): rainbow-delimiters, highlight-parentheses</a></li>
|
|
<li><a href="#h:d1a32a69-2f9a-45ef-95fe-a00e3551dc94">4.4.19. rainbow-mode</a></li>
|
|
<li><a href="#h:5653d693-ecca-4c95-9633-66b9e3241070">4.4.20. Corfu</a></li>
|
|
<li><a href="#h:c3cc1c12-3ab8-42b7-be07-63f54eac397f">4.4.21. cape</a></li>
|
|
<li><a href="#h:3aa20438-edf6-4b13-a90d-3d5c51239c44">4.4.22. rust</a></li>
|
|
<li><a href="#h:b9b27a88-06f3-470b-a604-a20b2079bc26">4.4.23. Tramp</a></li>
|
|
<li><a href="#h:58415e95-8a7a-4517-acbb-5f1bb1028603">4.4.24. diff-hl</a></li>
|
|
<li><a href="#h:d60ce0b1-cabf-43f5-a236-a1e4b400d2f5">4.4.25. Commenting</a></li>
|
|
<li><a href="#h:9ec11ee4-2250-414a-87b5-73ee680a3a4a">4.4.26. yasnippet</a></li>
|
|
<li><a href="#h:316857e7-4df8-4ec5-b22e-6dac918fa937">4.4.27. eglot</a></li>
|
|
<li><a href="#h:1de35f27-335d-4cbd-beb6-f85cf5496173">4.4.28. Breadcrumb</a></li>
|
|
<li><a href="#h:e9a30d0f-423f-4e85-af4b-f8560f1c1b53">4.4.29. Prevent breaking of hardlinks</a></li>
|
|
<li><a href="#h:0918557a-8463-430c-b8df-6546dea9abd0">4.4.30. Dirvish</a></li>
|
|
<li><a href="#h:b108dd3e-f34d-4ed3-98df-0bf9de055889">4.4.31. pdf-tools: pdf-viewer and support for dirvish</a></li>
|
|
<li><a href="#h:c15efae7-b884-4c97-8367-ccc7e7ed9ba8">4.4.32. Jupyter</a></li>
|
|
<li><a href="#h:1fc538d1-8c53-48b2-8652-66046f4bbbf8">4.4.33. undo-tree</a></li>
|
|
<li><a href="#h:b6c18dd0-3377-47ea-80c3-ac1486454e18">4.4.34. Hydra</a></li>
|
|
<li><a href="#h:fff816a0-6d70-4bda-abab-833345e51100">4.4.35. External Applications</a></li>
|
|
<li><a href="#h:2f333330-b19d-4f64-85ea-146ff28667e8">4.4.36. Email</a></li>
|
|
<li><a href="#h:c760f04e-622f-4b3e-8916-53ca8cce6edc">4.4.37. Calendar</a></li>
|
|
<li><a href="#h:48f5be2b-b3d2-4276-bd49-2630733f23d5">4.4.38. Dashboard: emacs startup screen</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#h:c4c37b94-0760-4bff-9917-f1b0f023f6c3">5. Wiki</a>
|
|
<ul>
|
|
<li><a href="#h:b917d84e-5549-4966-8817-f1d947083ab9">5.1. Importing a NixOS module that is not in nixpkgs</a></li>
|
|
<li><a href="#h:0ea4318a-ef11-4d9a-bef4-e994c5020989">5.2. Build a firefox addon</a></li>
|
|
<li><a href="#h:ce7a2467-72e0-4a13-89c0-61e3b3dbb6e7">5.3. Define shell utility as package</a></li>
|
|
<li><a href="#h:f98faf13-1e3b-4ba4-9e76-cc4b98f1c308">5.4. Add program with prebuild binaries to nix store</a></li>
|
|
<li><a href="#h:fceba848-f065-40e0-ad3f-d16e48c24db5">5.5. Patch a utilty for nix paths:</a></li>
|
|
<li><a href="#h:f87f511f-f2be-486d-8297-4361eee6a0d8">5.6. let-block for overriding a package in nixpkgs (here: replacing airsonic with airsonic-advanced)</a></li>
|
|
<li><a href="#h:236b7d18-d97b-4714-805f-2ca4d8b1c3c2">5.7. Reference configurations</a>
|
|
<ul>
|
|
<li><a href="#h:60bd347b-81c5-47b2-82f7-2e6a0c888d3e">5.7.1. non-nixos</a></li>
|
|
<li><a href="#h:3f747cb3-bf83-4cb6-8fe4-6a4865472eeb">5.7.2. nixos</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<p>
|
|
<b>This file has 41230 words spanning 10979 lines and was last revised on 2024-07-20 00:16:24 +0200.</b>
|
|
</p>
|
|
|
|
<p>
|
|
In order to have working links and macros when viewing this file online, you might want to switch to the <a href="https://swarsel.github.io/.dotfiles/">html version</a>.
|
|
</p>
|
|
<div id="outline-container-h:a86fe971-f169-4052-aacf-15e0f267c6cd" class="outline-2">
|
|
<h2 id="h:a86fe971-f169-4052-aacf-15e0f267c6cd"><span class="section-number-2">1.</span> Introduction (no code)</h2>
|
|
<div class="outline-text-2" id="text-h:a86fe971-f169-4052-aacf-15e0f267c6cd">
|
|
<p>
|
|
This literate configuration file holds the entirety of all configuration files for both NixOS as well as home manager across all machines that I currently use. It also holds an extensive Emacs configuration
|
|
</p>
|
|
|
|
<p>
|
|
I used to have two separate files (<code>Emacs.org</code> and <code>Nixos.org</code>) because the NixOS setting for installing Emacs packages used to break if it found UTF-8 characters in <code>.el</code> files but not in <code>.org</code> files. Hence I used to pass <code>Emacs.org</code> to that function rather than <code>init.el</code>. This seems to be fixed now however and I was finally able to consolidate both files into one.
|
|
</p>
|
|
|
|
<p>
|
|
This configuration is part of a NixOS system that is fully declarative and can be found here:
|
|
</p>
|
|
|
|
<ul class="org-ul">
|
|
<li><a href="https:github.com/Swarsel/.dotfiles"><code>SwarselSystems</code> on github.com</a></li>
|
|
<li><a href="https:swagit.swarsel.win/Swarsel/.dotfiles"><code>SwarselSystems</code> on swagit.swarsel.win</a></li>
|
|
</ul>
|
|
|
|
<p>
|
|
The literate configuration lets me explain my choices to my future self as well as you, the reader. I go to great lengths to explain the choices for all configuration steps that I take in order for me to pay due diligence in crafting my setup, and not simply copying big chunks of other peoples code. Also, the literate configuration approach is very convenient to me as I only need to keep of (ideally) a single file to manage all of my configuration. I hope that this documentation will make it easier for beginners to get into Emacs and NixOS as I know it can be a struggle in the beginning.
|
|
</p>
|
|
|
|
<p>
|
|
This file is structured as follows:
|
|
</p>
|
|
|
|
<ul class="org-ul">
|
|
<li><a href="#h:a86fe971-f169-4052-aacf-15e0f267c6cd">Introduction (no code)</a>
|
|
This is the block you are currently in. It holds no code that actually builds the system, it just outlines the general approach and explains my rough mentality</li>
|
|
|
|
<li><a href="#h:d39b8dfb-536d-414f-9fc0-7d67df48cee4">Noweb-Ref blocks</a>
|
|
This section hold code that can be templated at other parts of the configuration. This is mostly used for the NixOS side of the configuration where I define my host systems that usually have a lot in common.</li>
|
|
|
|
<li><a href="#h:02cd20be-1ffa-4904-9d5a-da5a89ba1421">System</a>
|
|
This section holds all configuration options that apply to NixOS or Home Manager. In other words, here we are doing system and user level configuration.</li>
|
|
|
|
<li><p>
|
|
<a href="#h:ed4cd05c-0879-41c6-bc39-3f1246a96f04">Emacs</a>
|
|
This section defines my Emacs configuration. For a while, I considered to use rycee's <code>emacs-init</code> module (<a href="https://github.com/nix-community/nur-combined/blob/master/repos/rycee/hm-modules/emacs-init.nix">https://github.com/nix-community/nur-combined/blob/master/repos/rycee/hm-modules/emacs-init.nix</a>) to manage my Emacs configuration; I have since come to the conclusion that this would be a bad idea: at the moment, even though it might seem as I am very bound to the configuration file that you are currently reading, if I ever decide to change how I run my system, I can simply take the generated <code>.nix</code> and <code>.el</code> files and put them wherever I need them. This file only simplifies that generation without putting further restrictions on my. If I were however to switch to <code>emacs-init</code> then I would be indeed to some level confined to the nix ecosystem with my Emacs configuration, as I would no longer have a valid <code>.org</code> file to manage it with, instead generating an <code>init.el</code> directly from nix code. I like to keep that level of freedom for potential future use. Also, you will notice there is no package system setup in this configuration. This is because packages are automatically handled on the NixOS side by parsing the generated <code>init.el</code> file for package installs.
|
|
</p>
|
|
|
|
<p>
|
|
My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2024-07-20 00:16:24 +0200)
|
|
</p></li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
system-configuration-options
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<pre class="example">
|
|
--prefix=/nix/store/6y05k2rmg7xfinnaglr0js84qi0cl7lv-emacs-pgtk-20240717.0 --disable-build-details --with-modules --with-pgtk --with-compress-install --with-toolkit-scroll-bars --with-native-compilation --without-imagemagick --with-mailutils --without-small-ja-dic --with-tree-sitter --without-xinput2 --with-xwidgets --with-dbus --with-selinux
|
|
</pre>
|
|
|
|
|
|
<p>
|
|
This file is not loaded by Emacs directly as the configuration (even though this would be possible) - instead, it generates two more files:
|
|
</p>
|
|
|
|
<ul class="org-ul">
|
|
<li><code>early-init.el</code>
|
|
This file handle startup optimization and sets up the basic frame that I will be working in.</li>
|
|
|
|
<li><code>init.el</code>
|
|
This file handles the rest of the Emacs configuration.</li>
|
|
</ul>
|
|
|
|
<p>
|
|
By using the configuration offered by this file, the file you are reading right now (<code>SwarselSystems.org</code>) will be freshly tangled on every file save. However, when you clone this configuration yourself and have not yet activated it, you need to tangle the file yourself. This can be done using the keybind <code>C-c C-v t</code>. Alternatively, execute the following block:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(org-babel-tangle)
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Lastly, I add this javascript bit to the file in order to have a darkmode toggle when exporting to html:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-elisp">(concat
|
|
"<script src=\"https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js\"></script>\n"
|
|
"<script>\n"
|
|
"function addDarkmodeWidget() {\n"
|
|
"new Darkmode().showWidget();\n"
|
|
"}\n"
|
|
"window.addEventListener('load', addDarkmodeWidget);\n"
|
|
"</script>")
|
|
</pre>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js"></script>
|
|
<script>
|
|
function addDarkmodeWidget() {
|
|
new Darkmode().showWidget();
|
|
}
|
|
window.addEventListener('load', addDarkmodeWidget);
|
|
</script>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:d39b8dfb-536d-414f-9fc0-7d67df48cee4" class="outline-2">
|
|
<h2 id="h:d39b8dfb-536d-414f-9fc0-7d67df48cee4"><span class="section-number-2">2.</span> Noweb-Ref blocks</h2>
|
|
<div class="outline-text-2" id="text-h:d39b8dfb-536d-414f-9fc0-7d67df48cee4">
|
|
<p>
|
|
These blocks are used in several places throughout the configurations, but not on all machines necessarily. For example, the theming section needs to be in a NixOS block on NixOS machines but in a home-manager block on non-NixOS. This serves to reduce code duplication.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:237b9f25-1fa3-484e-952e-99175dbb91c5" class="outline-3">
|
|
<h3 id="h:237b9f25-1fa3-484e-952e-99175dbb91c5"><span class="section-number-3">2.1.</span> Non-NixOS</h3>
|
|
<div class="outline-text-3" id="text-h:237b9f25-1fa3-484e-952e-99175dbb91c5">
|
|
<p>
|
|
These blocks are to be used on systems that are not running NixOS. For example, one such system would be a Fedora system running home manager, where the respective NixOS features might not be available.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:5bc1b0c9-dc59-4c81-b5b5-e60699deda78" class="outline-4">
|
|
<h4 id="h:5bc1b0c9-dc59-4c81-b5b5-e60699deda78"><span class="section-number-4">2.1.1.</span> Theme (stylix)</h4>
|
|
<div class="outline-text-4" id="text-h:5bc1b0c9-dc59-4c81-b5b5-e60699deda78">
|
|
<p>
|
|
This is where the theme for the whole OS is defined. This noweb-ref section cannot be copied to the general NixOS config for now since they are on different folder structure levels in the config, which would make the flake impure.
|
|
</p>
|
|
|
|
<p>
|
|
For styling, I am using the <a href="https://github.com/danth/stylix">stylix</a> NixOS module, loaded by flake. This package is really great, as it adds nix expressions for basically everything. Ever since switching to this, I did not have to play around with theming anywhere else.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
stylix = {
|
|
enable = true;
|
|
base16Scheme = ../../wallpaper/swarsel.yaml;
|
|
# base16Scheme = "${pkgs.base16-schemes}/share/themes/shapeshifter.yaml";
|
|
polarity = "dark";
|
|
opacity.popups = 0.5;
|
|
cursor = {
|
|
package = pkgs.capitaine-cursors;
|
|
name = "capitaine-cursors";
|
|
size = 16;
|
|
};
|
|
fonts = {
|
|
sizes = {
|
|
terminal = 10;
|
|
applications = 11;
|
|
};
|
|
serif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
sansSerif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
monospace = {
|
|
package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; };
|
|
name = "FiraCode Nerd Font Mono";
|
|
};
|
|
|
|
emoji = {
|
|
package = pkgs.noto-fonts-emoji;
|
|
name = "Noto Color Emoji";
|
|
};
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:f3cf9bdc-6826-4d8e-ba5a-253ef098a9b8" class="outline-4">
|
|
<h4 id="h:f3cf9bdc-6826-4d8e-ba5a-253ef098a9b8"><span class="section-number-4">2.1.2.</span> Waybar items - LAPTOPS</h4>
|
|
<div class="outline-text-4" id="text-h:f3cf9bdc-6826-4d8e-ba5a-253ef098a9b8">
|
|
<p>
|
|
This noweb-ref block defines some aspects of my waybar configuration. Mainly, it adds the <code>battery</code> module to the waybar, which is no needed on PCs.
|
|
</p>
|
|
|
|
<p>
|
|
The most part of this configuration is done here: <a href="#h:0bf51f63-01c0-4053-a591-7f0c5697c690">Waybar</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.waybar.settings.mainBar.modules-right = [
|
|
"custom/outer-left-arrow-dark"
|
|
"mpris"
|
|
"custom/left-arrow-light"
|
|
"network"
|
|
"custom/left-arrow-dark"
|
|
"pulseaudio"
|
|
"custom/left-arrow-light"
|
|
"custom/pseudobat"
|
|
"battery"
|
|
"custom/left-arrow-dark"
|
|
"group/hardware"
|
|
"custom/left-arrow-light"
|
|
"clock#2"
|
|
"custom/left-arrow-dark"
|
|
"clock#1"
|
|
];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:47749e76-3f25-485a-9e98-c7ce3a4ad444" class="outline-4">
|
|
<h4 id="h:47749e76-3f25-485a-9e98-c7ce3a4ad444"><span class="section-number-4">2.1.3.</span> Waybar items - PC</h4>
|
|
<div class="outline-text-4" id="text-h:47749e76-3f25-485a-9e98-c7ce3a4ad444">
|
|
<p>
|
|
As stated above, this is the waybar configuration for PCs now. Here we do not need the battery module. However, this leads to a slight problem with theming: my waybar modules alternate their background-color between black and grey. The battery module is usually on grey background. If I were to simply delete that, I would now have two modules on black background. To avoid this, I define a pseudo-module <code>custom/pseudobat</code> that simply shows a static image and calls <code>wlogout</code> on right click. This wastes a little bit of screen space, but that is a price I am willing to pay for consistency.
|
|
</p>
|
|
|
|
<p>
|
|
The most part of this configuration is done here: <a href="#h:0bf51f63-01c0-4053-a591-7f0c5697c690">Waybar</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.waybar.settings.mainBar."custom/pseudobat" = {
|
|
format = "";
|
|
on-click-right = "wlogout -p layer-shell";
|
|
};
|
|
programs.waybar.settings.mainBar.modules-right = [
|
|
"custom/outer-left-arrow-dark"
|
|
"mpris"
|
|
"custom/left-arrow-light"
|
|
"network"
|
|
"custom/left-arrow-dark"
|
|
"pulseaudio"
|
|
"custom/left-arrow-light"
|
|
"custom/pseudobat"
|
|
"battery"
|
|
"custom/left-arrow-dark"
|
|
"group/hardware"
|
|
"custom/left-arrow-light"
|
|
"clock#2"
|
|
"custom/left-arrow-dark"
|
|
"clock#1"
|
|
];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:515cfeb6-3b16-4fb2-9222-3557555a6cc1" class="outline-4">
|
|
<h4 id="h:515cfeb6-3b16-4fb2-9222-3557555a6cc1"><span class="section-number-4">2.1.4.</span> Sway Startup commands</h4>
|
|
<div class="outline-text-4" id="text-h:515cfeb6-3b16-4fb2-9222-3557555a6cc1">
|
|
<p>
|
|
This defines programs I want to have starting when I start the system
|
|
</p>
|
|
|
|
<p>
|
|
Part of the startup is also defined in <a href="#h:02df9dfc-d1af-4a37-a7a0-d8da0af96a20">Sway</a>. The distinction is as follows. As this configuration also needs to work on systems that are running only home manager, I probably need to run nixGL or something similar on those systems to get these graphic apps to display properly. In this section we only define such graphical programs, in the other location we only put shell applications and such.
|
|
</p>
|
|
|
|
<p>
|
|
These other apps currently include:
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li>spotifytui</li>
|
|
<li>kitty</li>
|
|
</ul>
|
|
|
|
<p>
|
|
Do not that <code>syncthingtray</code> is also not mentioned here. It is installed as a home manager package that automatically starts at system start.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
{ command = "nextcloud --background"; }
|
|
{ command = "discord --start-minimized"; }
|
|
{ command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
|
|
{ command = "ANKI_WAYLAND=1 anki"; }
|
|
{ command = "OBSIDIAN_USE_WAYLAND=1 obsidian"; }
|
|
{ command = "nm-applet"; }
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:66fd578f-d4a0-4e17-bf3d-a9eb64bc7103" class="outline-4">
|
|
<h4 id="h:66fd578f-d4a0-4e17-bf3d-a9eb64bc7103"><span class="section-number-4">2.1.5.</span> gpg-agent</h4>
|
|
<div class="outline-text-4" id="text-h:66fd578f-d4a0-4e17-bf3d-a9eb64bc7103">
|
|
<p>
|
|
This section holds most of the configuration needed for the gpg-agent. This allows me to use my Yubikey during normal system operation as well in Emacs (with some extra configuration here: <a href="#h:d2c7323d-f8c6-4f23-b70a-930e3e4ecce5">Magit</a>)
|
|
</p>
|
|
|
|
<p>
|
|
Also, there are some more NixOS related options here: <a href="#h:7a89b5e3-b700-4167-8b14-2b8172f33936">Yubikey settings</a>
|
|
</p>
|
|
|
|
<p>
|
|
I also enable the extra socket here for ssh agent forwarding. But I have not fully gotten it to work yet.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.gpg-agent = {
|
|
enable = true;
|
|
enableSshSupport = true;
|
|
enableExtraSocket = true;
|
|
pinentryPackage = pkgs.pinentry.gtk2;
|
|
defaultCacheTtl = 600;
|
|
maxCacheTtl = 7200;
|
|
extraConfig = ''
|
|
allow-loopback-pinentry
|
|
allow-emacs-pinentry
|
|
'';
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:996e9c5f-ed65-4f4f-b043-5a901ed74358" class="outline-3">
|
|
<h3 id="h:996e9c5f-ed65-4f4f-b043-5a901ed74358"><span class="section-number-3">2.2.</span> NixOS</h3>
|
|
<div class="outline-text-3" id="text-h:996e9c5f-ed65-4f4f-b043-5a901ed74358">
|
|
<p>
|
|
These settings are to be used only on full NixOS setups.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:4ae8b4ed-47a8-4d79-a12c-894118ea57e1" class="outline-4">
|
|
<h4 id="h:4ae8b4ed-47a8-4d79-a12c-894118ea57e1"><span class="section-number-4">2.2.1.</span> Wrap with hardware-configuration</h4>
|
|
<div class="outline-text-4" id="text-h:4ae8b4ed-47a8-4d79-a12c-894118ea57e1">
|
|
<p>
|
|
This handles the automactically generated <code>/etc/nixos/hardware-configuration.nix</code> file that sets some hardware specific settings automatically upon creating the NixOS system.
|
|
</p>
|
|
|
|
<p>
|
|
This sections used to handle more imports, but at the moment, it is now pretty useless really.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
imports =
|
|
[
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:a4585ec3-8fa0-472c-a0db-1b34917591ea" class="outline-4">
|
|
<h4 id="h:a4585ec3-8fa0-472c-a0db-1b34917591ea"><span class="section-number-4">2.2.2.</span> Virtual hosts init</h4>
|
|
<div class="outline-text-4" id="text-h:a4585ec3-8fa0-472c-a0db-1b34917591ea">
|
|
<p>
|
|
This sections is for common NixoS settings that I use for my NixoS LXC images that I run on Proxmox. Proxmox requires special attention to run along with NixOS in any capacity.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
|
|
services = {
|
|
xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
listenAddresses = [{
|
|
port = 22;
|
|
addr = "0.0.0.0";
|
|
}];
|
|
};
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
|
|
networking = {
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
};
|
|
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
This is again the <code>hardware-configuration.nix</code> wrap that you saw earlier, however for Proxmox systems we need to add some more NixOS modules for compatibility.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
|
|
|
|
services = {
|
|
xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
listenAddresses = [{
|
|
port = 22;
|
|
addr = "0.0.0.0";
|
|
}];
|
|
};
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
|
|
networking = {
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
};
|
|
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:c7588c0d-2528-485d-b2df-04d6336428d7" class="outline-3">
|
|
<h3 id="h:c7588c0d-2528-485d-b2df-04d6336428d7"><span class="section-number-3">2.3.</span> flake.nix</h3>
|
|
<div class="outline-text-3" id="text-h:c7588c0d-2528-485d-b2df-04d6336428d7">
|
|
<p>
|
|
Handling the flake.nix file used to be a bit of a chore, since it felt like writing so much boilerplate code just to define new systems. The noweb-approach here makes this a little bit less painful.
|
|
</p>
|
|
|
|
<p>
|
|
These blocks are later inserted here: <a href="#h:aee5ec75-7ca6-40d8-b6ac-a3e7e33a474b">flake.nix template</a>. Adding new flake inputs is very easy, you just add them to <a href="#h:8a411ee2-a58e-4b5b-99bd-4ba772f8f0a2">Inputs & Inputs@Outputs</a> first by name in the first source-block, and then the path in the second source-block. Any variables to be set for the host configuration are done in <a href="#h:df0072bc-853f-438f-bd85-bfc869501015">let</a>, and the specific setup is done in either <a href="#h:9c9b9e3b-8771-44fa-ba9e-5056ae809655">nixosConfigurations</a> (for NixOS systems), <a href="#h:f881aa05-a670-48dd-a57b-2916abdcb692">homeConfigurations</a> (for home-manager systems), or <a href="#h:5f6ef553-59f9-4239-b6f3-63d33b57f335">nixOnDroidConfigurations</a> (for Nix on Android). There is also the <a href="#h:6a08495a-8566-4bb5-9fac-b03df01f6c81">nixos-generators</a> section that currently just defines a Proxmox LXC image.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:8a411ee2-a58e-4b5b-99bd-4ba772f8f0a2" class="outline-4">
|
|
<h4 id="h:8a411ee2-a58e-4b5b-99bd-4ba772f8f0a2"><span class="section-number-4">2.3.1.</span> Inputs & Inputs@Outputs</h4>
|
|
<div class="outline-text-4" id="text-h:8a411ee2-a58e-4b5b-99bd-4ba772f8f0a2">
|
|
<p>
|
|
Here we define inputs and outputs of the flake. First, the following list is for the outputs of the flake.
|
|
</p>
|
|
|
|
<p>
|
|
Format: <name>,
|
|
</p>
|
|
|
|
<p>
|
|
Mind the comma at the end. You need this because the <code>...</code> is being passed as the last argument in the template at <a href="#h:aee5ec75-7ca6-40d8-b6ac-a3e7e33a474b">flake.nix template</a>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
nixpkgs,
|
|
nixpkgs-stable,
|
|
home-manager,
|
|
nix-on-droid,
|
|
emacs-overlay,
|
|
nur,
|
|
nixgl,
|
|
stylix,
|
|
sops-nix,
|
|
lanzaboote,
|
|
nixos-hardware,
|
|
nix-alien,
|
|
nixos-generators,
|
|
nswitch-rcm-nix,
|
|
nix-index-database,
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Here, just add the input names, urls and other options that are needed, like <code>nixpkgs.follows</code>. By using the latter option, you tell the package to not provide it's own package repository, but instead 'nest' itself into another, which is very useful.
|
|
A short overview over each input and what it does:
|
|
</p>
|
|
|
|
<ul class="org-ul">
|
|
<li><a href="https://github.com/NixOS/nixpkgs">nixpkgs</a>
|
|
This is the base repository that I am following for all packages. I follow the unstable branch.</li>
|
|
<li><a href="https://github.com/nix-community/home-manager">home-manager</a>
|
|
This handles user-level configuration and mostly provides dotfiles that are generated and symlinked to <code>~/.config/</code>.</li>
|
|
<li><a href="https://github.com/nix-community/NUR">NUR</a>
|
|
The nix user repository contains user provided modules, packages and expressions. These are not audited by the nix community, so be aware of supply chain vulnerabilities when using those. I am only really using rycee's firefox addons from there which saves me a lot of hassle, and it seems to be a safe resource.</li>
|
|
<li><a href="https://github.com/nix-community/nixGL">nixGL</a>
|
|
This solves the problem that nix has with "OpenGL", as libraries are not linked and programs will often fail to find drivers. But I do not fully understand what it does. All I know is that I usually have to use this on non-NIxoS systems.</li>
|
|
<li><a href="https://github.com/danth/stylix">stylix</a>
|
|
As described before, this handles all theme related options.</li>
|
|
<li><a href="https://github.com/Mic92/sops-nix">sops-nix</a>
|
|
This provides declarative secrets management for NixOS and home manager using sops and age keys. It is a bit more cumbersome to use on home manager systems - which is a bother because I then have to resort to that configuration to keep everything supported - but it is super practical and really the primary reason why it makes sense for me to go for NixOS, as I do not have to do any extra secrets provisioning.</li>
|
|
<li><a href="https://github.com/nix-community/lanzaboote">Lanzaboote</a>
|
|
Provides secure boot for NixOS. Needed for my Surface Pro 3.</li>
|
|
<li><a href="https://github.com/nix-community/nix-on-droid">nix-on-droid</a>
|
|
This brings nix to android in an app that is similar to tmux! Of course most of the configuration does not apply to this, but it is still neat to have!</li>
|
|
<li><a href="https://github.com/NixOS/nixos-hardware">nixos-hardware</a>
|
|
Provides specific hardware setting for some hardware configurations. For example, this sets some better defaults for my Lenovo Thinkpad P14s Gen2.</li>
|
|
<li><a href="https://github.com/thiagokokada/nix-alien">nix-alien</a>
|
|
This is supposed to allow me to run unpatched libraries directly without a need for ELF patching or resorting to <code>steam-run</code>. However, I have not yet gotten this to work.</li>
|
|
<li><a href="https://github.com/nix-community/nixos-generators">nixos-generators</a>
|
|
Provides me with images that I can use to create LXCs on Proxmox.</li>
|
|
<li><a href="https://github.com/Swarsel/nswitch-rcm-nix">nswitch-rcm-nix</a>
|
|
Allows auto injection of payloads upon connecting a Nintendo Switch.</li>
|
|
<li><a href="https://github.com/nix-community/nix-index-database">nix-index-database</a>
|
|
This provides a database for <code>nix-index</code> that is updated weekly. This allows for declarative management, without needing to run the <code>nix-index</code> command for database assembly.</li>
|
|
</ul>
|
|
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
|
|
|
# user-level configuration
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# overlay to access bleeding edge emacs
|
|
emacs-overlay = {
|
|
url = "github:nix-community/emacs-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# nix user repository
|
|
# i use this mainly to not have to build all firefox extensions
|
|
# myself as well as for the emacs-init package (tbd)
|
|
nur.url = "github:nix-community/NUR";
|
|
|
|
# provides GL to non-NixOS hosts
|
|
nixgl.url = "github:guibou/nixGL";
|
|
|
|
# manages all theming using Home-Manager
|
|
stylix.url = "github:danth/stylix";
|
|
|
|
# nix secrets management
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
|
|
|
# enable secure boot on NixOS
|
|
lanzaboote.url = "github:nix-community/lanzaboote";
|
|
|
|
# nix for android
|
|
nix-on-droid = {
|
|
url = "github:t184256/nix-on-droid/release-23.05";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# generate NixOS images
|
|
nixos-generators = {
|
|
url = "github:nix-community/nixos-generators";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# hardware quirks on nix
|
|
nixos-hardware = {
|
|
url = "github:NixOS/nixos-hardware/master";
|
|
};
|
|
|
|
# dynamic library loading
|
|
nix-alien = {
|
|
url = "github:thiagokokada/nix-alien";
|
|
};
|
|
|
|
# automatic nintendo switch payload injection
|
|
nswitch-rcm-nix = {
|
|
url = "github:Swarsel/nswitch-rcm-nix";
|
|
};
|
|
|
|
# weekly updated nix-index database
|
|
nix-index-database = {
|
|
url = "github:nix-community/nix-index-database";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:df0072bc-853f-438f-bd85-bfc869501015" class="outline-4">
|
|
<h4 id="h:df0072bc-853f-438f-bd85-bfc869501015"><span class="section-number-4">2.3.2.</span> let</h4>
|
|
<div class="outline-text-4" id="text-h:df0072bc-853f-438f-bd85-bfc869501015">
|
|
<p>
|
|
Here I define a few variables that I need for my system specifications. First and foremost, <code>pkgs</code>, which gets passed the emacs-overlay, nur, and nixgl modules to it. With this, I can grab all these packages by referencing <code>pkgs.<name></code> instead of having to put e.g. <code>nixgl.auto.nixGLDefault</code>.
|
|
</p>
|
|
|
|
<p>
|
|
Lastly I define some common module lists that I can simply load depending on the fundamental system (NixOS vs. non-NixOS).
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
system = "x86_64-linux"; # not very portable, but I do not use other architectures at the moment
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [
|
|
emacs-overlay.overlay
|
|
nur.overlay
|
|
nixgl.overlay
|
|
(final: _prev: {
|
|
stable = import nixpkgs-stable {
|
|
inherit (final) system config;
|
|
};
|
|
})
|
|
];
|
|
config.allowUnfree = true;
|
|
};
|
|
|
|
# NixOS modules that can only be used on NixOS systems
|
|
nixModules = [
|
|
stylix.nixosModules.stylix
|
|
sops-nix.nixosModules.sops
|
|
nswitch-rcm-nix.nixosModules.nswitch-rcm
|
|
./profiles/common/nixos.nix
|
|
# dynamic library loading
|
|
({ self, system, ... }: {
|
|
environment.systemPackages = with self.inputs.nix-alien.packages.${system}; [
|
|
nix-alien
|
|
];
|
|
# needed for `nix-alien-ld`
|
|
programs.nix-ld.enable = true;
|
|
})
|
|
];
|
|
|
|
# Home-Manager modules wanted on non-NixOS systems
|
|
homeModules = [
|
|
stylix.homeManagerModules.stylix
|
|
];
|
|
# Home-Manager modules wanted on both NixOS and non-NixOS systems
|
|
mixedModules = [
|
|
sops-nix.homeManagerModules.sops
|
|
nix-index-database.hmModules.nix-index
|
|
./profiles/common/home.nix
|
|
];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:9c9b9e3b-8771-44fa-ba9e-5056ae809655" class="outline-4">
|
|
<h4 id="h:9c9b9e3b-8771-44fa-ba9e-5056ae809655"><span class="section-number-4">2.3.3.</span> nixosConfigurations</h4>
|
|
<div class="outline-text-4" id="text-h:9c9b9e3b-8771-44fa-ba9e-5056ae809655">
|
|
<p>
|
|
This section is the biggest pain point of the configuration. For every system, I have one of these. I know there are better ways to go about this, but I did not find the time yet to look into this further. For now, enjoy this meter-long list
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
onett = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
./profles/onett/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/onett/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
sandbox = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/sandbox/nixos.nix
|
|
];
|
|
};
|
|
|
|
twoson = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
./profiles/twoson/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/twoson/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
threed = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
lanzaboote.nixosModules.lanzaboote
|
|
./profiles/threed/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/threed/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
fourside = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
nixos-hardware.nixosModules.lenovo-thinkpad-p14s-amd-gen2
|
|
./profiles/fourside/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/fourside/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
winters = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
nixos-hardware.nixosModules.framework-16-inch-7040-amd
|
|
./profiles/winters/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/winters/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
stand = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
./profiles/stand/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.homelen.imports = mixedModules ++ [
|
|
./profiles/stand/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
nginx = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/nginx/nixos.nix
|
|
];
|
|
};
|
|
|
|
calibre = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/calibre/nixos.nix
|
|
];
|
|
};
|
|
|
|
jellyfin = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
# sops-nix.nixosModules.sops
|
|
./profiles/server1/jellyfin/nixos.nix
|
|
];
|
|
};
|
|
|
|
transmission = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/transmission/nixos.nix
|
|
];
|
|
};
|
|
|
|
matrix = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
# this is to import a service module that is not on nixpkgs
|
|
# this way avoids infinite recursion errors
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/matrix/nixos.nix
|
|
];
|
|
};
|
|
|
|
sound = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/sound/nixos.nix
|
|
];
|
|
};
|
|
|
|
spotifyd = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/spotifyd/nixos.nix
|
|
];
|
|
};
|
|
|
|
paperless = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/paperless/nixos.nix
|
|
];
|
|
};
|
|
|
|
#ovm swarsel
|
|
sync = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/remote/oracle/sync/nixos.nix
|
|
];
|
|
};
|
|
|
|
#ovm swarsel
|
|
swatrix = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/remote/oracle/matrix/nixos.nix
|
|
];
|
|
};
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:f881aa05-a670-48dd-a57b-2916abdcb692" class="outline-4">
|
|
<h4 id="h:f881aa05-a670-48dd-a57b-2916abdcb692"><span class="section-number-4">2.3.4.</span> homeConfigurations</h4>
|
|
<div class="outline-text-4" id="text-h:f881aa05-a670-48dd-a57b-2916abdcb692">
|
|
<p>
|
|
In contrast, this defines home-manager systems, which I only have one of.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
"leons@PCisLee" = home-manager.lib.homeManagerConfiguration {
|
|
inherit pkgs;
|
|
modules = homeModules ++ mixedModules ++ [
|
|
./profiles/surface/home.nix
|
|
];
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:5f6ef553-59f9-4239-b6f3-63d33b57f335" class="outline-4">
|
|
<h4 id="h:5f6ef553-59f9-4239-b6f3-63d33b57f335"><span class="section-number-4">2.3.5.</span> nixOnDroidConfigurations</h4>
|
|
<div class="outline-text-4" id="text-h:5f6ef553-59f9-4239-b6f3-63d33b57f335">
|
|
<p>
|
|
Nix on Android also demands an own flake output, which is provided here.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
default = nix-on-droid.lib.nixOnDroidConfiguration {
|
|
modules = [
|
|
./profiles/mysticant/configuration.nix
|
|
];
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:6a08495a-8566-4bb5-9fac-b03df01f6c81" class="outline-4">
|
|
<h4 id="h:6a08495a-8566-4bb5-9fac-b03df01f6c81"><span class="section-number-4">2.3.6.</span> nixos-generators</h4>
|
|
<div class="outline-text-4" id="text-h:6a08495a-8566-4bb5-9fac-b03df01f6c81">
|
|
<p>
|
|
This builds my proxmox template. It is defined as a separate output so that I can already apply some rudimentary configuration before even setting up the system.
|
|
</p>
|
|
|
|
<p>
|
|
Usage:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-shell">
|
|
nix build ~/.dotfiles/#proxmox-lxc
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
The resulting image can then be loaded in Proxmox.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
proxmox-lxc = nixos-generators.nixosGenerate {
|
|
inherit system;
|
|
modules = [
|
|
./profiles/server1/TEMPLATE/nixos.nix
|
|
];
|
|
format = "proxmox-lxc";
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:02cd20be-1ffa-4904-9d5a-da5a89ba1421" class="outline-2">
|
|
<h2 id="h:02cd20be-1ffa-4904-9d5a-da5a89ba1421"><span class="section-number-2">3.</span> System</h2>
|
|
<div class="outline-text-2" id="text-h:02cd20be-1ffa-4904-9d5a-da5a89ba1421">
|
|
</div>
|
|
<div id="outline-container-h:88bf4b90-e94b-46fb-aaf1-a381a512860d" class="outline-3">
|
|
<h3 id="h:88bf4b90-e94b-46fb-aaf1-a381a512860d"><span class="section-number-3">3.1.</span> System specific configuration</h3>
|
|
<div class="outline-text-3" id="text-h:88bf4b90-e94b-46fb-aaf1-a381a512860d">
|
|
<p>
|
|
This section mainly exists house different `configuration.nix` files for system level configurations of NixOS systems as well as `home.nix` for user level configurations on all systems.
|
|
</p>
|
|
|
|
<p>
|
|
Important: Think about if a settings really needs to go into this area - chances are that the settings can also go to the general settings, which is to be preferred in order to reduce code duplication.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:29a3066d-4da6-4f61-b835-5e4a43e2d34d" class="outline-4">
|
|
<h4 id="h:29a3066d-4da6-4f61-b835-5e4a43e2d34d"><span class="section-number-4">3.1.1.</span> Template (for new machines)</h4>
|
|
<div class="outline-text-4" id="text-h:29a3066d-4da6-4f61-b835-5e4a43e2d34d">
|
|
<p>
|
|
This section holds the minimum configuration that is needed on a new host. These assume a NixOS machine (so not standalone home-manager on a non-NixOS host), as this is the setting that I will most likely use in the future now. All of these blocks need to be updated, with entries called TEMPLATE mostly needed to be filled with host-/user-specific values or other inputs. If TEMPLATE is given in a comment section, see the provided values as likely defaults. The TEMPLATE comments should afterwards be deleted for clarity.
|
|
</p>
|
|
|
|
<p>
|
|
If a non-NixOS host must be used, check the Surface configuration for pointers. Most likely the waybar settings need to be adjusted, since non-NixOS (as of writing this) fails to display drawers in the waybar properly.
|
|
</p>
|
|
|
|
<p>
|
|
No matter what you do, check the initial /etc/nixos/configuration.nix for notable changes that might emerge in future versions of nix.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:91c428e5-f56e-4d36-b08f-7819b2979b23"></a>NixOS<br />
|
|
<div class="outline-text-5" id="text-h:91c428e5-f56e-4d36-b08f-7819b2979b23">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ pkgs, ... }:
|
|
|
|
{
|
|
|
|
|
|
imports =
|
|
[
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
|
|
services = {
|
|
getty.autologinUser = "TEMPLATE";
|
|
greetd.settings.initial_session.user = "TEMPLATE";
|
|
};
|
|
|
|
# Bootloader
|
|
boot.loader.grub = {
|
|
enable = true;
|
|
device = "/dev/sda"; # TEMPLATE - if only one disk, this will work
|
|
useOSProber = true;
|
|
};
|
|
|
|
# --------------------------------------
|
|
# you might need a configuration like this instead:
|
|
# Bootloader
|
|
# boot = {
|
|
# kernelPackages = pkgs.linuxPackages_latest;
|
|
# loader.grub = {
|
|
# enable = true;
|
|
# devices = ["nodev" ];
|
|
# useOSProber = true;
|
|
# };
|
|
# };
|
|
# --------------------------------------
|
|
|
|
networking.hostName = "TEMPLATE"; # Define your hostname.
|
|
|
|
stylix.image = ../../wallpaper/TEMPLATEwp.png;
|
|
|
|
stylix = {
|
|
enable = true;
|
|
base16Scheme = ../../wallpaper/swarsel.yaml;
|
|
# base16Scheme = "${pkgs.base16-schemes}/share/themes/shapeshifter.yaml";
|
|
polarity = "dark";
|
|
opacity.popups = 0.5;
|
|
cursor = {
|
|
package = pkgs.capitaine-cursors;
|
|
name = "capitaine-cursors";
|
|
size = 16;
|
|
};
|
|
fonts = {
|
|
sizes = {
|
|
terminal = 10;
|
|
applications = 11;
|
|
};
|
|
serif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
sansSerif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
monospace = {
|
|
package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; };
|
|
name = "FiraCode Nerd Font Mono";
|
|
};
|
|
|
|
emoji = {
|
|
package = pkgs.noto-fonts-emoji;
|
|
name = "Noto Color Emoji";
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
# Configure keymap in X11 (only used for login)
|
|
services.xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
users.users.TEMPLATE = {
|
|
isNormalUser = true;
|
|
description = "TEMPLATE";
|
|
extraGroups = [ "networkmanager" "wheel" "lp" "audio" "video" ];
|
|
packages = with pkgs; [ ];
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:a08e51ee-88eb-4241-917d-68b4bdbcf171"></a>Home Manager<br />
|
|
<div class="outline-text-5" id="text-h:a08e51ee-88eb-4241-917d-68b4bdbcf171">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, ... }:
|
|
|
|
{
|
|
|
|
|
|
services.gpg-agent = {
|
|
enable = true;
|
|
enableSshSupport = true;
|
|
enableExtraSocket = true;
|
|
pinentryPackage = pkgs.pinentry.gtk2;
|
|
defaultCacheTtl = 600;
|
|
maxCacheTtl = 7200;
|
|
extraConfig = ''
|
|
allow-loopback-pinentry
|
|
allow-emacs-pinentry
|
|
'';
|
|
};
|
|
|
|
home = {
|
|
username = "TEMPLATE";
|
|
homeDirectory = "/home/TEMPLATE";
|
|
stateVersion = "23.05"; # TEMPLATE -- Please read the comment before changing.
|
|
keyboard.layout = "us"; # TEMPLATE
|
|
home.packages = with pkgs; [
|
|
# ---------------------------------------------------------------
|
|
# if schildichat works on this machine, use it, otherwise go for element
|
|
# element-desktop
|
|
# ---------------------------------------------------------------
|
|
];
|
|
};
|
|
# update path if the sops private key is stored somewhere else
|
|
sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
|
|
|
|
# waybar config - TEMPLATE - update for cores and temp
|
|
programs.waybar.settings.mainBar = {
|
|
#cpu.format = "{icon0} {icon1} {icon2} {icon3}";
|
|
cpu.format = "{icon0} {icon1} {icon2} {icon3} {icon4} {icon5} {icon6} {icon7}";
|
|
temperature.hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp3_input";
|
|
};
|
|
|
|
# -----------------------------------------------------------------
|
|
# is this machine always connected to power? If yes, use this block:
|
|
#
|
|
# programs.waybar.settings.mainBar."custom/pseudobat" = {
|
|
# format = "";
|
|
# on-click-right = "wlogout -p layer-shell";
|
|
# };
|
|
# programs.waybar.settings.mainBar.modules-right = [
|
|
# "custom/outer-left-arrow-dark"
|
|
# "mpris"
|
|
# "custom/left-arrow-light"
|
|
# "network"
|
|
# "custom/left-arrow-dark"
|
|
# "pulseaudio"
|
|
# "custom/left-arrow-light"
|
|
# "custom/pseudobat"
|
|
# "battery"
|
|
# "custom/left-arrow-dark"
|
|
# "group/hardware"
|
|
# "custom/left-arrow-light"
|
|
# "clock#2"
|
|
# "custom/left-arrow-dark"
|
|
# "clock#1"
|
|
# ];
|
|
#
|
|
# -----------------------------------------------------------------
|
|
|
|
# -----------------------------------------------------------------
|
|
# if not always connected to power (laptop), use this (default):
|
|
|
|
programs.waybar.settings.mainBar.modules-right = [
|
|
"custom/outer-left-arrow-dark"
|
|
"mpris"
|
|
"custom/left-arrow-light"
|
|
"network"
|
|
"custom/left-arrow-dark"
|
|
"pulseaudio"
|
|
"custom/left-arrow-light"
|
|
"custom/pseudobat"
|
|
"battery"
|
|
"custom/left-arrow-dark"
|
|
"group/hardware"
|
|
"custom/left-arrow-light"
|
|
"clock#2"
|
|
"custom/left-arrow-dark"
|
|
"clock#1"
|
|
];
|
|
|
|
# -----------------------------------------------------------------
|
|
|
|
wayland.windowManager.sway = {
|
|
config = rec {
|
|
# update for actual inputs here,
|
|
input = {
|
|
"36125:53060:splitkb.com_Kyria_rev3" = {
|
|
xkb_layout = "us";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"1:1:AT_Translated_Set_2_keyboard" = {
|
|
# TEMPLATE
|
|
xkb_layout = "us";
|
|
xkb_options = "grp:win_space_toggle";
|
|
# xkb_options = "ctrl:nocaps,grp:win_space_toggle";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"type:touchpad" = {
|
|
dwt = "enabled";
|
|
tap = "enabled";
|
|
natural_scroll = "enabled";
|
|
middle_emulation = "enabled";
|
|
};
|
|
|
|
};
|
|
|
|
output = {
|
|
DP-1 = {
|
|
mode = "2560x1440"; # TEMPLATE
|
|
scale = "1";
|
|
bg = "~/.dotfiles/wallpaper/TEMPLATE.png fill";
|
|
};
|
|
};
|
|
|
|
keybindings =
|
|
let
|
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
|
in
|
|
{
|
|
# TEMPLATE
|
|
"${modifier}+w" = "exec \"bash ~/.dotfiles/scripts/checkschildi.sh\"";
|
|
# "${modifier}+w" = "exec \"bash ~/.dotfiles/scripts/checkelement.sh\"";
|
|
};
|
|
|
|
startup = [
|
|
|
|
{ command = "nextcloud --background"; }
|
|
{ command = "discord --start-minimized"; }
|
|
{ command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
|
|
{ command = "ANKI_WAYLAND=1 anki"; }
|
|
{ command = "OBSIDIAN_USE_WAYLAND=1 obsidian"; }
|
|
{ command = "nm-applet"; }
|
|
|
|
];
|
|
};
|
|
};
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:58dc6384-0d19-4f71-9043-4014bd033ba2" class="outline-4">
|
|
<h4 id="h:58dc6384-0d19-4f71-9043-4014bd033ba2"><span class="section-number-4">3.1.2.</span> Physical hosts</h4>
|
|
<div class="outline-text-4" id="text-h:58dc6384-0d19-4f71-9043-4014bd033ba2">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:60cf171f-2ec9-418f-8f67-85d159efe9d0"></a>Sandbox (Lenovo Y510P)<br />
|
|
<div class="outline-text-5" id="text-h:60cf171f-2ec9-418f-8f67-85d159efe9d0">
|
|
<p>
|
|
My old laptop, replaced by a new one, since most basic functions have stopped to work lately. However, it is still good as a dummy server for testing things out before having them go live.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:23b0f629-343c-42fa-bf9b-70bea341c0d2"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:23b0f629-343c-42fa-bf9b-70bea341c0d2">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, sops, ... }:
|
|
let
|
|
matrixDomain = "swatrix.swarsel.win";
|
|
in
|
|
{
|
|
|
|
imports = [
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
boot.loader.grub = {
|
|
enable = true;
|
|
device = "/dev/sda";
|
|
useOSProber = true;
|
|
supportedFilesystems = [ "zfs" ];
|
|
zfs.forceImportRoot = false;
|
|
kernelModules = [ "tun" ];
|
|
kernel.sysctl = {
|
|
"net.ipv4.conf.all.rp_filter" = 2;
|
|
"net.ipv4.conf.default.rp_filter" = 2;
|
|
"net.ipv4.conf.enp7s0.rp_filter" = 2;
|
|
};
|
|
};
|
|
|
|
networking = {
|
|
hostId = "8a8ad84a";
|
|
hostName = "sandbox"; # Define your hostname.
|
|
enableIPv6 = true;
|
|
firewall.enable = false;
|
|
firewall.extraCommands = ''
|
|
sudo iptables -A OUTPUT ! -o lo -m owner --uid-owner vpn -j DROP
|
|
'';
|
|
iproute2 = {
|
|
enable = true;
|
|
rttablesExtraConfig = ''
|
|
200 vpn
|
|
'';
|
|
};
|
|
};
|
|
|
|
hardware.graphics = {
|
|
enable = true;
|
|
hardware.enableAllFirmware = true;
|
|
extraPackages = with pkgs; [
|
|
intel-media-driver # LIBVA_DRIVER_NAME=iHD
|
|
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
|
|
vaapiVdpau
|
|
libvdpau-va-gl
|
|
];
|
|
};
|
|
|
|
sound = {
|
|
enable = true;
|
|
};
|
|
|
|
users = {
|
|
groups = {
|
|
vpn = { };
|
|
mpd = { };
|
|
navidrome = {
|
|
gid = 61593;
|
|
};
|
|
spotifyd = {
|
|
gid = 65136;
|
|
};
|
|
};
|
|
users = {
|
|
jellyfin = {
|
|
extraGroups = [ "video" "render" ];
|
|
};
|
|
vpn = {
|
|
isNormalUser = true;
|
|
group = "vpn";
|
|
home = "/home/vpn";
|
|
};
|
|
navidrome = {
|
|
isSystemUser = true;
|
|
uid = 61593;
|
|
group = "navidrome";
|
|
extraGroups = [ "audio" "utmp" ];
|
|
};
|
|
spotifyd = {
|
|
isSystemUser = true;
|
|
uid = 65136;
|
|
group = "spotifyd";
|
|
extraGroups = [ "audio" "utmp" ];
|
|
};
|
|
mpd = {
|
|
isSystemUser = true;
|
|
group = "mpd";
|
|
extraGroups = [ "audio" "utmp" ];
|
|
};
|
|
swarsel = {
|
|
isNormalUser = true;
|
|
description = "Leon S";
|
|
extraGroups = [ "networkmanager" "wheel" "lp" ];
|
|
packages = with pkgs; [ ];
|
|
};
|
|
root = {
|
|
openssh.authorizedKeys.keyFiles = [
|
|
../../secrets/keys/authorized_keys
|
|
];
|
|
};
|
|
};
|
|
};
|
|
|
|
fileSystems."/mnt/Eternor" = {
|
|
device = "//192.168.1.3/Eternor";
|
|
fsType = "cifs";
|
|
options =
|
|
let
|
|
# this line prevents hanging on network split
|
|
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
|
|
in
|
|
[ "${automount_opts},credentials=/etc/nixos/smb-secrets,uid=1000,gid=100" ];
|
|
};
|
|
|
|
environment = {
|
|
systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
lego
|
|
nginx
|
|
calibre
|
|
openvpn
|
|
jq
|
|
iptables
|
|
busybox
|
|
wireguard-tools
|
|
matrix-synapse
|
|
lottieconverter
|
|
ffmpeg
|
|
pciutils
|
|
alsa-utils
|
|
mpv
|
|
zfs
|
|
];
|
|
etc = {
|
|
"openvpn/iptables.sh" =
|
|
{
|
|
source = ../../scripts/server1/iptables.sh;
|
|
mode = "0755";
|
|
};
|
|
"openvpn/update-resolv-conf" =
|
|
{
|
|
source = ../../scripts/server1/update-resolv-conf;
|
|
mode = "0755";
|
|
};
|
|
"openvpn/routing.sh" =
|
|
{
|
|
source = ../../scripts/server1/routing.sh;
|
|
mode = "0755";
|
|
};
|
|
"openvpn/ca.rsa.2048.crt" =
|
|
{
|
|
source = ../../secrets/certs/ca.rsa.2048.crt;
|
|
mode = "0644";
|
|
};
|
|
"openvpn/crl.rsa.2048.pem" =
|
|
{
|
|
source = ../../secrets/certs/crl.rsa.2048.pem;
|
|
mode = "0644";
|
|
};
|
|
};
|
|
shellAliases = {
|
|
nswitch = "cd ~/.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
};
|
|
|
|
systemd = {
|
|
timers."restart-bridges" = {
|
|
wantedBy = [ "timers.target" ];
|
|
timerConfig = {
|
|
OnBootSec = "1d";
|
|
OnUnitActiveSec = "1d";
|
|
Unit = "restart-bridges.service";
|
|
};
|
|
};
|
|
|
|
services."restart-bridges" = {
|
|
script = ''
|
|
systemctl restart mautrix-whatsapp.service
|
|
systemctl restart mautrix-signal.service
|
|
systemctl restart mautrix-telegram.service
|
|
'';
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
User = "root";
|
|
};
|
|
};
|
|
};
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
documentation = {
|
|
enable = false;
|
|
};
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/root/.dotfiles/secrets/sandbox/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets = {
|
|
dnstokenfull = { owner = "acme"; };
|
|
kavita = { owner = "kavita"; };
|
|
vpnuser = { };
|
|
rpcuser = { owner = "vpn"; };
|
|
vpnpass = { };
|
|
rpcpass = { owner = "vpn"; };
|
|
vpnprot = { };
|
|
vpnloc = { };
|
|
mpdpass = { owner = "mpd"; };
|
|
};
|
|
templates = {
|
|
"transmission-rpc" = {
|
|
owner = "vpn";
|
|
content = builtins.toJSON {
|
|
rpc-username = config.sops.placeholder.rpcuser;
|
|
rpc-password = config.sops.placeholder.rpcpass;
|
|
};
|
|
};
|
|
|
|
pia.content = ''
|
|
${config.sops.placeholder.vpnuser}
|
|
${config.sops.placeholder.vpnpass}
|
|
'';
|
|
|
|
vpn.content = ''
|
|
client
|
|
dev tun
|
|
proto ${config.sops.placeholder.vpnprot}
|
|
remote ${config.sops.placeholder.vpnloc}
|
|
resolv-retry infinite
|
|
nobind
|
|
persist-key
|
|
persist-tun
|
|
cipher aes-128-cbc
|
|
auth sha1
|
|
tls-client
|
|
remote-cert-tls server
|
|
|
|
auth-user-pass ${config.sops.templates.pia.path}
|
|
compress
|
|
verb 1
|
|
reneg-sec 0
|
|
|
|
crl-verify /etc/openvpn/crl.rsa.2048.pem
|
|
ca /etc/openvpn/ca.rsa.2048.crt
|
|
|
|
disable-occ
|
|
'';
|
|
"certs.secret".content = ''
|
|
CF_DNS_API_TOKEN=${config.sops.placeholder.dnstokenfull}
|
|
'';
|
|
};
|
|
};
|
|
|
|
security.acme = {
|
|
acceptTerms = true;
|
|
preliminarySelfsigned = false;
|
|
defaults.email = "mrswarsel@gmail.com";
|
|
defaults.dnsProvider = "cloudflare";
|
|
defaults.environmentFile = "${config.sops.templates."certs.secret".path}";
|
|
};
|
|
|
|
services = {
|
|
xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
listenAddresses = [{
|
|
port = 22;
|
|
addr = "0.0.0.0";
|
|
}];
|
|
};
|
|
|
|
nginx = {
|
|
enable = true;
|
|
recommendedProxySettings = true;
|
|
recommendedTlsSettings = true;
|
|
recommendedOptimisation = true;
|
|
recommendedGzipSettings = true;
|
|
virtualHosts = {
|
|
|
|
"stash.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "https://192.168.1.5";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
"/.well-known/carddav" = {
|
|
return = "301 $scheme://$host/remote.php/dav";
|
|
};
|
|
"/.well-known/caldav" = {
|
|
return = "301 $scheme://$host/remote.php/dav";
|
|
};
|
|
};
|
|
};
|
|
|
|
"swatrix.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"~ ^(/_matrix|/_synapse/client)" = {
|
|
proxyPass = "http://127.0.0.1:8008";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
"sound.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://127.0.0.1:4040";
|
|
proxyWebsockets = true;
|
|
extraConfig = ''
|
|
proxy_redirect http:// https://;
|
|
proxy_read_timeout 600s;
|
|
proxy_send_timeout 600s;
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"scan.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://127.0.0.1:28981";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"screen.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://127.0.0.1:8096";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"scroll.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://127.0.0.1:8080";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
kavita = {
|
|
enable = true;
|
|
user = "kavita";
|
|
port = 8080;
|
|
tokenKeyFile = config.sops.secrets.kavita.path;
|
|
};
|
|
|
|
jellyfin = {
|
|
enable = true;
|
|
user = "jellyfin";
|
|
};
|
|
|
|
radarr = {
|
|
enable = true;
|
|
};
|
|
readarr = {
|
|
enable = true;
|
|
};
|
|
sonarr = {
|
|
enable = true;
|
|
};
|
|
lidarr = {
|
|
enable = true;
|
|
};
|
|
prowlarr = {
|
|
enable = true;
|
|
};
|
|
openvpn.servers = {
|
|
pia = {
|
|
autoStart = true;
|
|
updateResolvConf = false;
|
|
config = "config ${config.sops.templates.vpn.path}";
|
|
};
|
|
};
|
|
transmission = {
|
|
enable = true;
|
|
credentialsFile = config.sops.templates."transmission-rpc".path;
|
|
user = "vpn";
|
|
settings = {
|
|
alt-speed-down = 8000;
|
|
alt-speed-enabled = false;
|
|
alt-speed-time-begin = 0;
|
|
alt-speed-time-day = 127;
|
|
alt-speed-time-enabled = true;
|
|
alt-speed-time-end = 360;
|
|
alt-speed-up = 2000;
|
|
bind-address-ipv4 = "0.0.0.0";
|
|
bind-address-ipv6 = "::";
|
|
blocklist-enabled = false;
|
|
blocklist-url = "http://www.example.com/blocklist";
|
|
cache-size-mb = 256;
|
|
dht-enabled = false;
|
|
download-dir = "/test";
|
|
download-limit = 100;
|
|
download-limit-enabled = 0;
|
|
download-queue-enabled = true;
|
|
download-queue-size = 5;
|
|
encryption = 2;
|
|
idle-seeding-limit = 30;
|
|
idle-seeding-limit-enabled = false;
|
|
incomplete-dir = "/var/lib/transmission-daemon/Downloads";
|
|
incomplete-dir-enabled = false;
|
|
lpd-enabled = false;
|
|
max-peers-global = 200;
|
|
message-level = 1;
|
|
peer-congestion-algorithm = "";
|
|
peer-id-ttl-hours = 6;
|
|
peer-limit-global = 100;
|
|
peer-limit-per-torrent = 40;
|
|
peer-port = 22371;
|
|
peer-port-random-high = 65535;
|
|
peer-port-random-low = 49152;
|
|
peer-port-random-on-start = false;
|
|
peer-socket-tos = "default";
|
|
pex-enabled = false;
|
|
port-forwarding-enabled = false;
|
|
preallocation = 1;
|
|
prefetch-enabled = true;
|
|
queue-stalled-enabled = true;
|
|
queue-stalled-minutes = 30;
|
|
ratio-limit = 2;
|
|
ratio-limit-enabled = false;
|
|
rename-partial-files = true;
|
|
rpc-authentication-required = true;
|
|
rpc-bind-address = "0.0.0.0";
|
|
rpc-enabled = true;
|
|
rpc-host-whitelist = "";
|
|
rpc-host-whitelist-enabled = true;
|
|
rpc-port = 9091;
|
|
rpc-url = "/transmission/";
|
|
rpc-whitelist = "127.0.0.1,192.168.3.2";
|
|
rpc-whitelist-enabled = true;
|
|
scrape-paused-torrents-enabled = true;
|
|
script-torrent-done-enabled = false;
|
|
seed-queue-enabled = false;
|
|
seed-queue-size = 10;
|
|
speed-limit-down = 6000;
|
|
speed-limit-down-enabled = true;
|
|
speed-limit-up = 500;
|
|
speed-limit-up-enabled = true;
|
|
start-added-torrents = true;
|
|
trash-original-torrent-files = false;
|
|
umask = 2;
|
|
upload-limit = 100;
|
|
upload-limit-enabled = 0;
|
|
upload-slots-per-torrent = 14;
|
|
utp-enabled = false;
|
|
};
|
|
};
|
|
|
|
# sops.secrets.matrixsharedsecret = {owner="matrix-synapse";};
|
|
# sops.templates."matrix_user_register.sh".content = ''
|
|
# register_new_matrix_user -k ${config.sops.placeholder.matrixsharedsecret} http://localhost:8008
|
|
# '';
|
|
# sops.templates.matrixshared.owner = "matrix-synapse";
|
|
# sops.templates.matrixshared.content = ''
|
|
# registration_shared_secret: ${config.sops.placeholder.matrixsharedsecret}
|
|
# '';
|
|
# sops.secrets.mautrixtelegram_as = {owner="matrix-synapse";};
|
|
# sops.secrets.mautrixtelegram_hs = {owner="matrix-synapse";};
|
|
# sops.secrets.mautrixtelegram_api_id = {owner="matrix-synapse";};
|
|
# sops.secrets.mautrixtelegram_api_hash = {owner="matrix-synapse";};
|
|
# sops.templates.mautrixtelegram.owner = "matrix-synapse";
|
|
# sops.templates.mautrixtelegram.content = ''
|
|
# MAUTRIX_TELEGRAM_APPSERVICE_AS_TOKEN=${config.sops.placeholder.mautrixtelegram_as}
|
|
# MAUTRIX_TELEGRAM_APPSERVICE_HS_TOKEN=${config.sops.placeholder.mautrixtelegram_hs}
|
|
# MAUTRIX_TELEGRAM_TELEGRAM_API_ID=${config.sops.placeholder.mautrixtelegram_api_id}
|
|
# MAUTRIX_TELEGRAM_TELEGRAM_API_HASH=${config.sops.placeholder.mautrixtelegram_api_hash}
|
|
# '';
|
|
|
|
|
|
|
|
|
|
# ----------------
|
|
# sops.secrets.mautrixwhatsapp_shared = {owner="matrix-synapse";};
|
|
# sops.templates.mautrixwhatsapp.owner = "matrix-synapse";
|
|
# sops.templates.mautrixwhatsapp.content = ''
|
|
# MAUTRIX_WHATSAPP_BRIDGE_LOGIN_SHARED_SECRET=${config.sops.placeholder.mautrixwhatsapp_shared}
|
|
# '';
|
|
|
|
postgresql = {
|
|
enable = true;
|
|
initialScript = pkgs.writeText "synapse-init.sql" ''
|
|
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse';
|
|
CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-telegram" WITH LOGIN PASSWORD 'telegram';
|
|
CREATE DATABASE "mautrix-telegram" WITH OWNER "mautrix-telegram"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-whatsapp" WITH LOGIN PASSWORD 'whatsapp';
|
|
CREATE DATABASE "mautrix-whatsapp" WITH OWNER "mautrix-whatsapp"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-signal" WITH LOGIN PASSWORD 'signal';
|
|
CREATE DATABASE "mautrix-signal" WITH OWNER "mautrix-signal"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
'';
|
|
};
|
|
matrix-synapse = {
|
|
settings.app_service_config_files = [
|
|
"/var/lib/matrix-synapse/telegram-registration.yaml"
|
|
"/var/lib/matrix-synapse/whatsapp-registration.yaml"
|
|
"/var/lib/matrix-synapse/signal-registration.yaml"
|
|
"/var/lib/matrix-synapse/doublepuppet.yaml"
|
|
];
|
|
enable = false;
|
|
settings.server_name = matrixDomain;
|
|
settings.public_baseurl = "https://${matrixDomain}";
|
|
extraConfigFiles = [
|
|
config.sops.templates.matrixshared.path
|
|
];
|
|
settings.listeners = [
|
|
{
|
|
port = 8008;
|
|
bind_addresses = [ "0.0.0.0" ];
|
|
type = "http";
|
|
tls = false;
|
|
x_forwarded = true;
|
|
resources = [
|
|
{
|
|
names = [ "client" "federation" ];
|
|
compress = true;
|
|
}
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
mautrix-telegram = {
|
|
enable = false;
|
|
environmentFile = config.sops.templates.mautrixtelegram.path;
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
address = "http://localhost:29317";
|
|
hostname = "0.0.0.0";
|
|
port = "29317";
|
|
provisioning.enabled = true;
|
|
id = "telegram";
|
|
# ephemeral_events = true; # not needed due to double puppeting
|
|
public = {
|
|
enabled = false;
|
|
};
|
|
database = "postgresql:///mautrix-telegram?host=/run/postgresql";
|
|
};
|
|
bridge = {
|
|
# login_shared_secret_map = {
|
|
# matrixDomain = "as_token:doublepuppet";
|
|
# };
|
|
relaybot.authless_portals = true;
|
|
allow_avatar_remove = true;
|
|
allow_contact_info = true;
|
|
sync_channel_members = true;
|
|
startup_sync = true;
|
|
sync_create_limit = 0;
|
|
sync_direct_chats = true;
|
|
telegram_link_preview = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
animated_sticker = {
|
|
target = "gif";
|
|
args = {
|
|
width = 256;
|
|
height = 256;
|
|
fps = 30; # only for webm
|
|
background = "020202"; # only for gif, transparency not supported
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
mautrix-whatsapp = {
|
|
enable = false;
|
|
# environmentFile = config.sops.templates.mautrixwhatsapp.path;
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
address = "http://localhost:29318";
|
|
hostname = "0.0.0.0";
|
|
port = 29318;
|
|
database = {
|
|
type = "postgres";
|
|
uri = "postgresql:///mautrix-whatsapp?host=/run/postgresql";
|
|
};
|
|
};
|
|
bridge = {
|
|
displayname_template = "{{or .FullName .PushName .JID}} (WA)";
|
|
history_sync = {
|
|
backfill = true;
|
|
max_initial_conversations = -1;
|
|
message_count = -1;
|
|
request_full_sync = true;
|
|
full_sync_config = {
|
|
days_limit = 900;
|
|
size_mb_limit = 5000;
|
|
storage_quota_mb = 5000;
|
|
};
|
|
};
|
|
login_shared_secret_map = {
|
|
matrixDomain = "as_token:doublepuppet";
|
|
};
|
|
sync_manual_marked_unread = true;
|
|
send_presence_on_typing = true;
|
|
parallel_member_sync = true;
|
|
url_previews = true;
|
|
caption_in_message = true;
|
|
extev_polls = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
mautrix-signal = {
|
|
enable = false;
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
|
|
address = "http://localhost:29328";
|
|
hostname = "0.0.0.0";
|
|
port = 29328;
|
|
database = {
|
|
type = "postgres";
|
|
uri = "postgresql:///mautrix-signal?host=/run/postgresql";
|
|
};
|
|
};
|
|
bridge = {
|
|
displayname_template = "{{or .ContactName .ProfileName .PhoneNumber}} (Signal)";
|
|
login_shared_secret_map = {
|
|
matrixDomain = "as_token:doublepuppet";
|
|
};
|
|
caption_in_message = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
navidrome = {
|
|
enable = true;
|
|
settings = {
|
|
Address = "0.0.0.0";
|
|
Port = 4040;
|
|
MusicFolder = "/mnt/";
|
|
EnableSharing = true;
|
|
EnableTranscodingConfig = true;
|
|
Scanner.GroupAlbumReleases = true;
|
|
ScanSchedule = "@every 24h";
|
|
# Insert these values locally as sops-nix does not work for them
|
|
# LastFM.ApiKey = TEMPLATE;
|
|
# LastFM.Secret = TEMPLATE;
|
|
# Spotify.ID = TEMPLATE;
|
|
# Spotify.Secret = TEMPLATE;
|
|
UILoginBackgroundUrl = "https://i.imgur.com/OMLxi7l.png";
|
|
UIWelcomeMessage = "~SwarselSound~";
|
|
};
|
|
};
|
|
mpd = {
|
|
enable = true;
|
|
musicDirectory = "/mnt/Eternor/Musik";
|
|
user = "mpd";
|
|
group = "mpd";
|
|
network = {
|
|
port = 3254;
|
|
listenAddress = "any";
|
|
};
|
|
credentials = [
|
|
{
|
|
passwordFile = config.sops.secrets.mpdpass.path;
|
|
permissions = [
|
|
"read"
|
|
"add"
|
|
"control"
|
|
"admin"
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
|
|
spotifyd = {
|
|
enable = true;
|
|
settings = {
|
|
global = {
|
|
dbus_type = "session";
|
|
use_mpris = false;
|
|
device = "default:CARD=PCH";
|
|
device_name = "SwarselSpot";
|
|
mixer = "alsa";
|
|
zeroconf_port = 1025;
|
|
};
|
|
};
|
|
};
|
|
|
|
# Network shares
|
|
# add a user with sudo smbpasswd -a <user>
|
|
samba = {
|
|
package = pkgs.samba4Full;
|
|
extraConfig = ''
|
|
workgroup = WORKGROUP
|
|
server role = standalone server
|
|
dns proxy = no
|
|
|
|
pam password change = yes
|
|
map to guest = bad user
|
|
create mask = 0664
|
|
force create mode = 0664
|
|
directory mask = 0775
|
|
force directory mode = 0775
|
|
follow symlinks = yes
|
|
'';
|
|
|
|
# ^^ `samba4Full` is compiled with avahi, ldap, AD etc support compared to the default package, `samba`
|
|
# Required for samba to register mDNS records for auto discovery
|
|
# See https://github.com/NixOS/nixpkgs/blob/592047fc9e4f7b74a4dc85d1b9f5243dfe4899e3/pkgs/top-level/all-packages.nix#L27268
|
|
enable = true;
|
|
# openFirewall = true;
|
|
shares.test = {
|
|
browseable = "yes";
|
|
"read only" = "no";
|
|
"guest ok" = "no";
|
|
path = "/test2";
|
|
writable = "true";
|
|
comment = "Eternor";
|
|
"valid users" = "@smbtest2";
|
|
};
|
|
};
|
|
|
|
|
|
avahi = {
|
|
publish.enable = true;
|
|
publish.userServices = true;
|
|
# ^^ Needed to allow samba to automatically register mDNS records without the need for an `extraServiceFile`
|
|
nssmdns = true;
|
|
# ^^ Not one hundred percent sure if this is needed- if it aint broke, don't fix it
|
|
enable = true;
|
|
};
|
|
|
|
samba-wsdd = {
|
|
# This enables autodiscovery on windows since SMB1 (and thus netbios) support was discontinued
|
|
enable = true;
|
|
};
|
|
};
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:7b1a8f91-ef43-433c-ba4c-c5baf50e1de4"></a>Threed (Surface Pro 3)<br />
|
|
<div class="outline-text-5" id="text-h:7b1a8f91-ef43-433c-ba4c-c5baf50e1de4">
|
|
<p>
|
|
New setup for the SP3, this time using NixOS - another machine will take over the HM-only config for compatibility in the future.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:980f1aca-28b3-4ed7-ae7f-6d8cdc28dea1"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:980f1aca-28b3-4ed7-ae7f-6d8cdc28dea1">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ lib, pkgs, ... }:
|
|
|
|
{
|
|
|
|
imports =
|
|
[
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
|
|
services = {
|
|
getty.autologinUser = "swarsel";
|
|
greetd.settings.initial_session.user = "swarsel";
|
|
};
|
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
# Bootloader
|
|
boot = {
|
|
loader.systemd-boot.enable = lib.mkForce false;
|
|
lanzaboote = {
|
|
enable = true;
|
|
pkiBundle = "/etc/secureboot";
|
|
};
|
|
loader.efi.canTouchEfiVariables = true;
|
|
# use bootspec instead of lzbt for secure boot. This is not a generally needed setting
|
|
bootspec.enable = true;
|
|
# kernelPackages = pkgs.linuxPackages_latest;
|
|
};
|
|
|
|
networking = {
|
|
hostName = "threed";
|
|
enableIPv6 = false;
|
|
firewall.enable = false;
|
|
};
|
|
|
|
stylix.image = ../../wallpaper/surfacewp.png;
|
|
|
|
stylix = {
|
|
enable = true;
|
|
base16Scheme = ../../wallpaper/swarsel.yaml;
|
|
# base16Scheme = "${pkgs.base16-schemes}/share/themes/shapeshifter.yaml";
|
|
polarity = "dark";
|
|
opacity.popups = 0.5;
|
|
cursor = {
|
|
package = pkgs.capitaine-cursors;
|
|
name = "capitaine-cursors";
|
|
size = 16;
|
|
};
|
|
fonts = {
|
|
sizes = {
|
|
terminal = 10;
|
|
applications = 11;
|
|
};
|
|
serif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
sansSerif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
monospace = {
|
|
package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; };
|
|
name = "FiraCode Nerd Font Mono";
|
|
};
|
|
|
|
emoji = {
|
|
package = pkgs.noto-fonts-emoji;
|
|
name = "Noto Color Emoji";
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
users.users.swarsel = {
|
|
isNormalUser = true;
|
|
description = "Leon S";
|
|
extraGroups = [ "networkmanager" "wheel" "lp" "audio" "video" ];
|
|
packages = with pkgs; [ ];
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
];
|
|
|
|
system.stateVersion = "23.05";
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:449c20d8-338a-483c-a6f0-9a164a6071d6"></a>Home Manager<br />
|
|
<div class="outline-text-6" id="text-h:449c20d8-338a-483c-a6f0-9a164a6071d6">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, ... }:
|
|
|
|
{
|
|
|
|
|
|
services.gpg-agent = {
|
|
enable = true;
|
|
enableSshSupport = true;
|
|
enableExtraSocket = true;
|
|
pinentryPackage = pkgs.pinentry.gtk2;
|
|
defaultCacheTtl = 600;
|
|
maxCacheTtl = 7200;
|
|
extraConfig = ''
|
|
allow-loopback-pinentry
|
|
allow-emacs-pinentry
|
|
'';
|
|
};
|
|
|
|
|
|
home = {
|
|
username = "swarsel";
|
|
homeDirectory = "/home/swarsel";
|
|
stateVersion = "23.05"; # Please read the comment before changing.
|
|
keyboard.layout = "us";
|
|
packages = with pkgs; [
|
|
];
|
|
};
|
|
|
|
sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
|
|
|
|
programs.waybar.settings.mainBar = {
|
|
cpu.format = "{icon0} {icon1} {icon2} {icon3}";
|
|
temperature.hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon1/temp3_input";
|
|
};
|
|
|
|
programs.waybar.settings.mainBar.modules-right = [
|
|
"custom/outer-left-arrow-dark"
|
|
"mpris"
|
|
"custom/left-arrow-light"
|
|
"network"
|
|
"custom/left-arrow-dark"
|
|
"pulseaudio"
|
|
"custom/left-arrow-light"
|
|
"custom/pseudobat"
|
|
"battery"
|
|
"custom/left-arrow-dark"
|
|
"group/hardware"
|
|
"custom/left-arrow-light"
|
|
"clock#2"
|
|
"custom/left-arrow-dark"
|
|
"clock#1"
|
|
];
|
|
|
|
|
|
wayland.windowManager.sway = {
|
|
config = rec {
|
|
input = {
|
|
"*" = {
|
|
xkb_layout = "us";
|
|
xkb_options = "grp:win_space_toggle";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"type:touchpad" = {
|
|
dwt = "enabled";
|
|
tap = "enabled";
|
|
natural_scroll = "enabled";
|
|
middle_emulation = "enabled";
|
|
};
|
|
};
|
|
|
|
output = {
|
|
eDP-1 = {
|
|
mode = "2160x1440@59.955Hz";
|
|
scale = "1";
|
|
bg = "~/.dotfiles/wallpaper/surfacewp.png fill";
|
|
};
|
|
};
|
|
|
|
keybindings =
|
|
let
|
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
|
in
|
|
{
|
|
"${modifier}+F2" = "exec brightnessctl set +5%";
|
|
"${modifier}+F1" = "exec brightnessctl set 5%-";
|
|
"${modifier}+n" = "exec sway output eDP-1 transform normal, splith";
|
|
"${modifier}+Ctrl+p" = "exec wl-mirror eDP-1";
|
|
"${modifier}+t" = "exec sway output eDP-1 transform 90, splitv";
|
|
"${modifier}+XF86AudioLowerVolume" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
|
|
"${modifier}+XF86AudioRaiseVolume" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
|
|
"${modifier}+w" = "exec \"bash ~/.dotfiles/scripts/checkschildi.sh\"";
|
|
};
|
|
|
|
startup = [
|
|
|
|
{ command = "nextcloud --background"; }
|
|
{ command = "discord --start-minimized"; }
|
|
{ command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
|
|
{ command = "ANKI_WAYLAND=1 anki"; }
|
|
{ command = "OBSIDIAN_USE_WAYLAND=1 obsidian"; }
|
|
{ command = "nm-applet"; }
|
|
|
|
];
|
|
|
|
keycodebindings = {
|
|
"124" = "exec systemctl suspend";
|
|
};
|
|
};
|
|
|
|
extraConfig = "
|
|
exec swaymsg input 7062:6917:NTRG0001:01_1B96:1B05 map_to_output eDP-1
|
|
exec swaymsg input 7062:6917:NTRG0001:01_1B96:1B05_Stylus map_to_output eDP-1
|
|
";
|
|
};
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:6c6e9261-dfa1-42d8-ab2a-8b7c227be6d9"></a>Fourside (Lenovo Thinkpad P14s Gen2)<br />
|
|
<div class="outline-text-5" id="text-h:6c6e9261-dfa1-42d8-ab2a-8b7c227be6d9">
|
|
<p>
|
|
My new main machine.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:ab6fefc4-aabd-456c-8a21-5fcb20c02869"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:ab6fefc4-aabd-456c-8a21-5fcb20c02869">
|
|
<p>
|
|
Mostly just sets some opened ports for several games, enables virtualbox (which I do not want everywhere because of resource considerations) and enables thinkfan, which allows for better fan control on Lenovo Thinkpad machines.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, ... }:
|
|
|
|
{
|
|
|
|
#
|
|
# imports =
|
|
# [
|
|
# ./hardware-configuration.nix
|
|
# ];
|
|
#
|
|
imports =
|
|
[
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
services = {
|
|
getty.autologinUser = "swarsel";
|
|
greetd.settings.initial_session.user = "swarsel";
|
|
};
|
|
|
|
boot = {
|
|
loader.systemd-boot.enable = true;
|
|
loader.efi.canTouchEfiVariables = true;
|
|
# kernelPackages = pkgs.linuxPackages_latest;
|
|
};
|
|
|
|
sops.age.sshKeyPaths = [ "${config.users.users.swarsel.home}/.ssh/sops" ];
|
|
|
|
networking = {
|
|
hostName = "fourside"; # Define your hostname.
|
|
nftables.enable = true;
|
|
enableIPv6 = false;
|
|
firewall.checkReversePath = false;
|
|
firewall = {
|
|
enable = true;
|
|
allowedUDPPorts = [ 4380 27036 14242 34197 51820 ]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard
|
|
allowedTCPPorts = [ ]; # 34197: factorio; 4380 27036 14242: barotrauma; 51820: wireguard
|
|
allowedTCPPortRanges = [
|
|
{ from = 27015; to = 27030; } # barotrauma
|
|
{ from = 27036; to = 27037; } # barotrauma
|
|
];
|
|
allowedUDPPortRanges = [
|
|
{ from = 27000; to = 27031; } # barotrauma
|
|
{ from = 58962; to = 58964; } # barotrauma
|
|
];
|
|
};
|
|
};
|
|
|
|
virtualisation.virtualbox = {
|
|
host = {
|
|
enable = true;
|
|
enableExtensionPack = true;
|
|
};
|
|
# leaving this here for future notice. setting guest.enable = true will make 'restarting sysinit-reactivation.target' take till timeout on nixos-rebuild switch
|
|
guest = {
|
|
enable = false;
|
|
};
|
|
};
|
|
|
|
stylix.image = ../../wallpaper/lenovowp.png;
|
|
|
|
stylix = {
|
|
enable = true;
|
|
base16Scheme = ../../wallpaper/swarsel.yaml;
|
|
# base16Scheme = "${pkgs.base16-schemes}/share/themes/shapeshifter.yaml";
|
|
polarity = "dark";
|
|
opacity.popups = 0.5;
|
|
cursor = {
|
|
package = pkgs.capitaine-cursors;
|
|
name = "capitaine-cursors";
|
|
size = 16;
|
|
};
|
|
fonts = {
|
|
sizes = {
|
|
terminal = 10;
|
|
applications = 11;
|
|
};
|
|
serif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
sansSerif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
monospace = {
|
|
package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; };
|
|
name = "FiraCode Nerd Font Mono";
|
|
};
|
|
|
|
emoji = {
|
|
package = pkgs.noto-fonts-emoji;
|
|
name = "Noto Color Emoji";
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
hardware = {
|
|
graphics = {
|
|
enable = true;
|
|
enable32Bit = true;
|
|
extraPackages = with pkgs; [
|
|
vulkan-loader
|
|
vulkan-validation-layers
|
|
vulkan-extension-layer
|
|
];
|
|
};
|
|
bluetooth.enable = true;
|
|
trackpoint = {
|
|
enable = true;
|
|
device = "TPPS/2 Elan TrackPoint";
|
|
};
|
|
};
|
|
|
|
programs.steam = {
|
|
enable = true;
|
|
extraCompatPackages = [
|
|
pkgs.proton-ge-bin
|
|
];
|
|
};
|
|
|
|
# Configure keymap in X11 (only used for login)
|
|
|
|
services.thinkfan = {
|
|
enable = false;
|
|
};
|
|
services.power-profiles-daemon.enable = true;
|
|
services.fprintd.enable = true;
|
|
services.fwupd.enable = true;
|
|
|
|
services.nswitch-rcm = {
|
|
enable = true;
|
|
package = pkgs.fetchurl {
|
|
url = "https://github.com/Atmosphere-NX/Atmosphere/releases/download/1.3.2/fusee.bin";
|
|
hash = "sha256-5AXzNsny45SPLIrvWJA9/JlOCal5l6Y++Cm+RtlJppI=";
|
|
};
|
|
};
|
|
|
|
users.users.swarsel = {
|
|
isNormalUser = true;
|
|
description = "Leon S";
|
|
hashedPasswordFile = config.sops.secrets.swarseluser.path;
|
|
extraGroups = [ "networkmanager" "wheel" "lp" "audio" "video" "vboxusers" "scanner" ];
|
|
packages = with pkgs; [ ];
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
# gog games installing
|
|
heroic
|
|
# minecraft
|
|
temurin-bin-17
|
|
(prismlauncher.override {
|
|
glfw = pkgs.glfw-wayland-minecraft;
|
|
})
|
|
];
|
|
|
|
system.stateVersion = "23.05";
|
|
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:85f7110c-2f25-4506-b64a-fce29f29d0d0"></a>Home Manager<br />
|
|
<div class="outline-text-6" id="text-h:85f7110c-2f25-4506-b64a-fce29f29d0d0">
|
|
<p>
|
|
This is basically just adjusted to the core count, path to the <code>hwmon</code> (this was very bothersome on this machine due to changing address), as well as making use of the top-row function keys.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, ... }:
|
|
|
|
{
|
|
|
|
|
|
services.gpg-agent = {
|
|
enable = true;
|
|
enableSshSupport = true;
|
|
enableExtraSocket = true;
|
|
pinentryPackage = pkgs.pinentry.gtk2;
|
|
defaultCacheTtl = 600;
|
|
maxCacheTtl = 7200;
|
|
extraConfig = ''
|
|
allow-loopback-pinentry
|
|
allow-emacs-pinentry
|
|
'';
|
|
};
|
|
|
|
home = {
|
|
username = "swarsel";
|
|
homeDirectory = "/home/swarsel";
|
|
stateVersion = "23.05"; # TEMPLATE -- Please read the comment before changing.
|
|
keyboard.layout = "us"; # TEMPLATE
|
|
packages = with pkgs; [
|
|
];
|
|
};
|
|
sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
|
|
|
|
# waybar config - TEMPLATE - update for cores and temp
|
|
programs.waybar.settings.mainBar = {
|
|
cpu.format = "{icon0} {icon1} {icon2} {icon3} {icon4} {icon5} {icon6} {icon7}";
|
|
# temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon4/temp1_input";
|
|
temperature.hwmon-path.abs = "/sys/devices/platform/thinkpad_hwmon/hwmon/";
|
|
temperature.input-filename = "temp1_input";
|
|
};
|
|
|
|
|
|
programs.waybar.settings.mainBar.modules-right = [
|
|
"custom/outer-left-arrow-dark"
|
|
"mpris"
|
|
"custom/left-arrow-light"
|
|
"network"
|
|
"custom/left-arrow-dark"
|
|
"pulseaudio"
|
|
"custom/left-arrow-light"
|
|
"custom/pseudobat"
|
|
"battery"
|
|
"custom/left-arrow-dark"
|
|
"group/hardware"
|
|
"custom/left-arrow-light"
|
|
"clock#2"
|
|
"custom/left-arrow-dark"
|
|
"clock#1"
|
|
];
|
|
|
|
|
|
wayland.windowManager.sway = {
|
|
config = rec {
|
|
# update for actual inputs here,
|
|
input = {
|
|
"36125:53060:splitkb.com_Kyria_rev3" = {
|
|
xkb_layout = "us";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"1:1:AT_Translated_Set_2_keyboard" = {
|
|
# TEMPLATE
|
|
xkb_layout = "us";
|
|
xkb_options = "grp:win_space_toggle";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"type:touchpad" = {
|
|
dwt = "enabled";
|
|
tap = "enabled";
|
|
natural_scroll = "enabled";
|
|
middle_emulation = "enabled";
|
|
};
|
|
|
|
};
|
|
|
|
output = {
|
|
eDP-1 = {
|
|
mode = "1920x1080"; # TEMPLATE
|
|
scale = "1";
|
|
position = "1920,0";
|
|
# bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
|
|
};
|
|
DP-4 = {
|
|
mode = "2560x1440";
|
|
scale = "1";
|
|
# bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
|
|
position = "0,0";
|
|
};
|
|
};
|
|
|
|
workspaceOutputAssign = [
|
|
{ output = "eDP-1"; workspace = "1:一"; }
|
|
{ output = "DP-4"; workspace = "2:二"; }
|
|
];
|
|
|
|
|
|
keybindings =
|
|
let
|
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
|
in
|
|
{
|
|
"${modifier}+w" = "exec \"bash ~/.dotfiles/scripts/checkelement.sh\"";
|
|
"XF86MonBrightnessUp" = "exec brightnessctl set +5%";
|
|
"XF86MonBrightnessDown" = "exec brightnessctl set 5%-";
|
|
"XF86Display" = "exec wl-mirror eDP-1";
|
|
# these are left open to use
|
|
# "XF86WLAN" = "exec wl-mirror eDP-1";
|
|
# "XF86Messenger" = "exec wl-mirror eDP-1";
|
|
# "XF86Go" = "exec wl-mirror eDP-1";
|
|
# "XF86Favorites" = "exec wl-mirror eDP-1";
|
|
# "XF86HomePage" = "exec wtype -P Escape -p Escape";
|
|
# "XF86AudioLowerVolume" = "pactl set-sink-volume alsa_output.pci-0000_08_00.6.HiFi__hw_Generic_1__sink -5%";
|
|
# "XF86AudioRaiseVolume" = "pactl set-sink-volume alsa_output.pci-0000_08_00.6.HiFi__hw_Generic_1__sink +5% ";
|
|
"XF86AudioMute" = "pactl set-sink-mute alsa_output.pci-0000_08_00.6.HiFi__hw_Generic_1__sink toggle";
|
|
};
|
|
|
|
startup = [
|
|
|
|
{ command = "nextcloud --background"; }
|
|
{ command = "discord --start-minimized"; }
|
|
{ command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
|
|
{ command = "ANKI_WAYLAND=1 anki"; }
|
|
{ command = "OBSIDIAN_USE_WAYLAND=1 obsidian"; }
|
|
{ command = "nm-applet"; }
|
|
|
|
];
|
|
};
|
|
};
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:6c6e9261-dfa1-42d8-ab2a-8b7c227be6d9"></a>Winters (Framwork Laptop 16)<br />
|
|
<div class="outline-text-5" id="text-h:6c6e9261-dfa1-42d8-ab2a-8b7c227be6d9">
|
|
<p>
|
|
My work machine.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:ab6fefc4-aabd-456c-8a21-5fcb20c02869"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:ab6fefc4-aabd-456c-8a21-5fcb20c02869">
|
|
<p>
|
|
Mostly just sets some opened ports for several games, enables virtualbox (which I do not want everywhere because of resource considerations) and enables thinkfan, which allows for better fan control on Lenovo Thinkpad machines.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ pkgs, ... }:
|
|
|
|
{
|
|
|
|
#
|
|
# imports =
|
|
# [
|
|
# ./hardware-configuration.nix
|
|
# ];
|
|
#
|
|
imports =
|
|
[
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
services = {
|
|
getty.autologinUser = "swarsel";
|
|
greetd.settings.initial_session.user = "swarsel";
|
|
};
|
|
|
|
boot = {
|
|
loader.systemd-boot.enable = true;
|
|
loader.efi.canTouchEfiVariables = true;
|
|
kernelPackages = pkgs.linuxPackages_latest;
|
|
};
|
|
|
|
networking = {
|
|
hostName = "winters"; # Define your hostname.
|
|
nftables.enable = true;
|
|
enableIPv6 = true;
|
|
firewall.checkReversePath = "strict";
|
|
firewall = {
|
|
enable = true;
|
|
allowedUDPPorts = [ ];
|
|
allowedTCPPorts = [ ];
|
|
allowedTCPPortRanges = [
|
|
];
|
|
allowedUDPPortRanges = [
|
|
];
|
|
};
|
|
};
|
|
|
|
virtualisation.virtualbox = {
|
|
host = {
|
|
enable = true;
|
|
enableExtensionPack = true;
|
|
};
|
|
# leaving this here for future notice. setting guest.enable = true will make 'restarting sysinit-reactivation.target' take till timeout on nixos-rebuild switch
|
|
guest = {
|
|
enable = false;
|
|
};
|
|
};
|
|
|
|
stylix.image = ../../wallpaper/lenovowp.png;
|
|
|
|
stylix = {
|
|
enable = true;
|
|
base16Scheme = ../../wallpaper/swarsel.yaml;
|
|
# base16Scheme = "${pkgs.base16-schemes}/share/themes/shapeshifter.yaml";
|
|
polarity = "dark";
|
|
opacity.popups = 0.5;
|
|
cursor = {
|
|
package = pkgs.capitaine-cursors;
|
|
name = "capitaine-cursors";
|
|
size = 16;
|
|
};
|
|
fonts = {
|
|
sizes = {
|
|
terminal = 10;
|
|
applications = 11;
|
|
};
|
|
serif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
sansSerif = {
|
|
# package = (pkgs.nerdfonts.override { fonts = [ "FiraMono" "FiraCode"]; });
|
|
package = pkgs.cantarell-fonts;
|
|
# package = pkgs.montserrat;
|
|
name = "Cantarell";
|
|
# name = "FiraCode Nerd Font Propo";
|
|
# name = "Montserrat";
|
|
};
|
|
|
|
monospace = {
|
|
package = pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; };
|
|
name = "FiraCode Nerd Font Mono";
|
|
};
|
|
|
|
emoji = {
|
|
package = pkgs.noto-fonts-emoji;
|
|
name = "Noto Color Emoji";
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
hardware = {
|
|
graphics = {
|
|
enable = true;
|
|
enable32Bit = true;
|
|
extraPackages = with pkgs; [
|
|
];
|
|
};
|
|
bluetooth.enable = true;
|
|
};
|
|
|
|
programs.steam = {
|
|
enable = true;
|
|
extraCompatPackages = [
|
|
pkgs.proton-ge-bin
|
|
];
|
|
};
|
|
|
|
services.power-profiles-daemon.enable = true;
|
|
|
|
users.users.swarsel = {
|
|
isNormalUser = true;
|
|
description = "Leon S";
|
|
extraGroups = [ "networkmanager" "wheel" "lp" "audio" "video" "vboxusers" "scanner" ];
|
|
packages = with pkgs; [ ];
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
sbctl
|
|
# gog games installing
|
|
heroic
|
|
# minecraft
|
|
temurin-bin-17
|
|
(prismlauncher.override {
|
|
glfw = pkgs.glfw-wayland-minecraft;
|
|
})
|
|
];
|
|
|
|
system.stateVersion = "23.05";
|
|
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:85f7110c-2f25-4506-b64a-fce29f29d0d0"></a><span class="todo TODO">TODO</span> Home Manager<br />
|
|
<div class="outline-text-6" id="text-h:85f7110c-2f25-4506-b64a-fce29f29d0d0">
|
|
<p>
|
|
TODO: Adjust <code>hwmon</code> path, I/O modules and XF86 keys once laptop arrives.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, ... }:
|
|
|
|
{
|
|
|
|
|
|
services.gpg-agent = {
|
|
enable = true;
|
|
enableSshSupport = true;
|
|
enableExtraSocket = true;
|
|
pinentryPackage = pkgs.pinentry.gtk2;
|
|
defaultCacheTtl = 600;
|
|
maxCacheTtl = 7200;
|
|
extraConfig = ''
|
|
allow-loopback-pinentry
|
|
allow-emacs-pinentry
|
|
'';
|
|
};
|
|
|
|
home = {
|
|
username = "swarsel";
|
|
homeDirectory = "/home/swarsel";
|
|
stateVersion = "23.05"; # TEMPLATE -- Please read the comment before changing.
|
|
keyboard.layout = "us"; # TEMPLATE
|
|
packages = with pkgs; [
|
|
];
|
|
};
|
|
sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
|
|
|
|
# waybar config - TEMPLATE - update for cores and temp
|
|
programs.waybar.settings.mainBar = {
|
|
cpu.format = "{icon0} {icon1} {icon2} {icon3} {icon4} {icon5} {icon6} {icon7}";
|
|
|
|
temperature.hwmon-path.abs = "/sys/devices/platform/thinkpad_hwmon/hwmon/";
|
|
temperature.input-filename = "temp1_input";
|
|
};
|
|
|
|
|
|
programs.waybar.settings.mainBar.modules-right = [
|
|
"custom/outer-left-arrow-dark"
|
|
"mpris"
|
|
"custom/left-arrow-light"
|
|
"network"
|
|
"custom/left-arrow-dark"
|
|
"pulseaudio"
|
|
"custom/left-arrow-light"
|
|
"custom/pseudobat"
|
|
"battery"
|
|
"custom/left-arrow-dark"
|
|
"group/hardware"
|
|
"custom/left-arrow-light"
|
|
"clock#2"
|
|
"custom/left-arrow-dark"
|
|
"clock#1"
|
|
];
|
|
|
|
|
|
wayland.windowManager.sway = {
|
|
config = rec {
|
|
# update for actual inputs here,
|
|
input = {
|
|
"36125:53060:splitkb.com_Kyria_rev3" = {
|
|
xkb_layout = "us";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"1:1:AT_Translated_Set_2_keyboard" = {
|
|
# TEMPLATE
|
|
xkb_layout = "us";
|
|
xkb_options = "grp:win_space_toggle";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"type:touchpad" = {
|
|
dwt = "enabled";
|
|
tap = "enabled";
|
|
natural_scroll = "enabled";
|
|
middle_emulation = "enabled";
|
|
};
|
|
|
|
};
|
|
|
|
output = {
|
|
eDP-1 = {
|
|
mode = "1920x1080"; # TEMPLATE
|
|
scale = "1";
|
|
position = "1920,0";
|
|
# bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
|
|
};
|
|
# external monitor
|
|
HDMI-A-1 = {
|
|
mode = "2560x1440";
|
|
scale = "1";
|
|
# bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
|
|
position = "0,0";
|
|
};
|
|
};
|
|
|
|
workspaceOutputAssign = [
|
|
{ output = "eDP-1"; workspace = "1:一"; }
|
|
{ output = "HDMI-A-1"; workspace = "2:二"; }
|
|
];
|
|
|
|
|
|
# keybindings = let
|
|
# inherit (config.wayland.windowManager.sway.config) modifier;
|
|
# in {
|
|
|
|
# };
|
|
|
|
startup = [
|
|
|
|
{ command = "nextcloud --background"; }
|
|
{ command = "discord --start-minimized"; }
|
|
{ command = "element-desktop --hidden -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
|
|
{ command = "ANKI_WAYLAND=1 anki"; }
|
|
{ command = "OBSIDIAN_USE_WAYLAND=1 obsidian"; }
|
|
{ command = "nm-applet"; }
|
|
|
|
];
|
|
};
|
|
};
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:4dc59747-9598-4029-aa7d-92bf186d6c06" class="outline-4">
|
|
<h4 id="h:4dc59747-9598-4029-aa7d-92bf186d6c06"><span class="section-number-4">3.1.3.</span> Virtual hosts</h4>
|
|
<div class="outline-text-4" id="text-h:4dc59747-9598-4029-aa7d-92bf186d6c06">
|
|
<p>
|
|
My server setup is built on Proxmox VE; back when I started, I created all kinds of wild Debian/Ubuntu/etc. KVMs and LXCs on there. However, the root disk has suffered a weird failure where it has become unable to be cloned, but it is still functional for now. I am currently rewriting all machines on there to use NixOS instead; this is a ongoing process.
|
|
</p>
|
|
|
|
<p>
|
|
In the long run, I am thinking about a transition to kubernetes or using just a server running NixOS and using the built-in container functionality. For now however, I like the network management provided by Proxmox, as I am a bit intimidated by doing that from scratch.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:292c583e-0b67-4456-bdba-a72d4e53ce66"></a>TEMPLATE<br />
|
|
<div class="outline-text-5" id="text-h:292c583e-0b67-4456-bdba-a72d4e53ce66">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:598a2a4c-4d99-46d6-9d4a-dd9e73704f09"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:598a2a4c-4d99-46d6-9d4a-dd9e73704f09">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
];
|
|
|
|
services.xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
networking = {
|
|
hostName = "TEMPLATE"; # Define your hostname.
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
firewall.enable = false;
|
|
};
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
};
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
# users.users.root.password = "TEMPLATE";
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:90340ea4-5ef0-4466-92cf-12d8ece805ba"></a>NGINX<br />
|
|
<div class="outline-text-5" id="text-h:90340ea4-5ef0-4466-92cf-12d8ece805ba">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:519899ad-adcd-435b-8857-71635afbc756"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:519899ad-adcd-435b-8857-71635afbc756">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, modulesPath, ... }:
|
|
{
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
lego
|
|
nginx
|
|
];
|
|
|
|
services.xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/.dotfiles/secrets/nginx/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets.dnstokenfull = { owner = "acme"; };
|
|
templates."certs.secret".content = ''
|
|
CF_DNS_API_TOKEN=${config.sops.placeholder.dnstokenfull}
|
|
'';
|
|
};
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
networking = {
|
|
hostName = "nginx"; # Define your hostname.
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
firewall.enable = false;
|
|
};
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
};
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
# users.users.root.password = "TEMPLATE";
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
security.acme = {
|
|
acceptTerms = true;
|
|
preliminarySelfsigned = false;
|
|
defaults.email = "mrswarsel@gmail.com";
|
|
defaults.dnsProvider = "cloudflare";
|
|
defaults.environmentFile = "${config.sops.templates."certs.secret".path}";
|
|
};
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
recommendedProxySettings = true;
|
|
recommendedTlsSettings = true;
|
|
recommendedOptimisation = true;
|
|
recommendedGzipSettings = true;
|
|
virtualHosts = {
|
|
|
|
"stash.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "https://192.168.1.5";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
# "/push/" = {
|
|
# proxyPass = "http://192.168.2.5:7867";
|
|
# };
|
|
"/.well-known/carddav" = {
|
|
return = "301 $scheme://$host/remote.php/dav";
|
|
};
|
|
"/.well-known/caldav" = {
|
|
return = "301 $scheme://$host/remote.php/dav";
|
|
};
|
|
};
|
|
};
|
|
|
|
"matrix2.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"~ ^(/_matrix|/_synapse/client)" = {
|
|
proxyPass = "http://192.168.1.23:8008";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
"sound.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://192.168.1.13:4040";
|
|
proxyWebsockets = true;
|
|
extraConfig = ''
|
|
proxy_redirect http:// https://;
|
|
proxy_read_timeout 600s;
|
|
proxy_send_timeout 600s;
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"scan.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://192.168.1.24:28981";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"screen.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://192.168.1.16:8096";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"matrix.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"~ ^(/_matrix|/_synapse/client)" = {
|
|
proxyPass = "http://192.168.1.20:8008";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"scroll.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://192.168.1.22:8080";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"blog.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "https://192.168.1.7";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
};
|
|
};
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:12152533-a000-4e7e-8038-43f8e501cedd"></a>[Manual steps required] Calibre<br />
|
|
<div class="outline-text-5" id="text-h:12152533-a000-4e7e-8038-43f8e501cedd">
|
|
<p>
|
|
This machine requires manual setup:
|
|
</p>
|
|
<ol class="org-ol">
|
|
<li>(obsolete for now) Set up calibre-web:
|
|
<ul class="org-ul">
|
|
<li>Create metadata.db with 664 permissions, make sure parent directory is writeable</li>
|
|
<li>Login @ books.swarsel.win using initial creds:
|
|
<ul class="org-ul">
|
|
<li>user: admin</li>
|
|
<li>pw: admin123</li>
|
|
</ul></li>
|
|
<li>point to metadata.db file, make sure you can upload</li>
|
|
<li>Change pw, create normal user</li>
|
|
</ul></li>
|
|
<li>Setup kavita:
|
|
<ul class="org-ul">
|
|
<li>Login @ scrolls.swarsel.win</li>
|
|
<li>Create admin user</li>
|
|
<li>Import Libraries</li>
|
|
<li>Create normal user</li>
|
|
</ul></li>
|
|
</ol>
|
|
|
|
<p>
|
|
In general, I am not amazed by this setup; Kavita is the reader of choice, calibre-web mostly is there to have a convenient way to fullfill the opinionated folder structure when uploading ebooks (calibre-web does not work on its own since it forces sqlite which does not work nicely with my NFS book store). I hope that in the future Kavita will implement ebook upload, or that calibre-web will ditch the sqlite constraints.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:0094ccd0-36e4-46cb-a422-6f1aefb786d6"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:0094ccd0-36e4-46cb-a422-6f1aefb786d6">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
calibre
|
|
];
|
|
|
|
users.groups.lxc_shares = {
|
|
gid = 10000;
|
|
members = [
|
|
"kavita"
|
|
"calibre-web"
|
|
"root"
|
|
];
|
|
};
|
|
|
|
services.xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/.dotfiles/secrets/calibre/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets.kavita = { owner = "kavita"; };
|
|
};
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
networking = {
|
|
hostName = "calibre"; # Define your hostname.
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
firewall.enable = false;
|
|
};
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
};
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
services.kavita = {
|
|
enable = true;
|
|
user = "kavita";
|
|
port = 8080;
|
|
tokenKeyFile = config.sops.secrets.kavita.path;
|
|
};
|
|
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:4a194546-9a9e-47c4-8d03-8d2428d45d30"></a>Jellyfin<br />
|
|
<div class="outline-text-5" id="text-h:4a194546-9a9e-47c4-8d03-8d2428d45d30">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:9e94efd9-f63b-46ce-b34c-ec3128de5ed9"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:9e94efd9-f63b-46ce-b34c-ec3128de5ed9">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
];
|
|
|
|
users.groups.lxc_shares = {
|
|
gid = 10000;
|
|
members = [
|
|
"jellyfin"
|
|
"root"
|
|
];
|
|
};
|
|
|
|
users.users.jellyfin = {
|
|
extraGroups = [ "video" "render" ];
|
|
};
|
|
|
|
services.xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
networking = {
|
|
hostName = "jellyfin"; # Define your hostname.
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
firewall.enable = false;
|
|
};
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
};
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
nixpkgs.config.packageOverrides = pkgs: {
|
|
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
|
|
};
|
|
hardware.graphics = {
|
|
enable = true;
|
|
extraPackages = with pkgs; [
|
|
intel-media-driver # LIBVA_DRIVER_NAME=iHD
|
|
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
|
|
vaapiVdpau
|
|
libvdpau-va-gl
|
|
];
|
|
};
|
|
|
|
services.jellyfin = {
|
|
enable = true;
|
|
user = "jellyfin";
|
|
# openFirewall = true; # this works only for the default ports
|
|
};
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:dffc1243-8d6a-4cac-8a5d-3a27d4546235"></a>[WIP/Incomplete/Untested] Transmission<br />
|
|
<div class="outline-text-5" id="text-h:dffc1243-8d6a-4cac-8a5d-3a27d4546235">
|
|
<p>
|
|
This stuff just does not work, I seem to be unable to create a working VPN Split Tunneling on NixOS. Maybe this is introduced by the wonky Proxmox-NixOS container interaction, I am not sure. For now, this machine does not work at all and I am stuck with my Debian Container that does this for me …
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:2a2ebf94-b262-4e83-ab86-d8b1ebec492d"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:2a2ebf94-b262-4e83-ab86-d8b1ebec492d">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
# ./openvpn.nix #this file holds the vpn login data
|
|
];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
openvpn
|
|
jq
|
|
iptables
|
|
busybox
|
|
wireguard-tools
|
|
];
|
|
|
|
users.groups.lxc_shares = {
|
|
gid = 10000;
|
|
members = [
|
|
"vpn"
|
|
"radarr"
|
|
"sonarr"
|
|
"lidarr"
|
|
"readarr"
|
|
"root"
|
|
];
|
|
};
|
|
users.groups.vpn = { };
|
|
|
|
users.users.vpn = {
|
|
isNormalUser = true;
|
|
group = "vpn";
|
|
home = "/home/vpn";
|
|
};
|
|
|
|
services.xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/.dotfiles/secrets/transmission/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
};
|
|
|
|
boot.kernelModules = [ "tun" ];
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
networking = {
|
|
hostName = "transmission"; # Define your hostname.
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
firewall.enable = false;
|
|
};
|
|
|
|
services = {
|
|
radarr = {
|
|
enable = true;
|
|
};
|
|
readarr = {
|
|
enable = true;
|
|
};
|
|
sonarr = {
|
|
enable = true;
|
|
};
|
|
lidarr = {
|
|
enable = true;
|
|
};
|
|
prowlarr = {
|
|
enable = true;
|
|
};
|
|
};
|
|
|
|
networking.iproute2 = {
|
|
enable = true;
|
|
rttablesExtraConfig = ''
|
|
200 vpn
|
|
'';
|
|
};
|
|
environment.etc = {
|
|
"openvpn/iptables.sh" =
|
|
{
|
|
source = ../../../scripts/server1/iptables.sh;
|
|
mode = "0755";
|
|
};
|
|
"openvpn/update-resolv-conf" =
|
|
{
|
|
source = ../../../scripts/server1/update-resolv-conf;
|
|
mode = "0755";
|
|
};
|
|
"openvpn/routing.sh" =
|
|
{
|
|
source = ../../../scripts/server1/routing.sh;
|
|
mode = "0755";
|
|
};
|
|
"openvpn/ca.rsa.2048.crt" =
|
|
{
|
|
source = ../../../secrets/certs/ca.rsa.2048.crt;
|
|
mode = "0644";
|
|
};
|
|
"openvpn/crl.rsa.2048.pem" =
|
|
{
|
|
source = ../../../secrets/certs/crl.rsa.2048.pem;
|
|
mode = "0644";
|
|
};
|
|
};
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
listenAddresses = [{
|
|
port = 22;
|
|
addr = "0.0.0.0";
|
|
}];
|
|
};
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
# users.users.root.password = "TEMPLATE";
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
sops = {
|
|
templates = {
|
|
"transmission-rpc" = {
|
|
owner = "vpn";
|
|
content = builtins.toJSON {
|
|
rpc-username = config.sops.placeholder.rpcuser;
|
|
rpc-password = config.sops.placeholder.rpcpass;
|
|
};
|
|
};
|
|
|
|
pia.content = ''
|
|
${config.sops.placeholder.vpnuser}
|
|
${config.sops.placeholder.vpnpass}
|
|
'';
|
|
|
|
vpn.content = ''
|
|
client
|
|
dev tun
|
|
proto ${config.sops.placeholder.vpnprot}
|
|
remote ${config.sops.placeholder.vpnloc}
|
|
resolv-retry infinite
|
|
nobind
|
|
persist-key
|
|
persist-tun
|
|
cipher aes-128-cbc
|
|
auth sha1
|
|
tls-client
|
|
remote-cert-tls server
|
|
|
|
auth-user-pass ${config.sops.templates.pia.path}
|
|
compress
|
|
verb 1
|
|
reneg-sec 0
|
|
|
|
crl-verify /etc/openvpn/crl.rsa.2048.pem
|
|
ca /etc/openvpn/ca.rsa.2048.crt
|
|
|
|
disable-occ
|
|
dhcp-option DNS 209.222.18.222
|
|
dhcp-option DNS 209.222.18.218
|
|
dhcp-option DNS 8.8.8.8
|
|
route-noexec
|
|
'';
|
|
};
|
|
secrets = {
|
|
vpnuser = { };
|
|
rpcuser = { owner = "vpn"; };
|
|
vpnpass = { };
|
|
rpcpass = { owner = "vpn"; };
|
|
vpnprot = { };
|
|
vpnloc = { };
|
|
};
|
|
};
|
|
services.openvpn.servers = {
|
|
pia = {
|
|
autoStart = false;
|
|
updateResolvConf = true;
|
|
config = "config ${config.sops.templates.vpn.path}";
|
|
};
|
|
};
|
|
|
|
services.transmission = {
|
|
enable = true;
|
|
credentialsFile = config.sops.templates."transmission-rpc".path;
|
|
user = "vpn";
|
|
group = "lxc_shares";
|
|
settings = {
|
|
|
|
alt-speed-down = 8000;
|
|
alt-speed-enabled = false;
|
|
alt-speed-time-begin = 0;
|
|
alt-speed-time-day = 127;
|
|
alt-speed-time-enabled = true;
|
|
alt-speed-time-end = 360;
|
|
alt-speed-up = 2000;
|
|
bind-address-ipv4 = "0.0.0.0";
|
|
bind-address-ipv6 = "::";
|
|
blocklist-enabled = false;
|
|
blocklist-url = "http://www.example.com/blocklist";
|
|
cache-size-mb = 4;
|
|
dht-enabled = false;
|
|
download-dir = "/media/Eternor/New";
|
|
download-limit = 100;
|
|
download-limit-enabled = 0;
|
|
download-queue-enabled = true;
|
|
download-queue-size = 5;
|
|
encryption = 2;
|
|
idle-seeding-limit = 30;
|
|
idle-seeding-limit-enabled = false;
|
|
incomplete-dir = "/var/lib/transmission-daemon/Downloads";
|
|
incomplete-dir-enabled = false;
|
|
lpd-enabled = false;
|
|
max-peers-global = 200;
|
|
message-level = 1;
|
|
peer-congestion-algorithm = "";
|
|
peer-id-ttl-hours = 6;
|
|
peer-limit-global = 100;
|
|
peer-limit-per-torrent = 40;
|
|
peer-port = 22371;
|
|
peer-port-random-high = 65535;
|
|
peer-port-random-low = 49152;
|
|
peer-port-random-on-start = false;
|
|
peer-socket-tos = "default";
|
|
pex-enabled = false;
|
|
port-forwarding-enabled = false;
|
|
preallocation = 1;
|
|
prefetch-enabled = true;
|
|
queue-stalled-enabled = true;
|
|
queue-stalled-minutes = 30;
|
|
ratio-limit = 2;
|
|
ratio-limit-enabled = false;
|
|
rename-partial-files = true;
|
|
rpc-authentication-required = true;
|
|
rpc-bind-address = "0.0.0.0";
|
|
rpc-enabled = true;
|
|
rpc-host-whitelist = "";
|
|
rpc-host-whitelist-enabled = true;
|
|
rpc-port = 9091;
|
|
rpc-url = "/transmission/";
|
|
rpc-whitelist = "127.0.0.1,192.168.3.2";
|
|
rpc-whitelist-enabled = true;
|
|
scrape-paused-torrents-enabled = true;
|
|
script-torrent-done-enabled = false;
|
|
seed-queue-enabled = false;
|
|
seed-queue-size = 10;
|
|
speed-limit-down = 6000;
|
|
speed-limit-down-enabled = true;
|
|
speed-limit-up = 500;
|
|
speed-limit-up-enabled = true;
|
|
start-added-torrents = true;
|
|
trash-original-torrent-files = false;
|
|
umask = 2;
|
|
upload-limit = 100;
|
|
upload-limit-enabled = 0;
|
|
upload-slots-per-torrent = 14;
|
|
utp-enabled = false;
|
|
};
|
|
};
|
|
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:1d6221c4-1f48-4f83-b262-5298ed99218e"></a>[Manual steps needed] Matrix<br />
|
|
<div class="outline-text-5" id="text-h:1d6221c4-1f48-4f83-b262-5298ed99218e">
|
|
<ol class="org-ol">
|
|
<li>After the initial setup, run the
|
|
<ul class="org-ul">
|
|
<li>/run/secrets-generated/matrix<sub>user</sub><sub>register.sh</sub></li>
|
|
</ul></li>
|
|
</ol>
|
|
<p>
|
|
command to register a new admin user.
|
|
</p>
|
|
<ol class="org-ol">
|
|
<li>All bridges will fail on first start, copy the registration files using:
|
|
<ul class="org-ul">
|
|
<li>cp <i>var/lib/mautrix-telegram/telegram-registration.yaml /var/lib/matrix-synapse</i></li>
|
|
<li>chown matrix-synapse:matrix-synapse var/lib/matrix-synapse/telegram-registration.yaml</li>
|
|
</ul></li>
|
|
</ol>
|
|
<p>
|
|
Make sure to also do this for doublepuppet.yaml
|
|
</p>
|
|
<ol class="org-ol">
|
|
<li>Restart postgresql.service, matrix-synapse.service, mautrix-whatsapp.service, mautrix-telegram.service</li>
|
|
</ol>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:a0b2d610-7258-4875-adb4-9ec4afe05b02"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:a0b2d610-7258-4875-adb4-9ec4afe05b02">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, modulesPath, sops, ... }:
|
|
let
|
|
matrixDomain = "matrix2.swarsel.win";
|
|
in
|
|
{
|
|
|
|
|
|
services = {
|
|
xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
listenAddresses = [{
|
|
port = 22;
|
|
addr = "0.0.0.0";
|
|
}];
|
|
};
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
|
|
networking = {
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
};
|
|
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
# we import here a service that is not available yet on normal nixpkgs
|
|
# this module is hence not in the modules list, we add it ourselves
|
|
];
|
|
|
|
networking = {
|
|
hostName = "matrix"; # Define your hostname.
|
|
firewall.enable = false;
|
|
};
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
matrix-synapse
|
|
lottieconverter
|
|
ffmpeg
|
|
];
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/.dotfiles/secrets/matrix/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets = {
|
|
matrixsharedsecret = { owner = "matrix-synapse"; };
|
|
mautrixtelegram_as = { owner = "matrix-synapse"; };
|
|
mautrixtelegram_hs = { owner = "matrix-synapse"; };
|
|
mautrixtelegram_api_id = { owner = "matrix-synapse"; };
|
|
mautrixtelegram_api_hash = { owner = "matrix-synapse"; };
|
|
};
|
|
templates = {
|
|
"matrix_user_register.sh".content = ''
|
|
register_new_matrix_user -k ${config.sops.placeholder.matrixsharedsecret} http://localhost:8008
|
|
'';
|
|
matrixshared = {
|
|
owner = "matrix-synapse";
|
|
content = ''
|
|
registration_shared_secret: ${config.sops.placeholder.matrixsharedsecret}
|
|
'';
|
|
};
|
|
mautrixtelegram = {
|
|
owner = "matrix-synapse";
|
|
content = ''
|
|
MAUTRIX_TELEGRAM_APPSERVICE_AS_TOKEN=${config.sops.placeholder.mautrixtelegram_as}
|
|
MAUTRIX_TELEGRAM_APPSERVICE_HS_TOKEN=${config.sops.placeholder.mautrixtelegram_hs}
|
|
MAUTRIX_TELEGRAM_TELEGRAM_API_ID=${config.sops.placeholder.mautrixtelegram_api_id}
|
|
MAUTRIX_TELEGRAM_TELEGRAM_API_HASH=${config.sops.placeholder.mautrixtelegram_api_hash}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
services.postgresql = {
|
|
enable = true;
|
|
initialScript = pkgs.writeText "synapse-init.sql" ''
|
|
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse';
|
|
CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-telegram" WITH LOGIN PASSWORD 'telegram';
|
|
CREATE DATABASE "mautrix-telegram" WITH OWNER "mautrix-telegram"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-whatsapp" WITH LOGIN PASSWORD 'whatsapp';
|
|
CREATE DATABASE "mautrix-whatsapp" WITH OWNER "mautrix-whatsapp"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-signal" WITH LOGIN PASSWORD 'signal';
|
|
CREATE DATABASE "mautrix-signal" WITH OWNER "mautrix-signal"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
'';
|
|
};
|
|
|
|
services.matrix-synapse = {
|
|
enable = true;
|
|
settings = {
|
|
app_service_config_files = [
|
|
"/var/lib/matrix-synapse/telegram-registration.yaml"
|
|
"/var/lib/matrix-synapse/whatsapp-registration.yaml"
|
|
"/var/lib/matrix-synapse/signal-registration.yaml"
|
|
"/var/lib/matrix-synapse/doublepuppet.yaml"
|
|
];
|
|
server_name = matrixDomain;
|
|
public_baseurl = "https://${matrixDomain}";
|
|
listeners = [
|
|
{
|
|
port = 8008;
|
|
bind_addresses = [ "0.0.0.0" ];
|
|
type = "http";
|
|
tls = false;
|
|
x_forwarded = true;
|
|
resources = [
|
|
{
|
|
names = [ "client" "federation" ];
|
|
compress = true;
|
|
}
|
|
];
|
|
}
|
|
];
|
|
};
|
|
extraConfigFiles = [
|
|
config.sops.templates.matrixshared.path
|
|
];
|
|
};
|
|
|
|
services.mautrix-telegram = {
|
|
enable = true;
|
|
environmentFile = config.sops.templates.mautrixtelegram.path;
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
address = "http://localhost:29317";
|
|
hostname = "0.0.0.0";
|
|
port = "29317";
|
|
provisioning.enabled = true;
|
|
id = "telegram";
|
|
# ephemeral_events = true; # not needed due to double puppeting
|
|
public = {
|
|
enabled = false;
|
|
};
|
|
database = "postgresql:///mautrix-telegram?host=/run/postgresql";
|
|
};
|
|
bridge = {
|
|
relaybot.authless_portals = true;
|
|
allow_avatar_remove = true;
|
|
allow_contact_info = true;
|
|
sync_channel_members = true;
|
|
startup_sync = true;
|
|
sync_create_limit = 0;
|
|
sync_direct_chats = true;
|
|
telegram_link_preview = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
animated_sticker = {
|
|
target = "gif";
|
|
args = {
|
|
width = 256;
|
|
height = 256;
|
|
fps = 30; # only for webm
|
|
background = "020202"; # only for gif, transparency not supported
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
systemd.services.mautrix-telegram.path = with pkgs; [
|
|
lottieconverter # for animated stickers conversion, unfree package
|
|
ffmpeg # if converting animated stickers to webm (very slow!)
|
|
];
|
|
|
|
services.mautrix-whatsapp = {
|
|
enable = true;
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
address = "http://localhost:29318";
|
|
hostname = "0.0.0.0";
|
|
port = 29318;
|
|
database = {
|
|
type = "postgres";
|
|
uri = "postgresql:///mautrix-whatsapp?host=/run/postgresql";
|
|
};
|
|
};
|
|
bridge = {
|
|
displayname_template = "{{or .FullName .PushName .JID}} (WA)";
|
|
history_sync = {
|
|
backfill = true;
|
|
max_initial_conversations = -1;
|
|
message_count = -1;
|
|
request_full_sync = true;
|
|
full_sync_config = {
|
|
days_limit = 900;
|
|
size_mb_limit = 5000;
|
|
storage_quota_mb = 5000;
|
|
};
|
|
};
|
|
login_shared_secret_map = {
|
|
matrixDomain = "as_token:doublepuppet";
|
|
};
|
|
sync_manual_marked_unread = true;
|
|
send_presence_on_typing = true;
|
|
parallel_member_sync = true;
|
|
url_previews = true;
|
|
caption_in_message = true;
|
|
extev_polls = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
services.mautrix-signal = {
|
|
enable = true;
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
|
|
address = "http://localhost:29328";
|
|
hostname = "0.0.0.0";
|
|
port = 29328;
|
|
database = {
|
|
type = "postgres";
|
|
uri = "postgresql:///mautrix-signal?host=/run/postgresql";
|
|
};
|
|
};
|
|
bridge = {
|
|
displayname_template = "{{or .ContactName .ProfileName .PhoneNumber}} (Signal)";
|
|
login_shared_secret_map = {
|
|
matrixDomain = "as_token:doublepuppet";
|
|
};
|
|
caption_in_message = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
# restart the bridges daily. this is done for the signal bridge mainly which stops carrying
|
|
# messages out after a while.
|
|
|
|
systemd.timers."restart-bridges" = {
|
|
wantedBy = [ "timers.target" ];
|
|
timerConfig = {
|
|
OnBootSec = "1d";
|
|
OnUnitActiveSec = "1d";
|
|
Unit = "restart-bridges.service";
|
|
};
|
|
};
|
|
|
|
systemd.services."restart-bridges" = {
|
|
script = ''
|
|
systemctl restart mautrix-whatsapp.service
|
|
systemctl restart mautrix-signal.service
|
|
systemctl restart mautrix-telegram.service
|
|
'';
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
User = "root";
|
|
};
|
|
};
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:b36415bf-77fa-4d51-842c-8cde0e46b844"></a>Sound<br />
|
|
<div class="outline-text-5" id="text-h:b36415bf-77fa-4d51-842c-8cde0e46b844">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:4bb55d69-9e09-4338-9f1e-a77ce37f02ed"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:4bb55d69-9e09-4338-9f1e-a77ce37f02ed">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
|
|
|
|
services = {
|
|
xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
listenAddresses = [{
|
|
port = 22;
|
|
addr = "0.0.0.0";
|
|
}];
|
|
};
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
|
|
networking = {
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
};
|
|
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
|
|
|
|
proxmoxLXC.privileged = true; # manage hostname myself
|
|
|
|
users = {
|
|
groups = {
|
|
lxc_pshares = {
|
|
gid = 110000;
|
|
members = [
|
|
"navidrome"
|
|
"mpd"
|
|
"root"
|
|
];
|
|
};
|
|
|
|
navidrome = {
|
|
gid = 61593;
|
|
};
|
|
|
|
mpd = { };
|
|
};
|
|
|
|
users = {
|
|
navidrome = {
|
|
isSystemUser = true;
|
|
uid = 61593;
|
|
group = "navidrome";
|
|
extraGroups = [ "audio" "utmp" ];
|
|
};
|
|
|
|
mpd = {
|
|
isSystemUser = true;
|
|
group = "mpd";
|
|
extraGroups = [ "audio" "utmp" ];
|
|
};
|
|
};
|
|
};
|
|
|
|
sound = {
|
|
enable = true;
|
|
};
|
|
|
|
hardware.enableAllFirmware = true;
|
|
networking = {
|
|
hostName = "sound"; # Define your hostname.
|
|
firewall.enable = false;
|
|
};
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
pciutils
|
|
alsa-utils
|
|
mpv
|
|
];
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/.dotfiles/secrets/sound/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets.mpdpass = { owner = "mpd"; };
|
|
};
|
|
|
|
services.navidrome = {
|
|
enable = true;
|
|
settings = {
|
|
Address = "0.0.0.0";
|
|
Port = 4040;
|
|
MusicFolder = "/media";
|
|
EnableSharing = true;
|
|
EnableTranscodingConfig = true;
|
|
Scanner.GroupAlbumReleases = true;
|
|
ScanSchedule = "@every 1d";
|
|
# Insert these values locally as sops-nix does not work for them
|
|
LastFM.ApiKey = TEMPLATE;
|
|
LastFM.Secret = TEMPLATE;
|
|
Spotify.ID = TEMPLATE;
|
|
Spotify.Secret = TEMPLATE;
|
|
UILoginBackgroundUrl = "https://i.imgur.com/OMLxi7l.png";
|
|
UIWelcomeMessage = "~SwarselSound~";
|
|
};
|
|
};
|
|
services.mpd = {
|
|
enable = true;
|
|
musicDirectory = "/media";
|
|
user = "mpd";
|
|
group = "mpd";
|
|
network = {
|
|
port = 3254;
|
|
listenAddress = "any";
|
|
};
|
|
credentials = [
|
|
{
|
|
passwordFile = config.sops.secrets.mpdpass.path;
|
|
permissions = [
|
|
"read"
|
|
"add"
|
|
"control"
|
|
"admin"
|
|
];
|
|
}
|
|
];
|
|
};
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:23032961-346c-4141-97b9-a4d5469dc7d8"></a>Spotifyd<br />
|
|
<div class="outline-text-5" id="text-h:23032961-346c-4141-97b9-a4d5469dc7d8">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:857bb1f6-9aeb-4600-ac79-a85ef011c847"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:857bb1f6-9aeb-4600-ac79-a85ef011c847">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
|
|
|
|
services = {
|
|
xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
listenAddresses = [{
|
|
port = 22;
|
|
addr = "0.0.0.0";
|
|
}];
|
|
};
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
|
|
networking = {
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
};
|
|
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
|
|
|
|
proxmoxLXC.privileged = true; # manage hostname myself
|
|
|
|
users.groups.spotifyd = {
|
|
gid = 65136;
|
|
};
|
|
|
|
users.users.spotifyd = {
|
|
isSystemUser = true;
|
|
uid = 65136;
|
|
group = "spotifyd";
|
|
extraGroups = [ "audio" "utmp" ];
|
|
};
|
|
|
|
sound = {
|
|
enable = true;
|
|
};
|
|
|
|
hardware.enableAllFirmware = true;
|
|
networking = {
|
|
hostName = "spotifyd"; # Define your hostname.
|
|
firewall.enable = false;
|
|
};
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
];
|
|
|
|
services.spotifyd = {
|
|
enable = true;
|
|
settings = {
|
|
global = {
|
|
dbus_type = "session";
|
|
use_mpris = false;
|
|
device = "default:CARD=PCH";
|
|
device_name = "SwarselSpot";
|
|
mixer = "alsa";
|
|
zeroconf_port = 1025;
|
|
};
|
|
};
|
|
};
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:4c5febb0-fdf6-44c5-8d51-7ea0f8930abf"></a>Sync<br />
|
|
<div class="outline-text-5" id="text-h:4c5febb0-fdf6-44c5-8d51-7ea0f8930abf">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:e5fbb73a-799a-438f-a88c-fc14d110ac9c"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:e5fbb73a-799a-438f-a88c-fc14d110ac9c">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, ... }:
|
|
|
|
{
|
|
imports = [
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
];
|
|
|
|
services.xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/root/.dotfiles/secrets/sync/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets.swarsel = { owner = "root"; };
|
|
secrets.dnstokenfull = { owner = "acme"; };
|
|
templates."certs.secret".content = ''
|
|
CF_DNS_API_TOKEN=${config.sops.placeholder.dnstokenfull}
|
|
'';
|
|
};
|
|
|
|
security.acme = {
|
|
acceptTerms = true;
|
|
preliminarySelfsigned = false;
|
|
defaults.email = "mrswarsel@gmail.com";
|
|
defaults.dnsProvider = "cloudflare";
|
|
defaults.environmentFile = "${config.sops.templates."certs.secret".path}";
|
|
};
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
recommendedProxySettings = true;
|
|
recommendedTlsSettings = true;
|
|
recommendedOptimisation = true;
|
|
recommendedGzipSettings = true;
|
|
virtualHosts = {
|
|
|
|
"synki.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://localhost:27701";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"sync.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://localhost:8384/";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
"swagit.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"/" = {
|
|
proxyPass = "http://localhost:3000";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
boot.tmp.cleanOnBoot = true;
|
|
zramSwap.enable = false;
|
|
networking = {
|
|
hostName = "sync";
|
|
enableIPv6 = false;
|
|
domain = "subnet03112148.vcn03112148.oraclevcn.com";
|
|
firewall.extraCommands = ''
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 27701 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 8384 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 3000 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 22000 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p udp --dport 22000 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p udp --dport 21027 -j ACCEPT
|
|
'';
|
|
};
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
};
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.11"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd ~/.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
boot.loader.grub.device = "nodev";
|
|
|
|
services.anki-sync-server = {
|
|
enable = true;
|
|
port = 27701;
|
|
address = "0.0.0.0";
|
|
openFirewall = true;
|
|
users = [
|
|
{
|
|
username = "Swarsel";
|
|
passwordFile = config.sops.secrets.swarsel.path;
|
|
}
|
|
];
|
|
};
|
|
|
|
services.syncthing = {
|
|
enable = true;
|
|
guiAddress = "0.0.0.0:8384";
|
|
openDefaultPorts = true;
|
|
};
|
|
|
|
services.forgejo = {
|
|
enable = true;
|
|
settings = {
|
|
DEFAULT = {
|
|
APP_NAME = "~SwaGit~";
|
|
};
|
|
server = {
|
|
PROTOCOL = "http";
|
|
HTTP_PORT = 3000;
|
|
HTTP_ADDR = "0.0.0.0";
|
|
DOMAIN = "swagit.swarsel.win";
|
|
ROOT_URL = "https://swagit.swarsel.win";
|
|
};
|
|
service = {
|
|
DISABLE_REGISTRATION = true;
|
|
SHOW_REGISTRATION_BUTTON = false;
|
|
};
|
|
};
|
|
};
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:39553a9c-7095-4db8-b0df-bf47d91cb937"></a>[Manual steps required] Swatrix<br />
|
|
<div class="outline-text-5" id="text-h:39553a9c-7095-4db8-b0df-bf47d91cb937">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:441d367d-cddd-40d7-9db7-d170e61e1c52"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:441d367d-cddd-40d7-9db7-d170e61e1c52">
|
|
<p>
|
|
The files mentioned by
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
settings.app_service_config_files = [
|
|
"/var/lib/matrix-synapse/telegram-registration.yaml"
|
|
"/var/lib/matrix-synapse/whatsapp-registration.yaml"
|
|
"/var/lib/matrix-synapse/signal-registration.yaml"
|
|
"/var/lib/matrix-synapse/doublepuppet.yaml"
|
|
]
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
need to be moved to the corresponding location. The below files are created as soon as the appservice is run once. This means that matrix will crash on the first startup; afterwards run these commands and restart the service.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-shell">
|
|
cp /var/lib/mautrix-telegram/telegram-registration.yaml /var/lib/matrix-synapse/
|
|
chown matrix-synapse:matrix-synapse /var/lib/matrix-synapse/telegram-registration.yaml
|
|
cp /var/lib/mautrix-signal/signal-registration.yaml /var/lib/matrix-synapse/
|
|
chown matrix-synapse:matrix-synapse /var/lib/matrix-synapse/signal-registration.yaml
|
|
cp /var/lib/mautrix-whatsapp/whatsapp-registration.yaml /var/lib/matrix-synapse/
|
|
chown matrix-synapse:matrix-synapse /var/lib/matrix-synapse/whatsapp-registration.yaml
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
as for the contents of doublepuppet.yaml:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-yaml">id: doublepuppet
|
|
url:
|
|
as_token: doublepuppet
|
|
hs_token: notused
|
|
sender_localpart: notused
|
|
rate_limited: false
|
|
namespaces:
|
|
users:
|
|
- regex: '@.*:matrix2\.swarsel\.win'
|
|
exclusive: false
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Lastly, the machine that runs matrix needs to regularly update, as otherwise you will lose connectivity to the bridges.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, sops, ... }:
|
|
let
|
|
matrixDomain = "swatrix.swarsel.win";
|
|
in
|
|
{
|
|
|
|
imports = [
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
matrix-synapse
|
|
lottieconverter
|
|
ffmpeg
|
|
];
|
|
|
|
services.xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/root/.dotfiles/secrets/omatrix/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets = {
|
|
dnstokenfull = { owner = "acme"; };
|
|
matrixsharedsecret = { owner = "matrix-synapse"; };
|
|
mautrixtelegram_as = { owner = "matrix-synapse"; };
|
|
mautrixtelegram_hs = { owner = "matrix-synapse"; };
|
|
mautrixtelegram_api_id = { owner = "matrix-synapse"; };
|
|
mautrixtelegram_api_hash = { owner = "matrix-synapse"; };
|
|
};
|
|
templates = {
|
|
"certs.secret".content = ''
|
|
CF_DNS_API_TOKEN=${config.sops.placeholder.dnstokenfull}
|
|
'';
|
|
"matrix_user_register.sh".content = ''
|
|
register_new_matrix_user -k ${config.sops.placeholder.matrixsharedsecret} http://localhost:8008
|
|
'';
|
|
mautrixtelegram = {
|
|
owner = "matrix-synapse";
|
|
content = ''
|
|
MAUTRIX_TELEGRAM_APPSERVICE_AS_TOKEN=${config.sops.placeholder.mautrixtelegram_as}
|
|
MAUTRIX_TELEGRAM_APPSERVICE_HS_TOKEN=${config.sops.placeholder.mautrixtelegram_hs}
|
|
MAUTRIX_TELEGRAM_TELEGRAM_API_ID=${config.sops.placeholder.mautrixtelegram_api_id}
|
|
MAUTRIX_TELEGRAM_TELEGRAM_API_HASH=${config.sops.placeholder.mautrixtelegram_api_hash}
|
|
'';
|
|
};
|
|
matrixshared = {
|
|
owner = "matrix-synapse";
|
|
content = ''
|
|
registration_shared_secret: ${config.sops.placeholder.matrixsharedsecret}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
documentation = {
|
|
enable = false;
|
|
};
|
|
|
|
security.acme = {
|
|
acceptTerms = true;
|
|
preliminarySelfsigned = false;
|
|
defaults.email = "mrswarsel@gmail.com";
|
|
defaults.dnsProvider = "cloudflare";
|
|
defaults.environmentFile = "${config.sops.templates."certs.secret".path}";
|
|
};
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
recommendedProxySettings = true;
|
|
recommendedTlsSettings = true;
|
|
recommendedOptimisation = true;
|
|
recommendedGzipSettings = true;
|
|
virtualHosts = {
|
|
|
|
"swatrix.swarsel.win" = {
|
|
enableACME = true;
|
|
forceSSL = true;
|
|
acmeRoot = null;
|
|
locations = {
|
|
"~ ^(/_matrix|/_synapse/client)" = {
|
|
proxyPass = "http://localhost:8008";
|
|
extraConfig = ''
|
|
client_max_body_size 0;
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
boot.tmp.cleanOnBoot = true;
|
|
zramSwap.enable = false;
|
|
networking = {
|
|
hostName = "swatrix";
|
|
enableIPv6 = false;
|
|
domain = "swarsel.win";
|
|
firewall.extraCommands = ''
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 8008 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 29317 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 29318 -j ACCEPT
|
|
iptables -I INPUT -m state --state NEW -p tcp --dport 29328 -j ACCEPT
|
|
'';
|
|
};
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
};
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.11"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd ~/.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
boot.loader.grub.device = "nodev";
|
|
|
|
services.postgresql = {
|
|
enable = true;
|
|
initialScript = pkgs.writeText "synapse-init.sql" ''
|
|
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse';
|
|
CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-telegram" WITH LOGIN PASSWORD 'telegram';
|
|
CREATE DATABASE "mautrix-telegram" WITH OWNER "mautrix-telegram"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-whatsapp" WITH LOGIN PASSWORD 'whatsapp';
|
|
CREATE DATABASE "mautrix-whatsapp" WITH OWNER "mautrix-whatsapp"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
CREATE ROLE "mautrix-signal" WITH LOGIN PASSWORD 'signal';
|
|
CREATE DATABASE "mautrix-signal" WITH OWNER "mautrix-signal"
|
|
TEMPLATE template0
|
|
LC_COLLATE = "C"
|
|
LC_CTYPE = "C";
|
|
'';
|
|
};
|
|
services.matrix-synapse = {
|
|
settings.app_service_config_files = [
|
|
"/var/lib/matrix-synapse/telegram-registration.yaml"
|
|
"/var/lib/matrix-synapse/whatsapp-registration.yaml"
|
|
"/var/lib/matrix-synapse/signal-registration.yaml"
|
|
"/var/lib/matrix-synapse/doublepuppet.yaml"
|
|
];
|
|
enable = true;
|
|
settings = {
|
|
server_name = matrixDomain;
|
|
public_baseurl = "https://${matrixDomain}";
|
|
};
|
|
listeners = [
|
|
{
|
|
port = 8008;
|
|
bind_addresses = [ "0.0.0.0" ];
|
|
type = "http";
|
|
tls = false;
|
|
x_forwarded = true;
|
|
resources = [
|
|
{
|
|
names = [ "client" "federation" ];
|
|
compress = true;
|
|
}
|
|
];
|
|
}
|
|
];
|
|
extraConfigFiles = [
|
|
config.sops.templates.matrixshared.path
|
|
];
|
|
};
|
|
|
|
services.mautrix-telegram = {
|
|
enable = true;
|
|
environmentFile = config.sops.templates.mautrixtelegram.path;
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
address = "http://localhost:29317";
|
|
hostname = "0.0.0.0";
|
|
port = "29317";
|
|
provisioning.enabled = true;
|
|
id = "telegram";
|
|
# ephemeral_events = true; # not needed due to double puppeting
|
|
public = {
|
|
enabled = false;
|
|
};
|
|
database = "postgresql:///mautrix-telegram?host=/run/postgresql";
|
|
};
|
|
bridge = {
|
|
relaybot.authless_portals = true;
|
|
allow_avatar_remove = true;
|
|
allow_contact_info = true;
|
|
sync_channel_members = true;
|
|
startup_sync = true;
|
|
sync_create_limit = 0;
|
|
sync_direct_chats = true;
|
|
telegram_link_preview = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
animated_sticker = {
|
|
target = "gif";
|
|
args = {
|
|
width = 256;
|
|
height = 256;
|
|
fps = 30; # only for webm
|
|
background = "020202"; # only for gif, transparency not supported
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
systemd.services.mautrix-telegram.path = with pkgs; [
|
|
lottieconverter # for animated stickers conversion, unfree package
|
|
ffmpeg # if converting animated stickers to webm (very slow!)
|
|
];
|
|
|
|
services.mautrix-whatsapp = {
|
|
enable = true;
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
address = "http://localhost:29318";
|
|
hostname = "0.0.0.0";
|
|
port = 29318;
|
|
database = {
|
|
type = "postgres";
|
|
uri = "postgresql:///mautrix-whatsapp?host=/run/postgresql";
|
|
};
|
|
};
|
|
bridge = {
|
|
displayname_template = "{{or .FullName .PushName .JID}} (WA)";
|
|
history_sync = {
|
|
backfill = true;
|
|
max_initial_conversations = -1;
|
|
message_count = -1;
|
|
request_full_sync = true;
|
|
full_sync_config = {
|
|
days_limit = 900;
|
|
size_mb_limit = 5000;
|
|
storage_quota_mb = 5000;
|
|
};
|
|
};
|
|
login_shared_secret_map = {
|
|
matrixDomain = "as_token:doublepuppet";
|
|
};
|
|
sync_manual_marked_unread = true;
|
|
send_presence_on_typing = true;
|
|
parallel_member_sync = true;
|
|
url_previews = true;
|
|
caption_in_message = true;
|
|
extev_polls = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
services.mautrix-signal = {
|
|
enable = true;
|
|
registerToSynapse = false; # this has the same effect as registering to app_service_config_file above
|
|
settings = {
|
|
homeserver = {
|
|
address = "http://localhost:8008";
|
|
domain = matrixDomain;
|
|
};
|
|
appservice = {
|
|
|
|
address = "http://localhost:29328";
|
|
hostname = "0.0.0.0";
|
|
port = 29328;
|
|
database = {
|
|
type = "postgres";
|
|
uri = "postgresql:///mautrix-signal?host=/run/postgresql";
|
|
};
|
|
};
|
|
bridge = {
|
|
displayname_template = "{{or .ContactName .ProfileName .PhoneNumber}} (Signal)";
|
|
login_shared_secret_map = {
|
|
matrixDomain = "as_token:doublepuppet";
|
|
};
|
|
caption_in_message = true;
|
|
permissions = {
|
|
"*" = "relaybot";
|
|
"@swarsel:${matrixDomain}" = "admin";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
# restart the bridges daily. this is done for the signal bridge mainly which stops carrying
|
|
# messages out after a while.
|
|
|
|
systemd.timers."restart-bridges" = {
|
|
wantedBy = [ "timers.target" ];
|
|
timerConfig = {
|
|
OnBootSec = "1d";
|
|
OnUnitActiveSec = "1d";
|
|
Unit = "restart-bridges.service";
|
|
};
|
|
};
|
|
|
|
systemd.services."restart-bridges" = {
|
|
script = ''
|
|
systemctl restart mautrix-whatsapp.service
|
|
systemctl restart mautrix-signal.service
|
|
systemctl restart mautrix-telegram.service
|
|
'';
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
User = "root";
|
|
};
|
|
};
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:17b9ba9d-94c9-44d5-99dd-776174d4bcc9"></a>Paperless<br />
|
|
<div class="outline-text-5" id="text-h:17b9ba9d-94c9-44d5-99dd-776174d4bcc9">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:1fc355ca-ca8c-4b02-ab3f-5656f2992112"></a>NixOS<br />
|
|
<div class="outline-text-6" id="text-h:1fc355ca-ca8c-4b02-ab3f-5656f2992112">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
|
|
imports = [
|
|
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
|
./hardware-configuration.nix
|
|
];
|
|
|
|
|
|
|
|
services = {
|
|
xserver = {
|
|
layout = "us";
|
|
xkbVariant = "altgr-intl";
|
|
};
|
|
openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
listenAddresses = [{
|
|
port = 22;
|
|
addr = "0.0.0.0";
|
|
}];
|
|
};
|
|
};
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
proxmoxLXC = {
|
|
manageNetwork = true; # manage network myself
|
|
manageHostName = false; # manage hostname myself
|
|
};
|
|
|
|
networking = {
|
|
useDHCP = true;
|
|
enableIPv6 = false;
|
|
};
|
|
|
|
users.users.root.openssh.authorizedKeys.keyFiles = [
|
|
../../../secrets/keys/authorized_keys
|
|
];
|
|
|
|
system.stateVersion = "23.05"; # TEMPLATE - but probably no need to change
|
|
|
|
environment.shellAliases = {
|
|
nswitch = "cd /.dotfiles; git pull; nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
};
|
|
|
|
|
|
|
|
users.groups.lxc_shares = {
|
|
gid = 10000;
|
|
members = [
|
|
"paperless"
|
|
"root"
|
|
];
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
git
|
|
gnupg
|
|
ssh-to-age
|
|
];
|
|
|
|
networking = {
|
|
hostName = "paperless"; # Define your hostname.
|
|
firewall.enable = false;
|
|
};
|
|
|
|
sops = {
|
|
age.sshKeyPaths = [ "/etc/ssh/sops" ];
|
|
defaultSopsFile = "/root/.dotfiles/secrets/paperless/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets.admin = { owner = "paperless"; };
|
|
};
|
|
|
|
services.paperless = {
|
|
enable = true;
|
|
mediaDir = "/media";
|
|
user = "paperless";
|
|
port = 28981;
|
|
passwordFile = config.sops.secrets.admin.path;
|
|
address = "0.0.0.0";
|
|
extraConfig = {
|
|
PAPERLESS_OCR_LANGUAGE = "deu+eng";
|
|
PAPERLESS_URL = "scan.swarsel.win";
|
|
PAPERLESS_OCR_USER_ARGS = builtins.toJSON {
|
|
optimize = 1;
|
|
pdfa_image_compression = "lossless";
|
|
};
|
|
};
|
|
};
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:1c1250cd-e9b4-4715-8d9f-eb09e64bfc7f" class="outline-3">
|
|
<h3 id="h:1c1250cd-e9b4-4715-8d9f-eb09e64bfc7f"><span class="section-number-3">3.2.</span> Common NixOS</h3>
|
|
<div class="outline-text-3" id="text-h:1c1250cd-e9b4-4715-8d9f-eb09e64bfc7f">
|
|
<p>
|
|
These are system-level settings specific to NixOS machines. All settings that are required on all machines go here.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:5a114da6-ef8d-404d-b31b-b51472908e77" class="outline-4">
|
|
<h4 id="h:5a114da6-ef8d-404d-b31b-b51472908e77"><span class="section-number-4">3.2.1.</span> General</h4>
|
|
<div class="outline-text-4" id="text-h:5a114da6-ef8d-404d-b31b-b51472908e77">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:45e4315b-0929-4c47-b65a-c8f0a685f4df"></a>Enable home-manager module<br />
|
|
<div class="outline-text-5" id="text-h:45e4315b-0929-4c47-b65a-c8f0a685f4df">
|
|
<p>
|
|
First, we enable the use of <code>home-manager</code> as a NixoS module
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
home-manager = {
|
|
useGlobalPkgs = true;
|
|
useUserPackages = true;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:7248f338-8cad-4443-9060-deae7955b26f"></a>Setup login keymap<br />
|
|
<div class="outline-text-5" id="text-h:7248f338-8cad-4443-9060-deae7955b26f">
|
|
<p>
|
|
Next, we setup the keymap in case we are not in a graphical session. At this point, I always resort to us/altgr-intl, as it is extremly comfortable to use
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.xserver = {
|
|
xkb = {
|
|
layout = "us";
|
|
variant = "altgr-intl";
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:f9718641-adf7-4e5b-9e07-5b9413224971"></a>Enable flakes and nix-command<br />
|
|
<div class="outline-text-5" id="text-h:f9718641-adf7-4e5b-9e07-5b9413224971">
|
|
<p>
|
|
Next, we need to make sure that flakes stay enabled when we rebuild the configuration. At the same time we enable the experimental <code>nix-command</code>, which enables commands such as the more powerful <code>nix shell</code> as opposed to <code>nix-shell</code>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:48959890-fbc7-4d28-b33c-f33e028ab473"></a>Make users non-mutable<br />
|
|
<div class="outline-text-5" id="text-h:48959890-fbc7-4d28-b33c-f33e028ab473">
|
|
<p>
|
|
This ensures that all user-configuration happens here in the config file.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
users.mutableUsers = false;
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:f4006367-0965-4b4f-a3b0-45f63b07d2b8"></a>Environment setup<br />
|
|
<div class="outline-text-5" id="text-h:f4006367-0965-4b4f-a3b0-45f63b07d2b8">
|
|
<p>
|
|
Next, we will setup some environment variables that need to be set on the system-side. We apply some compatibility options for chromium apps on wayland, enable the wordlist and make metadata reading possible for my file explorer (nautilus).
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
environment = {
|
|
wordlist.enable = true;
|
|
sessionVariables = {
|
|
NIXOS_OZONE_WL = "1";
|
|
GST_PLUGIN_SYSTEM_PATH_1_0 = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" (with pkgs.gst_all_1; [
|
|
gst-plugins-good
|
|
gst-plugins-bad
|
|
gst-plugins-ugly
|
|
gst-libav
|
|
]);
|
|
};
|
|
};
|
|
# gstreamer plugins for nautilus (used for file metadata)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:c31f7900-f8b7-46aa-b501-c245ab889578"></a>Make sure time is consistent in windows dualboot<br />
|
|
<div class="outline-text-5" id="text-h:c31f7900-f8b7-46aa-b501-c245ab889578">
|
|
<p>
|
|
Windows/Linux dualboot has the quirk of ruining the system clock. Fix it on this side.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
time.hardwareClockInLocalTime = true;
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:b09c2bb6-86b7-46f4-a855-ac21dd9988b2"></a>Disallow stylix from styling grub<br />
|
|
<div class="outline-text-5" id="text-h:b09c2bb6-86b7-46f4-a855-ac21dd9988b2">
|
|
<p>
|
|
By default, <a href="https://github.com/danth/stylix">stylix</a> wants to style GRUB as well. However, I think that looks horrible.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
# dont style GRUB with stylix
|
|
stylix.targets.grub.enable = false; # the styling makes grub more ugly
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:e2d40df9-0026-4caa-8476-9dc2353055a1"></a>Enable PolicyKit<br />
|
|
<div class="outline-text-5" id="text-h:e2d40df9-0026-4caa-8476-9dc2353055a1">
|
|
<p>
|
|
Needed for control over system-wide privileges etc.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
security.polkit.enable = true;
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:9a3b7f1f-d0c3-417e-a262-c920fb25f3ee"></a>Enable automatic garbage collection<br />
|
|
<div class="outline-text-5" id="text-h:9a3b7f1f-d0c3-417e-a262-c920fb25f3ee">
|
|
<p>
|
|
The nix store fills up over time, until <code>/boot/efi</code> is filled. This snippet cleans it automatically on a weekly basis.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
nix.gc = {
|
|
automatic = true;
|
|
randomizedDelaySec = "14m";
|
|
dates = "weekly";
|
|
options = "--delete-older-than 10d";
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:97a2b9f7-c835-4db8-a0e9-e923bab69ee8"></a>Enable automatic store optimisation<br />
|
|
<div class="outline-text-5" id="text-h:97a2b9f7-c835-4db8-a0e9-e923bab69ee8">
|
|
<p>
|
|
This enables hardlinking identical files in the nix store, to save on disk space. I have read this incurs a significant I/O overhead, I need to keep an eye on this.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
nix.optimise = {
|
|
automatic = true;
|
|
dates = [ "weekly" ];
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:12858442-c129-4aa1-9c9c-a0916e36b302"></a>Reduce systemd timeouts<br />
|
|
<div class="outline-text-5" id="text-h:12858442-c129-4aa1-9c9c-a0916e36b302">
|
|
<p>
|
|
There is a persistent bug over Linux kernels that makes the user wait 1m30s on system shutdown due to the reason <code>a stop job is running for session 1 of user ...</code>. I do not want to wait that long and am confident no important data is lost by doing this.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
|
|
# systemd
|
|
systemd.extraConfig = ''
|
|
DefaultTimeoutStartSec=60s
|
|
DefaultTimeoutStopSec=15s
|
|
'';
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:1fa7cf61-5c03-43a3-a7f0-3d6ee246b31b"></a>Hardware settings<br />
|
|
<div class="outline-text-5" id="text-h:1fa7cf61-5c03-43a3-a7f0-3d6ee246b31b">
|
|
<p>
|
|
Enable OpenGL, Sound, Bluetooth and various drivers.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
hardware = {
|
|
graphics = {
|
|
enable = true;
|
|
enable32Bit = true;
|
|
};
|
|
|
|
pulseaudio= {
|
|
enable = true;
|
|
package = pkgs.pulseaudioFull;
|
|
};
|
|
|
|
enableAllFirmware = true;
|
|
|
|
bluetooth = {
|
|
powerOnBoot = true;
|
|
settings = {
|
|
General = {
|
|
Enable = "Source,Sink,Media,Socket";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:7d696b64-debe-4a95-80b5-1e510156a6c6"></a>Common network settings<br />
|
|
<div class="outline-text-5" id="text-h:7d696b64-debe-4a95-80b5-1e510156a6c6">
|
|
<p>
|
|
Here I only enable <code>networkmanager</code>. Most of the 'real' network config is done in <a href="#h:88bf4b90-e94b-46fb-aaf1-a381a512860d">System specific configuration</a>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
networking.networkmanager = {
|
|
enable = true;
|
|
ensureProfiles = {
|
|
environmentFiles = [
|
|
"${config.sops.templates."network-manager.env".path}"
|
|
];
|
|
profiles = {
|
|
"Ernest Routerford" = {
|
|
connection = {
|
|
id = "Ernest Routerford";
|
|
permissions = "";
|
|
type = "wifi";
|
|
};
|
|
ipv4 = {
|
|
dns-search = "";
|
|
method = "auto";
|
|
};
|
|
ipv6 = {
|
|
addr-gen-mode = "stable-privacy";
|
|
dns-search = "";
|
|
method = "auto";
|
|
};
|
|
wifi = {
|
|
mac-address-blacklist = "";
|
|
mode = "infrastructure";
|
|
ssid = "Ernest Routerford";
|
|
};
|
|
wifi-security = {
|
|
auth-alg = "open";
|
|
key-mgmt = "wpa-psk";
|
|
psk = "$ERNEST";
|
|
};
|
|
};
|
|
|
|
LAN-Party = {
|
|
connection = {
|
|
autoconnect = "false";
|
|
id = "LAN-Party";
|
|
type = "ethernet";
|
|
};
|
|
ethernet = {
|
|
auto-negotiate = "true";
|
|
cloned-mac-address = "preserve";
|
|
mac-address = "90:2E:16:D0:A1:87";
|
|
};
|
|
ipv4 = { method = "shared"; };
|
|
ipv6 = {
|
|
addr-gen-mode = "stable-privacy";
|
|
method = "auto";
|
|
};
|
|
proxy = { };
|
|
};
|
|
|
|
eduroam = {
|
|
"802-1x" = {
|
|
eap = "ttls;";
|
|
identity = "$EDUID";
|
|
password = "$EDUPASS";
|
|
phase2-auth = "mschapv2";
|
|
};
|
|
connection = {
|
|
id = "eduroam";
|
|
type = "wifi";
|
|
};
|
|
ipv4 = { method = "auto"; };
|
|
ipv6 = {
|
|
addr-gen-mode = "default";
|
|
method = "auto";
|
|
};
|
|
proxy = { };
|
|
wifi = {
|
|
mode = "infrastructure";
|
|
ssid = "eduroam";
|
|
};
|
|
wifi-security = {
|
|
auth-alg = "open";
|
|
key-mgmt = "wpa-eap";
|
|
};
|
|
};
|
|
|
|
local = {
|
|
connection = {
|
|
autoconnect = "false";
|
|
id = "local";
|
|
type = "ethernet";
|
|
};
|
|
ethernet = { };
|
|
ipv4 = {
|
|
address1 = "10.42.1.1/24";
|
|
method = "shared";
|
|
};
|
|
ipv6 = {
|
|
addr-gen-mode = "stable-privacy";
|
|
method = "auto";
|
|
};
|
|
proxy = { };
|
|
};
|
|
|
|
HH40V_39F5 = {
|
|
connection = {
|
|
id = "HH40V_39F5";
|
|
type = "wifi";
|
|
};
|
|
ipv4 = { method = "auto"; };
|
|
ipv6 = {
|
|
addr-gen-mode = "stable-privacy";
|
|
method = "auto";
|
|
};
|
|
proxy = { };
|
|
wifi = {
|
|
band = "bg";
|
|
mode = "infrastructure";
|
|
ssid = "HH40V_39F5";
|
|
};
|
|
wifi-security = {
|
|
key-mgmt = "wpa-psk";
|
|
psk = "$FRAUNS";
|
|
};
|
|
};
|
|
|
|
magicant = {
|
|
connection = {
|
|
id = "magicant";
|
|
type = "wifi";
|
|
};
|
|
ipv4 = { method = "auto"; };
|
|
ipv6 = {
|
|
addr-gen-mode = "default";
|
|
method = "auto";
|
|
};
|
|
proxy = { };
|
|
wifi = {
|
|
mode = "infrastructure";
|
|
ssid = "magicant";
|
|
};
|
|
wifi-security = {
|
|
auth-alg = "open";
|
|
key-mgmt = "wpa-psk";
|
|
psk = "$HANDYHOTSPOT";
|
|
};
|
|
};
|
|
|
|
"sweden-aes-128-cbc-udp-dns" = {
|
|
connection = {
|
|
autoconnect = "false";
|
|
id = "PIA Sweden";
|
|
type = "vpn";
|
|
};
|
|
ipv4 = { method = "auto"; };
|
|
ipv6 = {
|
|
addr-gen-mode = "stable-privacy";
|
|
method = "auto";
|
|
};
|
|
proxy = { };
|
|
vpn = {
|
|
auth = "sha1";
|
|
ca =
|
|
"${config.users.users.swarsel.home}/.dotfiles/secrets/certs/sweden-aes-128-cbc-udp-dns-ca.pem";
|
|
challenge-response-flags = "2";
|
|
cipher = "aes-128-cbc";
|
|
compress = "yes";
|
|
connection-type = "password";
|
|
crl-verify-file = "${config.users.users.swarsel.home}/.dotfiles/secrets/certs/sweden-aes-128-cbc-udp-dns-crl-verify.pem";
|
|
dev = "tun";
|
|
password-flags = "0";
|
|
remote = "sweden.privacy.network:1198";
|
|
remote-cert-tls = "server";
|
|
reneg-seconds = "0";
|
|
service-type = "org.freedesktop.NetworkManager.openvpn";
|
|
username = "$VPNUSER";
|
|
};
|
|
vpn-secrets = { password = "$VPNPASS"; };
|
|
};
|
|
|
|
Hotspot = {
|
|
connection = {
|
|
autoconnect = "false";
|
|
id = "Hotspot";
|
|
type = "wifi";
|
|
};
|
|
ipv4 = { method = "shared"; };
|
|
ipv6 = {
|
|
addr-gen-mode = "default";
|
|
method = "ignore";
|
|
};
|
|
proxy = { };
|
|
wifi = {
|
|
mode = "ap";
|
|
ssid = "Hotspot-fourside";
|
|
};
|
|
wifi-security = {
|
|
group = "ccmp;";
|
|
key-mgmt = "wpa-psk";
|
|
pairwise = "ccmp;";
|
|
proto = "rsn;";
|
|
psk = "$HOTSPOT";
|
|
};
|
|
};
|
|
|
|
};
|
|
};
|
|
};
|
|
|
|
systemd.services.NetworkManager-ensure-profiles.after = [ "NetworkManager.service" ];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:852d59ab-63c3-4831-993d-b5e23b877796"></a>Locale settings<br />
|
|
<div class="outline-text-5" id="text-h:852d59ab-63c3-4831-993d-b5e23b877796">
|
|
<p>
|
|
Setup timezone and locale. I want to use the US layout, but have the rest adapted to my country and timezone.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
time.timeZone = "Europe/Vienna";
|
|
|
|
i18n = {
|
|
defaultLocale = "en_US.UTF-8";
|
|
extraLocaleSettings = {
|
|
LC_ADDRESS = "de_AT.UTF-8";
|
|
LC_IDENTIFICATION = "de_AT.UTF-8";
|
|
LC_MEASUREMENT = "de_AT.UTF-8";
|
|
LC_MONETARY = "de_AT.UTF-8";
|
|
LC_NAME = "de_AT.UTF-8";
|
|
LC_NUMERIC = "de_AT.UTF-8";
|
|
LC_PAPER = "de_AT.UTF-8";
|
|
LC_TELEPHONE = "de_AT.UTF-8";
|
|
LC_TIME = "de_AT.UTF-8";
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:d87d80fd-2ac7-4f29-b338-0518d06b4deb" class="outline-4">
|
|
<h4 id="h:d87d80fd-2ac7-4f29-b338-0518d06b4deb"><span class="section-number-4">3.2.2.</span> sops</h4>
|
|
<div class="outline-text-4" id="text-h:d87d80fd-2ac7-4f29-b338-0518d06b4deb">
|
|
<p>
|
|
I use sops-nix to handle secrets that I want to have available on my machines at all times. Procedure to add a new machine:
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li>`ssh-keygen -t ed25519 -C "NAME sops"` in .ssh directory (or wherever) - name e.g. "sops"</li>
|
|
<li>cat ~/.ssh/sops.pub | ssh-to-age | wl-copy</li>
|
|
<li>add the output to .sops.yaml</li>
|
|
<li>cp ~/.ssh/sops.pub ~/.dotfiles/secrets/keys/NAME.pub</li>
|
|
<li>update entry for sops.age.sshKeyPaths</li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
sops = {
|
|
|
|
defaultSopsFile = "${config.users.users.swarsel.home}/.dotfiles/secrets/general/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
|
|
secrets = {
|
|
swarseluser = { neededForUsers = true; };
|
|
ernest = { };
|
|
frauns = { };
|
|
hotspot = { };
|
|
eduid = { };
|
|
edupass = { };
|
|
handyhotspot = { };
|
|
vpnuser = { };
|
|
vpnpass = { };
|
|
};
|
|
templates = {
|
|
"network-manager.env".content = ''
|
|
ERNEST=${config.sops.placeholder.ernest}
|
|
FRAUNS=${config.sops.placeholder.frauns}
|
|
HOTSPOT=${config.sops.placeholder.hotspot}
|
|
EDUID=${config.sops.placeholder.eduid}
|
|
EDUPASS=${config.sops.placeholder.edupass}
|
|
HANDYHOTSPOT=${config.sops.placeholder.handyhotspot}
|
|
VPNUSER=${config.sops.placeholder.vpnuser}
|
|
VPNPASS=${config.sops.placeholder.vpnpass}
|
|
'';
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:0e7e8bea-ec58-499c-9731-09dddfc39532" class="outline-4">
|
|
<h4 id="h:0e7e8bea-ec58-499c-9731-09dddfc39532"><span class="section-number-4">3.2.3.</span> System Packages</h4>
|
|
<div class="outline-text-4" id="text-h:0e7e8bea-ec58-499c-9731-09dddfc39532">
|
|
<p>
|
|
Mostly used to install some compilers and lsp's that I want to have available when not using a devShell flake. Most other packages should go in <a href="#h:893a7f33-7715-415b-a895-2687ded31c18">Installed packages</a>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
environment.systemPackages = with pkgs; [
|
|
# yubikey packages
|
|
gnupg
|
|
yubikey-personalization
|
|
yubikey-personalization-gui
|
|
yubico-pam
|
|
yubioath-flutter
|
|
yubikey-manager
|
|
yubikey-manager-qt
|
|
yubico-piv-tool
|
|
cfssl
|
|
pcsctools
|
|
pcscliteWithPolkit.out
|
|
|
|
# ledger packages
|
|
ledger-live-desktop
|
|
|
|
# pinentry
|
|
|
|
# theme related
|
|
adwaita-icon-theme
|
|
|
|
# kde-connect
|
|
xdg-desktop-portal
|
|
|
|
# bluetooth
|
|
bluez
|
|
|
|
# lsp-related -------------------------------
|
|
# nix
|
|
# latex
|
|
texlab
|
|
ghostscript_headless
|
|
# wireguard
|
|
wireguard-tools
|
|
# rust
|
|
rust-analyzer
|
|
clippy
|
|
rustfmt
|
|
# go
|
|
go
|
|
gopls
|
|
# zig
|
|
zig
|
|
zls
|
|
# cpp
|
|
clang-tools
|
|
# + cuda
|
|
cudatoolkit
|
|
#lsp-bridge / python
|
|
gcc
|
|
gdb
|
|
(python3.withPackages (ps: with ps; [ jupyter ipython pyqt5 epc orjson sexpdata six setuptools paramiko numpy pandas scipy matplotlib requests debugpy flake8 gnureadline python-lsp-server ]))
|
|
# (python3.withPackages(ps: with ps; [ jupyter ipython pyqt5 numpy pandas scipy matplotlib requests debugpy flake8 gnureadline python-lsp-server]))
|
|
# --------------------------------------------
|
|
|
|
(stdenv.mkDerivation {
|
|
name = "oama";
|
|
|
|
src = pkgs.fetchurl {
|
|
name = "oama";
|
|
url = "https://github.com/pdobsan/oama/releases/download/0.13.1/oama-0.13.1-Linux-x86_64-static.tgz";
|
|
sha256 = "sha256-OTdCObVfnMPhgZxVtZqehgUXtKT1iyqozdkPIV+i3Gc=";
|
|
};
|
|
|
|
phases = [
|
|
"unpackPhase"
|
|
];
|
|
|
|
unpackPhase = ''
|
|
mkdir -p $out/bin
|
|
tar xvf $src -C $out/
|
|
mv $out/oama-0.13.1-Linux-x86_64-static/oama $out/bin/
|
|
'';
|
|
|
|
})
|
|
|
|
];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:2bbf5f31-246d-4738-925f-eca40681f7b6" class="outline-4">
|
|
<h4 id="h:2bbf5f31-246d-4738-925f-eca40681f7b6"><span class="section-number-4">3.2.4.</span> Programs (including zsh setup)</h4>
|
|
<div class="outline-text-4" id="text-h:2bbf5f31-246d-4738-925f-eca40681f7b6">
|
|
<p>
|
|
Some programs profit from being installed through dedicated NixOS settings on system-level; these go here. Notably the zsh setup goes here and cannot be deleted under any circumstances.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs = {
|
|
dconf.enable = true;
|
|
evince.enable = true;
|
|
kdeconnect.enable = true;
|
|
};
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Also, we setup zsh. Do not touch this.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.zsh.enable = true;
|
|
users.defaultUserShell = pkgs.zsh;
|
|
environment.shells = with pkgs; [ zsh ];
|
|
environment.pathsToLink = [ "/share/zsh" ];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:79f3258f-ed9d-434d-b50a-e58d57ade2a7" class="outline-4">
|
|
<h4 id="h:79f3258f-ed9d-434d-b50a-e58d57ade2a7"><span class="section-number-4">3.2.5.</span> Services</h4>
|
|
<div class="outline-text-4" id="text-h:79f3258f-ed9d-434d-b50a-e58d57ade2a7">
|
|
<p>
|
|
Setting up some hardware services as well as keyboard related settings. Here we make sure that we can use the CAPS key as a ESC/CTRL double key, which is a lifesaver.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:b91df05b-113d-4d09-93d1-b271e5b76810"></a>blueman<br />
|
|
<div class="outline-text-5" id="text-h:b91df05b-113d-4d09-93d1-b271e5b76810">
|
|
<p>
|
|
Enables the blueman service including the nice system tray icon.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.blueman.enable = true;
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:fae5939e-22ac-4532-a10e-0b86013d20ce"></a>Detect Scanners over network<br />
|
|
<div class="outline-text-5" id="text-h:fae5939e-22ac-4532-a10e-0b86013d20ce">
|
|
<p>
|
|
This allows me to use my big scanner/printer's scanning function over the network.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
# enable scanners over network
|
|
hardware.sane = {
|
|
enable = true;
|
|
extraBackends = [ pkgs.sane-airscan ];
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:8c13df62-c6d9-4a0a-83be-d77e71628f0b"></a>Detect Printers over network<br />
|
|
<div class="outline-text-5" id="text-h:8c13df62-c6d9-4a0a-83be-d77e71628f0b">
|
|
<p>
|
|
This allows me to use my big scanner/printer's printing function over the network. Most of the settings are driver related.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
# enable discovery and usage of network devices (esp. printers)
|
|
services.printing = {
|
|
enable = true;
|
|
drivers = [
|
|
pkgs.gutenprint
|
|
pkgs.gutenprintBin
|
|
];
|
|
browsedConf = ''
|
|
BrowseDNSSDSubTypes _cups,_print
|
|
BrowseLocalProtocols all
|
|
BrowseRemoteProtocols all
|
|
CreateIPPPrinterQueues All
|
|
BrowseProtocols all
|
|
'';
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Avahi is the service used for the network discovery
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.avahi = {
|
|
enable = true;
|
|
nssmdns4 = true;
|
|
openFirewall = true;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:f101daa2-604d-4553-99e2-f64b9c207f51"></a>enable GVfs<br />
|
|
<div class="outline-text-5" id="text-h:f101daa2-604d-4553-99e2-f64b9c207f51">
|
|
<p>
|
|
This is being set to allow myself to use all functions of nautilus in NixOS
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.gvfs.enable = true;
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:08d213d5-a9f4-4309-8635-ba557b01dc7d"></a>interception-tools: Make CAPS work as ESC/CTRL<br />
|
|
<div class="outline-text-5" id="text-h:08d213d5-a9f4-4309-8635-ba557b01dc7d">
|
|
<p>
|
|
This is a super-convenient package that lets my remap my <code>CAPS</code> key to <code>ESC</code> if pressed shortly, and <code>CTRL</code> if being held.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
# Make CAPS work as a dual function ESC/CTRL key
|
|
services.interception-tools = {
|
|
enable = true;
|
|
udevmonConfig =
|
|
let
|
|
dualFunctionKeysConfig = builtins.toFile "dual-function-keys.yaml" ''
|
|
TIMING:
|
|
TAP_MILLISEC: 200
|
|
DOUBLE_TAP_MILLISEC: 0
|
|
|
|
MAPPINGS:
|
|
- KEY: KEY_CAPSLOCK
|
|
TAP: KEY_ESC
|
|
HOLD: KEY_LEFTCTRL
|
|
'';
|
|
in
|
|
''
|
|
- JOB: |
|
|
${pkgs.interception-tools}/bin/intercept -g $DEVNODE \
|
|
| ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c ${dualFunctionKeysConfig} \
|
|
| ${pkgs.interception-tools}/bin/uinput -d $DEVNODE
|
|
DEVICE:
|
|
EVENTS:
|
|
EV_KEY: [KEY_CAPSLOCK]
|
|
'';
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:7a89b5e3-b700-4167-8b14-2b8172f33936" class="outline-4">
|
|
<h4 id="h:7a89b5e3-b700-4167-8b14-2b8172f33936"><span class="section-number-4">3.2.6.</span> Hardware compatibility settings (Yubikey, Ledger) - udev rules</h4>
|
|
<div class="outline-text-4" id="text-h:7a89b5e3-b700-4167-8b14-2b8172f33936">
|
|
<p>
|
|
It makes sense to house these settings in their own section, since they are all needed really. Note that the starting of the gpg-agent is done in the sway settings, to also perform this step of the setup for non NixOS-machines at the same time.
|
|
</p>
|
|
|
|
<p>
|
|
<code>pcscd</code> is needed to use the smartcard mode (CCID) of the Yubikey.
|
|
</p>
|
|
|
|
<p>
|
|
The exception is the system packages, since that cannot be defined twice in the same file (common.nix). The comment is left in as a remider for that.
|
|
</p>
|
|
|
|
<p>
|
|
The rest of the gpg-agent related settings are here: <a href="#h:66fd578f-d4a0-4e17-bf3d-a9eb64bc7103">gpg-agent</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.ssh.startAgent = false;
|
|
|
|
services.pcscd.enable = true;
|
|
|
|
hardware.ledger.enable = true;
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Also, this is a good place to setup the udev rules.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.udev.packages = with pkgs; [
|
|
yubikey-personalization
|
|
ledger-udev-rules
|
|
];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:eae45839-223a-4027-bce3-e26e092c9096" class="outline-4">
|
|
<h4 id="h:eae45839-223a-4027-bce3-e26e092c9096"><span class="section-number-4">3.2.7.</span> System Login</h4>
|
|
<div class="outline-text-4" id="text-h:eae45839-223a-4027-bce3-e26e092c9096">
|
|
<p>
|
|
This section houses the greetd related settings. I do not really want to use a display manager, but it is useful to have setup in some ways - in my case for starting sway on system startup. Notably the default user login setting that is commented out here goes into the <b>system specific</b> settings, make sure to update it there
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.greetd = {
|
|
enable = true;
|
|
settings = {
|
|
initial_session.command = "sway";
|
|
# initial_session.user ="swarsel";
|
|
default_session.command = ''
|
|
${pkgs.greetd.tuigreet}/bin/tuigreet \
|
|
--time \
|
|
--asterisks \
|
|
--user-menu \
|
|
--cmd sway
|
|
'';
|
|
};
|
|
};
|
|
|
|
environment.etc."greetd/environments".text = ''
|
|
sway
|
|
'';
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:f0a6b5e0-2157-4522-b5e1-3f0abd91c05e" class="outline-3">
|
|
<h3 id="h:f0a6b5e0-2157-4522-b5e1-3f0abd91c05e"><span class="section-number-3">3.3.</span> Common Home-Manager</h3>
|
|
<div class="outline-text-3" id="text-h:f0a6b5e0-2157-4522-b5e1-3f0abd91c05e">
|
|
</div>
|
|
<div id="outline-container-h:893a7f33-7715-415b-a895-2687ded31c18" class="outline-4">
|
|
<h4 id="h:893a7f33-7715-415b-a895-2687ded31c18"><span class="section-number-4">3.3.1.</span> Installed packages</h4>
|
|
<div class="outline-text-4" id="text-h:893a7f33-7715-415b-a895-2687ded31c18">
|
|
<p>
|
|
Here are defined some packages that I would like to use across all my machines. Most of these should not require further setup. Notably the cura package is severely outdated on nixpkgs, so I just fetch a more recent AppImage and run that instead.
|
|
</p>
|
|
|
|
<p>
|
|
Also, I define some useful shell scripts here.
|
|
</p>
|
|
|
|
<p>
|
|
Programming languages and default lsp's are defined here: <a href="#h:0e7e8bea-ec58-499c-9731-09dddfc39532">System Packages</a>
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:6ef9bb5f-c5ee-496e-86e2-d8d271a34d75"></a>Packaged<br />
|
|
<div class="outline-text-5" id="text-h:6ef9bb5f-c5ee-496e-86e2-d8d271a34d75">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{ config, pkgs, fetchFromGitHub, ... }:
|
|
|
|
{
|
|
home.packages = with pkgs; [
|
|
|
|
# audio stuff
|
|
spek # spectrum analyzer
|
|
losslessaudiochecker
|
|
ffmpeg_5-full
|
|
flac
|
|
mediainfo
|
|
picard-tools
|
|
audacity
|
|
sox
|
|
|
|
# printing
|
|
cups
|
|
simple-scan
|
|
|
|
# dict
|
|
(aspellWithDicts (dicts: with dicts; [ de en en-computers en-science ]))
|
|
|
|
# utilities
|
|
util-linux
|
|
nmap
|
|
lsof
|
|
|
|
# nix
|
|
alejandra
|
|
nixpkgs-fmt
|
|
deadnix
|
|
statix
|
|
|
|
# local file sharing
|
|
wormhole-rs
|
|
|
|
# b2 backup @backblaze
|
|
restic
|
|
|
|
# "big" programs
|
|
gimp
|
|
inkscape
|
|
zoom-us
|
|
# nomacs
|
|
libreoffice-qt
|
|
xournalpp
|
|
obsidian
|
|
spotify
|
|
discord
|
|
stable.nextcloud-client
|
|
spotify-player
|
|
element-desktop-wayland
|
|
nicotine-plus
|
|
stable.transmission
|
|
mktorrent
|
|
hexchat
|
|
hugo
|
|
|
|
# kyria
|
|
qmk
|
|
qmk-udev-rules
|
|
|
|
# games
|
|
lutris
|
|
wine
|
|
libudev-zero
|
|
dwarfs
|
|
fuse-overlayfs
|
|
# steam
|
|
# steam-run
|
|
patchelf
|
|
gamescope
|
|
vulkan-tools
|
|
moonlight-qt
|
|
ns-usbloader
|
|
|
|
# firefox related
|
|
tridactyl-native
|
|
|
|
# mako related
|
|
mako
|
|
libnotify
|
|
|
|
# general utilities
|
|
unrar
|
|
samba
|
|
cifs-utils
|
|
zbar # qr codes
|
|
readline
|
|
autotiling
|
|
brightnessctl
|
|
libappindicator-gtk3
|
|
sqlite
|
|
speechd
|
|
networkmanagerapplet
|
|
psmisc # kill etc
|
|
lm_sensors
|
|
# jq # used for searching the i3 tree in check<xxx>.sh files
|
|
|
|
# specifically needed for anki
|
|
# mpv
|
|
anki-bin
|
|
|
|
# dirvish file previews
|
|
fd
|
|
imagemagick
|
|
poppler
|
|
ffmpegthumbnailer
|
|
mediainfo
|
|
gnutar
|
|
unzip
|
|
|
|
#nautilus
|
|
nautilus
|
|
xfce.tumbler
|
|
libgsf
|
|
|
|
# wayland stuff
|
|
wtype
|
|
wl-clipboard
|
|
wl-mirror
|
|
|
|
# screenshotting tools
|
|
grim
|
|
slurp
|
|
|
|
# the following packages are used (in some way) by waybar
|
|
playerctl
|
|
pavucontrol
|
|
pamixer
|
|
# gnome.gnome-clocks
|
|
# wlogout
|
|
# jdiskreport
|
|
syncthingtray
|
|
# monitor
|
|
|
|
#keychain
|
|
qalculate-gtk
|
|
gcr # needed for gnome-secrets to work
|
|
seahorse
|
|
|
|
# sops-related
|
|
sops
|
|
ssh-to-age
|
|
|
|
# mail related packages
|
|
mu
|
|
|
|
# latex and related packages
|
|
(pkgs.texlive.combine {
|
|
inherit (pkgs.texlive) scheme-full
|
|
dvisvgm dvipng# for preview and export as html
|
|
wrapfig amsmath ulem hyperref capt-of;
|
|
})
|
|
|
|
# font stuff
|
|
(nerdfonts.override { fonts = [ "FiraMono" "FiraCode" "NerdFontsSymbolsOnly" ]; })
|
|
noto-fonts-emoji
|
|
font-awesome_5
|
|
noto-fonts
|
|
noto-fonts-cjk-sans
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:96cbea91-ff13-4120-b8a9-496b2fa96e70"></a>Self-defined<br />
|
|
<div class="outline-text-5" id="text-h:96cbea91-ff13-4120-b8a9-496b2fa96e70">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix"># cura
|
|
(
|
|
let
|
|
cura5 = appimageTools.wrapType2 rec {
|
|
name = "cura5";
|
|
version = "5.4.0";
|
|
src = fetchurl {
|
|
url = "https://github.com/Ultimaker/Cura/releases/download/${version}/UltiMaker-Cura-${version}-linux-modern.AppImage";
|
|
hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74=";
|
|
};
|
|
extraPkgs = pkgs: with pkgs; [ ];
|
|
};
|
|
in
|
|
writeScriptBin "cura" ''
|
|
#! ${pkgs.bash}/bin/bash
|
|
# AppImage version of Cura loses current working directory and treats all paths relateive to $HOME.
|
|
# So we convert each of the files passed as argument to an absolute path.
|
|
# This fixes use cases like `cd /path/to/my/files; cura mymodel.stl anothermodel.stl`.
|
|
args=()
|
|
for a in "$@"; do
|
|
if [ -e "$a" ]; then
|
|
a="$(realpath "$a")"
|
|
fi
|
|
args+=("$a")
|
|
done
|
|
exec "${cura5}/bin/cura5" "''${args[@]}"
|
|
''
|
|
)
|
|
|
|
#E: hides scratchpad depending on state, calls emacsclient for edit and then restores the scratchpad state
|
|
(pkgs.writeShellScriptBin "e" ''
|
|
bash ~/.dotfiles/scripts/editor_nowait.sh "$@"
|
|
'')
|
|
(pkgs.writeShellScriptBin "timer" ''
|
|
sleep "$1"; while true; do spd-say "$2"; sleep 0.5; done;
|
|
'')
|
|
|
|
(pkgs.writeScriptBin "project" ''
|
|
#! ${pkgs.bash}/bin/bash
|
|
if [ "$1" == "rust" ]; then
|
|
cp ~/.dotfiles/templates/rust_flake.nix ./flake.nix
|
|
cp ~/.dotfiles/templates/toolchain.toml .
|
|
elif [ "$1" == "cpp" ]; then
|
|
cp ~/.dotfiles/templates/cpp_flake.nix ./flake.nix
|
|
elif [ "$1" == "python" ]; then
|
|
cp ~/.dotfiles/templates/py_flake.nix ./flake.nix
|
|
elif [ "$1" == "cuda" ]; then
|
|
cp ~/.dotfiles/templates/cu_flake.nix ./flake.nix
|
|
elif [ "$1" == "other" ]; then
|
|
cp ~/.dotfiles/templates/other_flake.nix ./flake.nix
|
|
elif [ "$1" == "latex" ]; then
|
|
if [ "$2" == "" ]; then
|
|
echo "No filename specified, usage: 'project latex <NAME>'"
|
|
exit 0
|
|
fi
|
|
cp ~/.dotfiles/templates/tex_standard.tex ./"$2".tex
|
|
exit 0
|
|
else
|
|
echo "No valid argument given. Valid arguments are rust cpp python, cuda"
|
|
exit 0
|
|
fi
|
|
echo "use flake" >> .envrc
|
|
direnv allow
|
|
'')
|
|
|
|
(pkgs.writeShellApplication {
|
|
name = "pass-fuzzel";
|
|
runtimeInputs = [ pkgs.pass pkgs.fuzzel ];
|
|
text = ''
|
|
shopt -s nullglob globstar
|
|
|
|
typeit=0
|
|
if [[ $# -ge 1 && $1 == "--type" ]]; then
|
|
typeit=1
|
|
shift
|
|
fi
|
|
|
|
export PASSWORD_STORE_DIR=~/.local/share/password-store
|
|
prefix=''${PASSWORD_STORE_DIR-~/.local/share/password-store}
|
|
password_files=( "$prefix"/**/*.gpg )
|
|
password_files=( "''${password_files[@]#"$prefix"/}" )
|
|
password_files=( "''${password_files[@]%.gpg}" )
|
|
|
|
password=$(printf '%s\n' "''${password_files[@]}" | fuzzel --dmenu "$@")
|
|
|
|
[[ -n $password ]] || exit
|
|
|
|
if [[ $typeit -eq 0 ]]; then
|
|
pass show -c "$password" &>/tmp/pass-fuzzel
|
|
else
|
|
pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | wtype -
|
|
fi
|
|
notify-send -u critical -a pass -t 1000 "Copied/Typed Password"
|
|
'';
|
|
})
|
|
|
|
(pkgs.writeShellApplication {
|
|
name = "pass-fuzzel-otp";
|
|
runtimeInputs = [ pkgs.fuzzel (pkgs.pass.withExtensions (exts: [ exts.pass-otp ])) ];
|
|
text = ''
|
|
shopt -s nullglob globstar
|
|
|
|
typeit=0
|
|
if [[ $# -ge 1 && $1 == "--type" ]]; then
|
|
typeit=1
|
|
shift
|
|
fi
|
|
|
|
export PASSWORD_STORE_DIR=~/.local/share/password-store
|
|
prefix=''${PASSWORD_STORE_DIR-~/.local/share/password-store}
|
|
password_files=( "$prefix"/otp/**/*.gpg )
|
|
password_files=( "''${password_files[@]#"$prefix"/}" )
|
|
password_files=( "''${password_files[@]%.gpg}" )
|
|
|
|
password=$(printf '%s\n' "''${password_files[@]}" | fuzzel --dmenu "$@")
|
|
|
|
[[ -n $password ]] || exit
|
|
|
|
if [[ $typeit -eq 0 ]]; then
|
|
pass otp -c "$password" &>/tmp/pass-fuzzel
|
|
else
|
|
pass otp "$password" | { IFS= read -r pass; printf %s "$pass"; } | wtype -
|
|
fi
|
|
notify-send -u critical -a pass -t 1000 "Copied/Typed OTPassword"
|
|
'';
|
|
})
|
|
|
|
(pkgs.writeShellApplication {
|
|
name = "cdw";
|
|
runtimeInputs = [ pkgs.fzf ];
|
|
text = ''
|
|
cd "$(git worktree list | fzf | awk '{print $1}')"
|
|
'';
|
|
})
|
|
|
|
(pkgs.writeShellApplication {
|
|
name = "cdb";
|
|
runtimeInputs = [ pkgs.fzf ];
|
|
text = ''
|
|
git checkout "$(git branch --list | grep -v "^\*" | fzf | awk '{print $1}')"
|
|
'';
|
|
})
|
|
|
|
(pkgs.writeShellApplication {
|
|
name = "bak";
|
|
text = ''
|
|
cp "$1"{,.bak}
|
|
'';
|
|
})
|
|
|
|
];
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:d87d80fd-2ac7-4f29-b338-0518d06b4deb" class="outline-4">
|
|
<h4 id="h:d87d80fd-2ac7-4f29-b338-0518d06b4deb"><span class="section-number-4">3.3.2.</span> sops</h4>
|
|
<div class="outline-text-4" id="text-h:d87d80fd-2ac7-4f29-b338-0518d06b4deb">
|
|
<p>
|
|
I use sops-nix to handle secrets that I want to have available on my machines at all times. Procedure to add a new machine:
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li>`ssh-keygen -t ed25519 -C "NAME sops"` in .ssh directory (or wherever) - name e.g. "sops"</li>
|
|
<li>cat ~/.ssh/sops.pub | ssh-to-age | wl-copy</li>
|
|
<li>add the output to .sops.yaml</li>
|
|
<li>cp ~/.ssh/sops.pub ~/.dotfiles/secrets/keys/NAME.pub</li>
|
|
<li><p>
|
|
update entry for sops.age.sshKeyPaths
|
|
</p>
|
|
|
|
<p>
|
|
Since we are using the home-manager implementation here, we need to specify the runtime path.
|
|
</p></li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
sops = {
|
|
defaultSopsFile = "${config.home.homeDirectory}/.dotfiles/secrets/general/secrets.yaml";
|
|
validateSopsFiles = false;
|
|
secrets = {
|
|
mrswarsel = { path = "/run/user/1000/secrets/mrswarsel"; };
|
|
nautilus = { path = "/run/user/1000/secrets/nautilus"; };
|
|
leon = { path = "/run/user/1000/secrets/leon"; };
|
|
swarselmail = { path = "/run/user/1000/secrets/swarselmail"; };
|
|
caldav = { path = "${config.home.homeDirectory}/.emacs.d/.caldav"; };
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:edd6720e-1f90-40bf-b6f9-30a19d4cae08" class="outline-4">
|
|
<h4 id="h:edd6720e-1f90-40bf-b6f9-30a19d4cae08"><span class="section-number-4">3.3.3.</span> SSH Machines</h4>
|
|
<div class="outline-text-4" id="text-h:edd6720e-1f90-40bf-b6f9-30a19d4cae08">
|
|
<p>
|
|
It is very convenient to have SSH aliases in place for machines that I use. This is mainly used for some server machines and some university clusters. We also enable agent forwarding to have our Yubikey SSH key accessible on the remote host.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.ssh = {
|
|
enable = true;
|
|
forwardAgent = true;
|
|
extraConfig = ''
|
|
SetEnv TERM=xterm-256color
|
|
'';
|
|
matchBlocks = {
|
|
"nginx" = {
|
|
hostname = "192.168.1.14";
|
|
user = "root";
|
|
};
|
|
"jellyfin" = {
|
|
hostname = "192.168.1.16";
|
|
user = "root";
|
|
};
|
|
"pfsense" = {
|
|
hostname = "192.168.1.1";
|
|
user = "root";
|
|
};
|
|
"proxmox" = {
|
|
hostname = "192.168.1.2";
|
|
user = "root";
|
|
};
|
|
"transmission" = {
|
|
hostname = "192.168.1.6";
|
|
user = "root";
|
|
};
|
|
"fetcher" = {
|
|
hostname = "192.168.1.7";
|
|
user = "root";
|
|
};
|
|
"omv" = {
|
|
hostname = "192.168.1.3";
|
|
user = "root";
|
|
};
|
|
"webbot" = {
|
|
hostname = "192.168.1.11";
|
|
user = "root";
|
|
};
|
|
"nextcloud" = {
|
|
hostname = "192.168.1.5";
|
|
user = "root";
|
|
};
|
|
"sound" = {
|
|
hostname = "192.168.1.13";
|
|
user = "root";
|
|
};
|
|
"spotify" = {
|
|
hostname = "192.168.1.17";
|
|
user = "root";
|
|
};
|
|
"wordpress" = {
|
|
hostname = "192.168.1.9";
|
|
user = "root";
|
|
};
|
|
"turn" = {
|
|
hostname = "192.168.1.18";
|
|
user = "root";
|
|
};
|
|
"hugo" = {
|
|
hostname = "192.168.1.19";
|
|
user = "root";
|
|
};
|
|
"matrix" = {
|
|
hostname = "192.168.1.23";
|
|
user = "root";
|
|
};
|
|
"scroll" = {
|
|
hostname = "192.168.1.22";
|
|
user = "root";
|
|
};
|
|
"minecraft" = {
|
|
hostname = "130.61.119.129";
|
|
user = "opc";
|
|
};
|
|
"sync" = {
|
|
hostname = "193.122.53.173";
|
|
user = "root"; #this is a oracle vm server but needs root due to nixos-infect
|
|
};
|
|
"songdiver" = {
|
|
hostname = "89.168.100.65";
|
|
user = "ubuntu";
|
|
};
|
|
"pkv" = {
|
|
hostname = "46.232.248.161";
|
|
user = "root";
|
|
};
|
|
"efficient" = {
|
|
hostname = "g0.complang.tuwien.ac.at";
|
|
forwardAgent = true;
|
|
user = "ep01427399";
|
|
};
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:a92318cd-413e-4e78-a478-e63b09df019c" class="outline-4">
|
|
<h4 id="h:a92318cd-413e-4e78-a478-e63b09df019c"><span class="section-number-4">3.3.4.</span> Fonts + Theme</h4>
|
|
<div class="outline-text-4" id="text-h:a92318cd-413e-4e78-a478-e63b09df019c">
|
|
<p>
|
|
These section allows home-manager to allow theme settings, and handles some other appearance-related settings like cursor styles. Interestingly, system icons (adwaita) still need to be setup on system-level, and will break if defined here.
|
|
</p>
|
|
|
|
<p>
|
|
This section has been notably empty ever since switching to stylix. Only Emacs is not allowed to be styled by it, because it becomes more ugly compared to my handcrafted setup.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
stylix.targets.emacs.enable = false;
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:867556e6-5a24-4c43-9d47-3edca2f16488" class="outline-4">
|
|
<h4 id="h:867556e6-5a24-4c43-9d47-3edca2f16488"><span class="section-number-4">3.3.5.</span> Desktop Entries</h4>
|
|
<div class="outline-text-4" id="text-h:867556e6-5a24-4c43-9d47-3edca2f16488">
|
|
<p>
|
|
Some programs lack a dmenu launcher - I define them myself here.
|
|
</p>
|
|
|
|
<p>
|
|
TODO: Non-NixOS machines (=sp3) should not use these by default, but instead the programs prefixed with "nixGL". I need to figure out how to automate this process, as it is not feasible to write desktop entries for all programs installed on that machine.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
xdg.desktopEntries = {
|
|
|
|
cura = {
|
|
name = "Ultimaker Cura";
|
|
genericName = "Cura";
|
|
exec = "cura";
|
|
terminal = false;
|
|
categories = [ "Application" ];
|
|
};
|
|
|
|
anki = {
|
|
name = "Anki Flashcards";
|
|
genericName = "Anki";
|
|
exec = "anki";
|
|
terminal = false;
|
|
categories = [ "Application" ];
|
|
};
|
|
|
|
# schlidichat = {
|
|
# name = "SchildiChat Matrix Client";
|
|
# genericName = "SchildiChat";
|
|
# exec = "schildichat-desktop -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";
|
|
# terminal = false;
|
|
# categories = [ "Application"];
|
|
# };
|
|
|
|
element = {
|
|
name = "Element Matrix Client";
|
|
genericName = "Element";
|
|
exec = "element-desktop -enable-features=UseOzonePlatform -ozone-platform=wayland --disable-gpu-driver-bug-workarounds";
|
|
terminal = false;
|
|
categories = [ "Application" ];
|
|
};
|
|
|
|
emacsclient-newframe = {
|
|
name = "Emacs (Client, New Frame)";
|
|
genericName = "Emacs (Client, New Frame)";
|
|
exec = "emacsclient -r %u";
|
|
icon = "emacs";
|
|
terminal = false;
|
|
categories = [ "Development" "TextEditor" ];
|
|
};
|
|
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:5ef03803-e150-41bc-b603-e80d60d96efc" class="outline-4">
|
|
<h4 id="h:5ef03803-e150-41bc-b603-e80d60d96efc"><span class="section-number-4">3.3.6.</span> Linking dotfiles</h4>
|
|
<div class="outline-text-4" id="text-h:5ef03803-e150-41bc-b603-e80d60d96efc">
|
|
<p>
|
|
This section should be used in order to symlink already existing configuration files using `home.file` and setting session variables using `home.sessionVariables`.
|
|
</p>
|
|
|
|
<p>
|
|
As for the `home.sessionVariables`, it should be noted that environment variables that are needed at system start should NOT be loaded here, but instead in `programs.zsh.config.extraSessionCommands` (in the home-manager programs section). This is also where all the wayland related variables are stored.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
home.file = {
|
|
"init.el" = {
|
|
source = ../../programs/emacs/init.el;
|
|
target = ".emacs.d/init.el";
|
|
};
|
|
"early-init.el" = {
|
|
source = ../../programs/emacs/early-init.el;
|
|
target = ".emacs.d/early-init.el";
|
|
};
|
|
# on NixOS, Emacs does not find the aspell dicts easily. Write the configuration manually
|
|
".aspell.conf" = {
|
|
source = ../../programs/config/.aspell.conf;
|
|
target = ".aspell.conf";
|
|
};
|
|
".gitmessage" = {
|
|
source = ../../programs/git/.gitmessage;
|
|
target = ".gitmessage";
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Also, we link some files to the users XDG configuration home:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
xdg.configFile = {
|
|
"tridactyl/tridactylrc".source = ../../programs/firefox/tridactyl/tridactylrc;
|
|
"tridactyl/themes/base16-codeschool.css".source = ../../programs/firefox/tridactyl/themes/base16-codeschool.css;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:4486b02f-4fb8-432b-bfa2-2e786206341d" class="outline-4">
|
|
<h4 id="h:4486b02f-4fb8-432b-bfa2-2e786206341d"><span class="section-number-4">3.3.7.</span> Sourcing environment variables</h4>
|
|
<div class="outline-text-4" id="text-h:4486b02f-4fb8-432b-bfa2-2e786206341d">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
home.sessionVariables = {
|
|
EDITOR = "bash ~/.dotfiles/scripts/editor.sh";
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:070a75ce-e209-4cda-aa25-e979bbf75d47" class="outline-4">
|
|
<h4 id="h:070a75ce-e209-4cda-aa25-e979bbf75d47"><span class="section-number-4">3.3.8.</span> Programs</h4>
|
|
<div class="outline-text-4" id="text-h:070a75ce-e209-4cda-aa25-e979bbf75d47">
|
|
<p>
|
|
This houses the configurations for all programs managed by home-manager.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:f0e0b580-2e1c-4ca6-a983-f05d3ebbbcde"></a>General Programs: bottom, imv, sioyek, bat, carapace, wlogout, swayr, yt-dlp, mpv, jq, nix-index, ripgrep, pandoc, fzf<br />
|
|
<div class="outline-text-5" id="text-h:f0e0b580-2e1c-4ca6-a983-f05d3ebbbcde">
|
|
<p>
|
|
This section is for programs that require no further configuration. zsh Integration is enabled by default for these.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs = {
|
|
bottom.enable = true;
|
|
imv.enable = true;
|
|
sioyek.enable = true;
|
|
bat.enable = true;
|
|
carapace.enable = true;
|
|
wlogout.enable = true;
|
|
swayr.enable = true;
|
|
yt-dlp.enable = true;
|
|
mpv.enable = true;
|
|
jq.enable = true;
|
|
ripgrep.enable = true;
|
|
pandoc.enable = true;
|
|
fzf.enable = true;
|
|
zoxide.enable = true;
|
|
};
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-org05cfe0c" class="outline-4">
|
|
<h4 id="org05cfe0c"><span class="section-number-4">3.3.9.</span> nix-index</h4>
|
|
<div class="outline-text-4" id="text-3-3-9">
|
|
<p>
|
|
nix-index provides a way to find out which packages are provided by which derivations. By default it also comes with a replacement for <code>command-not-found.sh</code>, however, the implementation is based on a channel based setup. I like consistency, so I replace the command with one that provides a flakes-based output.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.nix-index =
|
|
let
|
|
command-not-found = pkgs.runCommandLocal "command-not-found.sh" { } ''
|
|
mkdir -p $out/etc/profile.d
|
|
substitute ${../../scripts/command-not-found.sh} \
|
|
$out/etc/profile.d/command-not-found.sh \
|
|
--replace @nix-locate@ ${pkgs.nix-index}/bin/nix-locate \
|
|
--replace @tput@ ${pkgs.ncurses}/bin/tput
|
|
'';
|
|
in
|
|
{
|
|
enable = true;
|
|
package = pkgs.symlinkJoin {
|
|
name = "nix-index";
|
|
paths = [ command-not-found ];
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:ac0e5e62-0dbf-4782-9a96-9e558eae86ae" class="outline-4">
|
|
<h4 id="h:ac0e5e62-0dbf-4782-9a96-9e558eae86ae"><span class="section-number-4">3.3.10.</span> password-store</h4>
|
|
<div class="outline-text-4" id="text-h:ac0e5e62-0dbf-4782-9a96-9e558eae86ae">
|
|
<p>
|
|
Enables password store with the <code>pass-otp</code> extension which allows me to store and generate one-time-passwords.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.password-store = {
|
|
enable = true;
|
|
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:1ab84307-b3fb-4c32-9def-4b89a53a8547" class="outline-4">
|
|
<h4 id="h:1ab84307-b3fb-4c32-9def-4b89a53a8547"><span class="section-number-4">3.3.11.</span> direnv</h4>
|
|
<div class="outline-text-4" id="text-h:1ab84307-b3fb-4c32-9def-4b89a53a8547">
|
|
<p>
|
|
Enables direnv, which I use for nearly all of my nix dev flakes.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.direnv = {
|
|
enable = true;
|
|
nix-direnv.enable = true;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:1bd6b0c7-f201-43e2-9624-6c50de00a1f6" class="outline-4">
|
|
<h4 id="h:1bd6b0c7-f201-43e2-9624-6c50de00a1f6"><span class="section-number-4">3.3.12.</span> eza</h4>
|
|
<div class="outline-text-4" id="text-h:1bd6b0c7-f201-43e2-9624-6c50de00a1f6">
|
|
<p>
|
|
Eza provides me with a better <code>ls</code> command and some other useful aliases.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.eza = {
|
|
enable = true;
|
|
icons = true;
|
|
git = true;
|
|
extraOptions = [
|
|
"-l"
|
|
"--group-directories-first"
|
|
];
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:419675ec-3310-438e-80ae-9eaa798a319d" class="outline-4">
|
|
<h4 id="h:419675ec-3310-438e-80ae-9eaa798a319d"><span class="section-number-4">3.3.13.</span> git</h4>
|
|
<div class="outline-text-4" id="text-h:419675ec-3310-438e-80ae-9eaa798a319d">
|
|
<p>
|
|
Here I set up my git config, automatic signing of commits, useful aliases for my ost used commands (for when I am not using <a href="#h:d2c7323d-f8c6-4f23-b70a-930e3e4ecce5">Magit</a>) as well as a git template defined in <a href="#h:5ef03803-e150-41bc-b603-e80d60d96efc">Linking dotfiles</a>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.git = {
|
|
enable = true;
|
|
aliases = {
|
|
a = "add";
|
|
c = "commit";
|
|
cl = "clone";
|
|
co = "checkout";
|
|
b = "branch";
|
|
i = "init";
|
|
m = "merge";
|
|
s = "status";
|
|
r = "restore";
|
|
p = "pull";
|
|
pp = "push";
|
|
};
|
|
signing = {
|
|
key = "0x76FD3810215AE097";
|
|
signByDefault = true;
|
|
};
|
|
userEmail = "leon.schwarzaeugl@gmail.com";
|
|
userName = "Swarsel";
|
|
difftastic.enable = true;
|
|
lfs.enable = true;
|
|
includes = [
|
|
{
|
|
contents = {
|
|
github = {
|
|
user = "Swarsel";
|
|
};
|
|
commit = {
|
|
template = "~/.gitmessage";
|
|
};
|
|
};
|
|
}
|
|
];
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:069cabf3-df14-49ba-8d17-75f2bcf34fbf" class="outline-4">
|
|
<h4 id="h:069cabf3-df14-49ba-8d17-75f2bcf34fbf"><span class="section-number-4">3.3.14.</span> Fuzzel</h4>
|
|
<div class="outline-text-4" id="text-h:069cabf3-df14-49ba-8d17-75f2bcf34fbf">
|
|
<p>
|
|
Here I only need to set basic layout options - the rest is being managed by stylix.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.fuzzel = {
|
|
enable = true;
|
|
settings = {
|
|
main = {
|
|
layer = "overlay";
|
|
lines = "10";
|
|
width = "40";
|
|
};
|
|
border.radius = "0";
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:55212502-c8f6-43af-ae99-55c8377ef34e" class="outline-4">
|
|
<h4 id="h:55212502-c8f6-43af-ae99-55c8377ef34e"><span class="section-number-4">3.3.15.</span> Starship</h4>
|
|
<div class="outline-text-4" id="text-h:55212502-c8f6-43af-ae99-55c8377ef34e">
|
|
<p>
|
|
Starship makes my <code>zsh</code> look cooler! I have symbols for most programming languages and toolchains, also I build my own powerline.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.starship = {
|
|
enable = true;
|
|
enableZshIntegration = true;
|
|
settings = {
|
|
add_newline = false;
|
|
format = "$character";
|
|
right_format = "$all";
|
|
command_timeout = 3000;
|
|
|
|
directory.substitutions = {
|
|
"Documents" = " ";
|
|
"Downloads" = " ";
|
|
"Music" = " ";
|
|
"Pictures" = " ";
|
|
};
|
|
|
|
git_status = {
|
|
style = "bg:#394260";
|
|
format = "[[($all_status$ahead_behind )](fg:#769ff0 bg:#394260)]($style)";
|
|
};
|
|
|
|
character = {
|
|
success_symbol = "[λ](bold green)";
|
|
error_symbol = "[λ](bold red)";
|
|
};
|
|
|
|
aws.symbol = " ";
|
|
buf.symbol = " ";
|
|
c.symbol = " ";
|
|
conda.symbol = " ";
|
|
dart.symbol = " ";
|
|
directory.read_only = " ";
|
|
docker_context.symbol = " ";
|
|
elixir.symbol = " ";
|
|
elm.symbol = " ";
|
|
fossil_branch.symbol = " ";
|
|
git_branch.symbol = " ";
|
|
golang.symbol = " ";
|
|
guix_shell.symbol = " ";
|
|
haskell.symbol = " ";
|
|
haxe.symbol = " ";
|
|
hg_branch.symbol = " ";
|
|
hostname.ssh_symbol = " ";
|
|
java.symbol = " ";
|
|
julia.symbol = " ";
|
|
lua.symbol = " ";
|
|
memory_usage.symbol = " ";
|
|
meson.symbol = " ";
|
|
nim.symbol = " ";
|
|
nix_shell.symbol = " ";
|
|
nodejs.symbol = " ";
|
|
|
|
os.symbols = {
|
|
Alpaquita = " ";
|
|
Alpine = " ";
|
|
Amazon = " ";
|
|
Android = " ";
|
|
Arch = " ";
|
|
Artix = " ";
|
|
CentOS = " ";
|
|
Debian = " ";
|
|
DragonFly = " ";
|
|
Emscripten = " ";
|
|
EndeavourOS = " ";
|
|
Fedora = " ";
|
|
FreeBSD = " ";
|
|
Garuda = " ";
|
|
Gentoo = " ";
|
|
HardenedBSD = " ";
|
|
Illumos = " ";
|
|
Linux = " ";
|
|
Mabox = " ";
|
|
Macos = " ";
|
|
Manjaro = " ";
|
|
Mariner = " ";
|
|
MidnightBSD = " ";
|
|
Mint = " ";
|
|
NetBSD = " ";
|
|
NixOS = " ";
|
|
OpenBSD = " ";
|
|
openSUSE = " ";
|
|
OracleLinux = " ";
|
|
Pop = " ";
|
|
Raspbian = " ";
|
|
Redhat = " ";
|
|
RedHatEnterprise = " ";
|
|
Redox = " ";
|
|
Solus = " ";
|
|
SUSE = " ";
|
|
Ubuntu = " ";
|
|
Unknown = " ";
|
|
Windows = " ";
|
|
};
|
|
|
|
package.symbol = " ";
|
|
pijul_channel.symbol = " ";
|
|
python.symbol = " ";
|
|
rlang.symbol = " ";
|
|
ruby.symbol = " ";
|
|
rust.symbol = " ";
|
|
scala.symbol = " ";
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:5f1287db-d2e8-49aa-8c58-730129c7795c" class="outline-4">
|
|
<h4 id="h:5f1287db-d2e8-49aa-8c58-730129c7795c"><span class="section-number-4">3.3.16.</span> Kitty</h4>
|
|
<div class="outline-text-4" id="text-h:5f1287db-d2e8-49aa-8c58-730129c7795c">
|
|
<p>
|
|
Kitty is the terminal emulator of choice for me, it is nice to configure using nix, fast, and has a nice style.
|
|
</p>
|
|
|
|
<p>
|
|
The theme is handled by stylix.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.kitty = {
|
|
enable = true;
|
|
keybindings = {
|
|
"ctrl+shift+left" = "no_op";
|
|
"ctrl+shift+right" = "no_op";
|
|
"ctrl+shift+home" = "no_op";
|
|
"ctrl+shift+end" = "no_op";
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:91dd4cc4-aada-4e74-be23-0cc69ed85af5" class="outline-4">
|
|
<h4 id="h:91dd4cc4-aada-4e74-be23-0cc69ed85af5"><span class="section-number-4">3.3.17.</span> zsh</h4>
|
|
<div class="outline-text-4" id="text-h:91dd4cc4-aada-4e74-be23-0cc69ed85af5">
|
|
<p>
|
|
zsh is the most convenient shell for me and it happens to be super neat to configure within home manager.
|
|
</p>
|
|
|
|
<p>
|
|
Here we set some aliases (some of them should be shellApplications instead) as well as some zsh plugins like <code>fzf-tab</code>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.zsh = {
|
|
enable = true;
|
|
shellAliases = {
|
|
hg = "history | grep";
|
|
hmswitch = "cd ~/.dotfiles; home-manager --flake .#$(whoami)@$(hostname) switch; cd -;";
|
|
nswitch = "cd ~/.dotfiles; sudo nixos-rebuild --flake .#$(hostname) switch; cd -;";
|
|
edithome = "bash ~/.dotfiles/scripts/editor.sh ~/.dotfiles/Nix.org";
|
|
magit = "emacsclient -nc -e \"(magit-status)\"";
|
|
config = "git --git-dir=$HOME/.cfg/ --work-tree=$HOME";
|
|
g = "git";
|
|
c = "git --git-dir=$HOME/.dotfiles/.git --work-tree=$HOME/.dotfiles/";
|
|
passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;";
|
|
passpull = "cd ~/.local/share/password-store; git pull; cd -;";
|
|
hotspot = "nmcli connection up local; nmcli device wifi hotspot;";
|
|
cd = "z";
|
|
cdr = "cd \"$( (find /home/swarsel/Documents/GitHub -maxdepth 1 && echo /home/swarsel/.dotfiles) | fzf )\"";
|
|
};
|
|
autosuggestion.enable = true;
|
|
enableCompletion = true;
|
|
syntaxHighlighting.enable = true;
|
|
autocd = false;
|
|
cdpath = [
|
|
"~/.dotfiles"
|
|
# "~/Documents/GitHub"
|
|
];
|
|
defaultKeymap = "emacs";
|
|
dirHashes = {
|
|
dl = "$HOME/Downloads";
|
|
gh = "$HOME/Documents/GitHub";
|
|
};
|
|
history = {
|
|
expireDuplicatesFirst = true;
|
|
path = "$HOME/.histfile";
|
|
save = 10000;
|
|
size = 10000;
|
|
};
|
|
historySubstringSearch.enable = true;
|
|
plugins = [
|
|
{
|
|
name = "fzf-tab";
|
|
src = pkgs.zsh-fzf-tab;
|
|
}
|
|
];
|
|
initExtra = ''
|
|
bindkey "^[[1;5D" backward-word
|
|
bindkey "^[[1;5C" forward-word
|
|
'';
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:506d01fc-c20b-473a-ac78-bce4b53fe0e3" class="outline-4">
|
|
<h4 id="h:506d01fc-c20b-473a-ac78-bce4b53fe0e3"><span class="section-number-4">3.3.18.</span> Mail</h4>
|
|
<div class="outline-text-4" id="text-h:506d01fc-c20b-473a-ac78-bce4b53fe0e3">
|
|
<p>
|
|
Normally I use 4 mail accounts - here I set them all up. Three of them are Google accounts (sadly), which are a chore to setup. The last is just a sender account that I setup SMTP for here.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.mbsync = {
|
|
enable = true;
|
|
};
|
|
# this is needed so that mbsync can use the passwords from sops
|
|
systemd.user.services.mbsync.Unit.After = [ "sops-nix.service" ];
|
|
|
|
programs.msmtp = {
|
|
enable = true;
|
|
};
|
|
|
|
programs.mu = {
|
|
enable = true;
|
|
};
|
|
|
|
accounts.email = {
|
|
maildirBasePath = "Mail";
|
|
accounts.leon = {
|
|
primary = true;
|
|
address = "leon.schwarzaeugl@gmail.com";
|
|
userName = "leon.schwarzaeugl@gmail.com";
|
|
realName = "Leon Schwarzäugl";
|
|
passwordCommand = "cat ${config.sops.secrets.leon.path}";
|
|
# passwordCommand = "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.local/share/password-store/mail/mbsync/leon.schwarzaeugl@gmail.com.gpg";
|
|
gpg = {
|
|
key = "0x76FD3810215AE097";
|
|
signByDefault = true;
|
|
};
|
|
imap.host = "imap.gmail.com";
|
|
smtp.host = "smtp.gmail.com";
|
|
mu.enable = true;
|
|
msmtp = {
|
|
enable = true;
|
|
};
|
|
mbsync = {
|
|
enable = true;
|
|
create = "maildir";
|
|
expunge = "both";
|
|
patterns = [ "*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" ];
|
|
extraConfig = {
|
|
channel = {
|
|
Sync = "All";
|
|
};
|
|
account = {
|
|
Timeout = 120;
|
|
PipelineDepth = 1;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
accounts.swarsel = {
|
|
address = "leon@swarsel.win";
|
|
userName = "8227dc594dd515ce232eda1471cb9a19";
|
|
realName = "Leon Schwarzäugl";
|
|
passwordCommand = "cat ${config.sops.secrets.swarselmail.path}";
|
|
smtp = {
|
|
host = "in-v3.mailjet.com";
|
|
port = 587;
|
|
tls = {
|
|
enable = true;
|
|
useStartTls = true;
|
|
};
|
|
};
|
|
mu.enable = false;
|
|
msmtp = {
|
|
enable = true;
|
|
};
|
|
mbsync = {
|
|
enable = false;
|
|
};
|
|
};
|
|
|
|
accounts.nautilus = {
|
|
primary = false;
|
|
address = "nautilus.dw@gmail.com";
|
|
userName = "nautilus.dw@gmail.com";
|
|
realName = "Nautilus";
|
|
passwordCommand = "cat ${config.sops.secrets.nautilus.path}";
|
|
# passwordCommand = "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.local/share/password-store/mail/mbsync/nautilus.dw@gmail.com.gpg";
|
|
imap.host = "imap.gmail.com";
|
|
smtp.host = "smtp.gmail.com";
|
|
msmtp.enable = true;
|
|
mu.enable = true;
|
|
mbsync = {
|
|
enable = true;
|
|
create = "maildir";
|
|
expunge = "both";
|
|
patterns = [ "*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" ];
|
|
extraConfig = {
|
|
channel = {
|
|
Sync = "All";
|
|
};
|
|
account = {
|
|
Timeout = 120;
|
|
PipelineDepth = 1;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
accounts.mrswarsel = {
|
|
primary = false;
|
|
address = "mrswarsel@gmail.com";
|
|
userName = "mrswarsel@gmail.com";
|
|
realName = "Swarsel";
|
|
# passwordCommand = "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.local/share/password-store/mail/mbsync/mrswarsel@gmail.com.gpg";
|
|
passwordCommand = "cat ${config.sops.secrets.mrswarsel.path}";
|
|
imap.host = "imap.gmail.com";
|
|
smtp.host = "smtp.gmail.com";
|
|
msmtp.enable = true;
|
|
mu.enable = true;
|
|
mbsync = {
|
|
enable = true;
|
|
create = "maildir";
|
|
expunge = "both";
|
|
patterns = [ "*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" ];
|
|
extraConfig = {
|
|
channel = {
|
|
Sync = "All";
|
|
};
|
|
account = {
|
|
Timeout = 120;
|
|
PipelineDepth = 1;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:c05d1b64-7110-4151-b436-46bc447113b4" class="outline-4">
|
|
<h4 id="h:c05d1b64-7110-4151-b436-46bc447113b4"><span class="section-number-4">3.3.19.</span> Home-manager: Emacs</h4>
|
|
<div class="outline-text-4" id="text-h:c05d1b64-7110-4151-b436-46bc447113b4">
|
|
<p>
|
|
By using the emacs-overlay NixOS module, I can install all Emacs packages that I want to use right through NixOS. This is done by passing my <code>init.el</code> file to the configuration which will then be parsed upon system rebuild, looking for <code>use-package</code> sections in the Elisp code. Also I define here the style of Emacs that I want to run - I am going with native Wayland Emacs here (<code>emacs-pgtk</code>). All of the nice options such as <code>tree-sitter</code> support are enabled by default, so I do not need to adjust the build process.
|
|
</p>
|
|
|
|
<p>
|
|
Lastly, I am defining some more packages here that the parser has problems finding. Also there are some packages that are not in ELPA or MELPA that I still want to use, like <code>calfw</code> and <code>fast-scroll</code>, so I build them here.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
# enable emacs overlay for bleeding edge features
|
|
# also read init.el file and install use-package packages
|
|
programs.emacs = {
|
|
enable = true;
|
|
package = pkgs.emacsWithPackagesFromUsePackage {
|
|
config = ../../programs/emacs/init.el;
|
|
package = pkgs.emacs-pgtk;
|
|
alwaysEnsure = true;
|
|
alwaysTangle = true;
|
|
extraEmacsPackages = epkgs: [
|
|
epkgs.mu4e
|
|
epkgs.use-package
|
|
# epkgs.lsp-bridge
|
|
epkgs.doom-themes
|
|
|
|
# build the rest of the packages myself
|
|
# org-calfw is severely outdated on MELPA and throws many warnings on emacs startup
|
|
# build the package from the haji-ali fork, which is well-maintained
|
|
(epkgs.trivialBuild rec {
|
|
pname = "calfw";
|
|
version = "1.0.0-20231002";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "haji-ali";
|
|
repo = "emacs-calfw";
|
|
rev = "bc99afee611690f85f0cd0bd33300f3385ddd3d3";
|
|
hash = "sha256-0xMII1KJhTBgQ57tXJks0ZFYMXIanrOl9XyqVmu7a7Y=";
|
|
};
|
|
packageRequires = [ epkgs.howm ];
|
|
})
|
|
|
|
(epkgs.trivialBuild rec {
|
|
pname = "fast-scroll";
|
|
version = "1.0.0-20191016";
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "ahungry";
|
|
repo = "fast-scroll";
|
|
rev = "3f6ca0d5556fe9795b74714304564f2295dcfa24";
|
|
hash = "sha256-w1wmJW7YwXyjvXJOWdN2+k+QmhXr4IflES/c2bCX3CI=";
|
|
};
|
|
packageRequires = [ ];
|
|
})
|
|
|
|
];
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:0bf51f63-01c0-4053-a591-7f0c5697c690" class="outline-4">
|
|
<h4 id="h:0bf51f63-01c0-4053-a591-7f0c5697c690"><span class="section-number-4">3.3.20.</span> Waybar</h4>
|
|
<div class="outline-text-4" id="text-h:0bf51f63-01c0-4053-a591-7f0c5697c690">
|
|
<p>
|
|
Again I am just using the first bar option here that I was able to find good understandable documentation for. Of note is that the `cpu` section's `format` is not defined here, but in section 1 (since not every machine has the same number of cores)
|
|
</p>
|
|
|
|
<p>
|
|
The rest of this configuration is found here:
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li><a href="#h:47749e76-3f25-485a-9e98-c7ce3a4ad444">Waybar items - PC</a></li>
|
|
<li><a href="#h:f3cf9bdc-6826-4d8e-ba5a-253ef098a9b8">Waybar items - LAPTOPS</a></li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.waybar = {
|
|
|
|
enable = true;
|
|
# systemd.enable = true;
|
|
settings = {
|
|
mainBar = {
|
|
layer = "top";
|
|
position = "top";
|
|
modules-left = [ "sway/workspaces" "custom/outer-right-arrow-dark" "sway/window" ];
|
|
modules-center = [ "sway/mode" "custom/configwarn" ];
|
|
"sway/mode" = {
|
|
format = "<span style=\"italic\" font-weight=\"bold\">{}</span>";
|
|
};
|
|
|
|
"custom/configwarn" = {
|
|
exec = "bash ~/.dotfiles/scripts/checkconfigstatus.sh";
|
|
interval = 60;
|
|
};
|
|
|
|
"group/hardware" = {
|
|
orientation = "inherit";
|
|
drawer = {
|
|
"transition-left-to-right" = false;
|
|
};
|
|
modules = [
|
|
"tray"
|
|
"temperature"
|
|
"power-profiles-daemon"
|
|
"custom/left-arrow-light"
|
|
"disk"
|
|
"custom/left-arrow-dark"
|
|
"memory"
|
|
"custom/left-arrow-light"
|
|
"cpu"
|
|
"custom/left-arrow-dark"
|
|
];
|
|
};
|
|
|
|
power-profiles-daemon = {
|
|
format = "{icon}";
|
|
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
|
|
tooltip = true;
|
|
format-icons = {
|
|
"default" = "";
|
|
"performance" = "";
|
|
"balanced" = "";
|
|
"power-saver" = "";
|
|
};
|
|
};
|
|
|
|
temperature = {
|
|
critical-threshold = 80;
|
|
format-critical = " {temperatureC}°C";
|
|
format = " {temperatureC}°C";
|
|
|
|
};
|
|
|
|
mpris = {
|
|
format = "{player_icon} {title} <small>[{position}/{length}]</small>";
|
|
format-paused = "{player_icon} <i>{title} <small>[{position}/{length}]</small></i>";
|
|
player-icons = {
|
|
"default" = "▶ ";
|
|
"mpv" = "🎵 ";
|
|
"spotify" = " ";
|
|
};
|
|
status-icons = {
|
|
"paused" = " ";
|
|
};
|
|
interval = 1;
|
|
title-len = 20;
|
|
artist-len = 20;
|
|
album-len = 10;
|
|
};
|
|
"custom/left-arrow-dark" = {
|
|
format = "";
|
|
tooltip = false;
|
|
};
|
|
"custom/outer-left-arrow-dark" = {
|
|
format = "";
|
|
tooltip = false;
|
|
};
|
|
"custom/left-arrow-light" = {
|
|
format = "";
|
|
tooltip = false;
|
|
};
|
|
"custom/right-arrow-dark" = {
|
|
format = "";
|
|
tooltip = false;
|
|
};
|
|
"custom/outer-right-arrow-dark" = {
|
|
format = "";
|
|
tooltip = false;
|
|
};
|
|
"custom/right-arrow-light" = {
|
|
format = "";
|
|
tooltip = false;
|
|
};
|
|
"sway/workspaces" = {
|
|
disable-scroll = true;
|
|
format = "{name}";
|
|
};
|
|
|
|
"clock#1" = {
|
|
min-length = 8;
|
|
interval = 1;
|
|
format = "{:%H:%M:%S}";
|
|
# on-click-right= "gnome-clocks";
|
|
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
|
|
};
|
|
|
|
"clock#2" = {
|
|
format = "{:%d. %B %Y}";
|
|
# on-click-right= "gnome-clocks";
|
|
tooltip-format = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
|
|
};
|
|
|
|
pulseaudio = {
|
|
format = "{icon} {volume:2}%";
|
|
format-bluetooth = "{icon} {volume}%";
|
|
format-muted = "MUTE";
|
|
format-icons = {
|
|
headphones = "";
|
|
default = [
|
|
""
|
|
""
|
|
];
|
|
};
|
|
scroll-step = 1;
|
|
on-click = "pamixer -t";
|
|
on-click-right = "pavucontrol";
|
|
};
|
|
memory = {
|
|
interval = 5;
|
|
format = " {}%";
|
|
tooltip-format = "Memory: {used:0.1f}G/{total:0.1f}G\nSwap: {swapUsed}G/{swapTotal}G";
|
|
};
|
|
cpu = {
|
|
min-length = 6;
|
|
interval = 5;
|
|
format-icons = [ "▁" "▂" "▃" "▄" "▅" "▆" "▇" "█" ];
|
|
# on-click-right= "com.github.stsdc.monitor";
|
|
on-click-right = "kitty -o confirm_os_window_close=0 btm";
|
|
|
|
};
|
|
battery = {
|
|
states = {
|
|
"warning" = 60;
|
|
"error" = 30;
|
|
"critical" = 15;
|
|
};
|
|
interval = 5;
|
|
format = "{icon} {capacity}%";
|
|
format-charging = "{capacity}% ";
|
|
format-plugged = "{capacity}% ";
|
|
format-icons = [
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
];
|
|
on-click-right = "wlogout -p layer-shell";
|
|
};
|
|
disk = {
|
|
interval = 30;
|
|
format = "Disk {percentage_used:2}%";
|
|
path = "/";
|
|
states = {
|
|
"warning" = 80;
|
|
"critical" = 90;
|
|
};
|
|
tooltip-format = "{used} used out of {total} on {path} ({percentage_used}%)\n{free} free on {path} ({percentage_free}%)";
|
|
};
|
|
tray = {
|
|
icon-size = 20;
|
|
};
|
|
network = {
|
|
interval = 5;
|
|
format-wifi = "{signalStrength}% ";
|
|
format-ethernet = "";
|
|
format-linked = "{ifname} (No IP) ";
|
|
format-disconnected = "Disconnected ⚠";
|
|
format-alt = "{ifname}: {ipaddr}/{cidr}";
|
|
tooltip-format-ethernet = "{ifname} via {gwaddr}: {essid} {ipaddr}/{cidr}\n\n⇡{bandwidthUpBytes} ⇣{bandwidthDownBytes}";
|
|
tooltip-format-wifi = "{ifname} via {gwaddr}: {essid} {ipaddr}/{cidr} \n{signaldBm}dBm @ {frequency}MHz\n\n⇡{bandwidthUpBytes} ⇣{bandwidthDownBytes}";
|
|
};
|
|
};
|
|
};
|
|
style = builtins.readFile ../../programs/waybar/style.css;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:fbec0bd4-690b-4f79-8b2b-a40263760a96" class="outline-4">
|
|
<h4 id="h:fbec0bd4-690b-4f79-8b2b-a40263760a96"><span class="section-number-4">3.3.21.</span> Firefox</h4>
|
|
<div class="outline-text-4" id="text-h:fbec0bd4-690b-4f79-8b2b-a40263760a96">
|
|
<p>
|
|
Setting up firefox along with some policies that are important to me (mostly disabling telemetry related stuff as well as Pocket). I also enable some integrations that enable super useful packages, namely <code>tridactyl</code> and <code>browserpass</code>.
|
|
</p>
|
|
|
|
<p>
|
|
Also, using NUR with rycee's firefox addons, it is very convenient for me to add firefox addons here that will be automatically installed.
|
|
</p>
|
|
|
|
<p>
|
|
Also, I setup some search aliases for functions I often use, such as NixOS options search (<code>@no</code>)
|
|
</p>
|
|
|
|
<p>
|
|
I used to build the firefox addon <code>bypass-paywalls-clean</code> myself here, but the maintainer always deletes old packages, and it became a chore for me to maintain here, so I no longer do that.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
programs.firefox = {
|
|
enable = true;
|
|
package = pkgs.firefox.override {
|
|
nativeMessagingHosts = [
|
|
pkgs.tridactyl-native
|
|
pkgs.browserpass
|
|
pkgs.plasma5Packages.plasma-browser-integration
|
|
];
|
|
};
|
|
policies = {
|
|
CaptivePortal = false;
|
|
DisableFirefoxStudies = true;
|
|
DisablePocket = true;
|
|
DisableTelemetry = true;
|
|
DisableFirefoxAccounts = false;
|
|
NoDefaultBookmarks = true;
|
|
OfferToSaveLogins = false;
|
|
OfferToSaveLoginsDefault = false;
|
|
EnableTrackingProtection = true;
|
|
};
|
|
profiles.default = {
|
|
isDefault = true;
|
|
userChrome = builtins.readFile ../../programs/firefox/chrome/userChrome.css;
|
|
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
|
tridactyl
|
|
browserpass
|
|
clearurls
|
|
darkreader
|
|
enhancer-for-youtube
|
|
istilldontcareaboutcookies
|
|
translate-web-pages
|
|
ublock-origin
|
|
reddit-enhancement-suite
|
|
pushbullet
|
|
sponsorblock
|
|
web-archives
|
|
single-file
|
|
widegithub
|
|
enhanced-github
|
|
unpaywall
|
|
don-t-fuck-with-paste
|
|
plasma-integration
|
|
];
|
|
|
|
search.engines = {
|
|
"Nix Packages" = {
|
|
urls = [{
|
|
template = "https://search.nixos.org/packages";
|
|
params = [
|
|
{ name = "type"; value = "packages"; }
|
|
{ name = "query"; value = "{searchTerms}"; }
|
|
];
|
|
}];
|
|
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
|
definedAliases = [ "@np" ];
|
|
};
|
|
|
|
"NixOS Wiki" = {
|
|
urls = [{
|
|
template = "https://nixos.wiki/index.php?search={searchTerms}";
|
|
}];
|
|
iconUpdateURL = "https://nixos.wiki/favicon.png";
|
|
updateInterval = 24 * 60 * 60 * 1000; # every day
|
|
definedAliases = [ "@nw" ];
|
|
};
|
|
|
|
"NixOS Options" = {
|
|
urls = [{
|
|
template = "https://search.nixos.org/options";
|
|
params = [
|
|
{ name = "query"; value = "{searchTerms}"; }
|
|
];
|
|
}];
|
|
|
|
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
|
definedAliases = [ "@no" ];
|
|
};
|
|
|
|
"Home Manager Options" = {
|
|
urls = [{
|
|
template = "https://home-manager-options.extranix.com/";
|
|
params = [
|
|
{ name = "query"; value = "{searchTerms}"; }
|
|
];
|
|
}];
|
|
|
|
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
|
definedAliases = [ "@hm" "@ho" "@hmo" ];
|
|
};
|
|
|
|
"Google".metaData.alias = "@g";
|
|
};
|
|
search.force = true; # this is required because otherwise the search.json.mozlz4 symlink gets replaced on every firefox restart
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:387c3a82-1fb1-4c0f-8051-874e2acb8804" class="outline-4">
|
|
<h4 id="h:387c3a82-1fb1-4c0f-8051-874e2acb8804"><span class="section-number-4">3.3.22.</span> Services</h4>
|
|
<div class="outline-text-4" id="text-h:387c3a82-1fb1-4c0f-8051-874e2acb8804">
|
|
<p>
|
|
Services that can be defined through home-manager should be defined here.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:cb812c8a-247c-4ce5-a00c-59332c2f5fb9"></a>gnome-keyring<br />
|
|
<div class="outline-text-5" id="text-h:cb812c8a-247c-4ce5-a00c-59332c2f5fb9">
|
|
<p>
|
|
Used for storing sessions in e.g. Nextcloud
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.gnome-keyring = {
|
|
enable = true;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:06d34282-5c75-4c21-a857-604f129ce911"></a>mbsync<br />
|
|
<div class="outline-text-5" id="text-h:06d34282-5c75-4c21-a857-604f129ce911">
|
|
<p>
|
|
Used for syncing mail. This might be automatically enabled by my mail configuration, but I like to make sure.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.mbsync = {
|
|
enable = true;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:be6afd89-9e1e-40b6-8542-5c07a0ab780d"></a>KDE Connect<br />
|
|
<div class="outline-text-5" id="text-h:be6afd89-9e1e-40b6-8542-5c07a0ab780d">
|
|
<p>
|
|
This enables phone/computer communication, including sending clipboard, files etc. Sadly on Wayland many of the features are broken (like remote control).
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.kdeconnect = {
|
|
enable = true;
|
|
indicator = true;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:a17df4b8-1044-4569-b1b9-6c99ae354654"></a>syncthing<br />
|
|
<div class="outline-text-5" id="text-h:a17df4b8-1044-4569-b1b9-6c99ae354654">
|
|
<p>
|
|
Enables the syncthing service which talks to my syncthing instance on the Oracle cloud as well as my home server.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.syncthing = {
|
|
enable = true;
|
|
tray = {
|
|
enable = false; # we enable this by installing the syncthingtray package instead, it works better.
|
|
};
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:1f5a04de-0898-41ba-8134-741e4aeb0f79"></a>Emacs server<br />
|
|
<div class="outline-text-5" id="text-h:1f5a04de-0898-41ba-8134-741e4aeb0f79">
|
|
<p>
|
|
This enables the Emacs server. This allows me to invocate Emacs by using <code>emacsclient</code> instead, which is a lot faster.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.emacs = {
|
|
enable = true;
|
|
# socketActivation.enable = false;
|
|
# startWithUserSession = "graphical";
|
|
};
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:99d05729-df35-4958-9940-3319d6a41359"></a>Mako<br />
|
|
<div class="outline-text-5" id="text-h:99d05729-df35-4958-9940-3319d6a41359">
|
|
<p>
|
|
Desktop notifications!
|
|
</p>
|
|
|
|
<p>
|
|
The `extraConfig` section here CANNOT be reindented. This has something to do with how nix handles multiline strings, when indented Mako will fail to start. This might be a mako bug as well.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
services.mako = {
|
|
enable = true;
|
|
# backgroundColor = "#2e3440";
|
|
# borderColor = "#88c0d0";
|
|
borderRadius = 15;
|
|
borderSize = 1;
|
|
defaultTimeout = 5000;
|
|
height = 150;
|
|
icons = true;
|
|
ignoreTimeout = true;
|
|
layer = "overlay";
|
|
maxIconSize = 64;
|
|
sort = "-time";
|
|
width = 300;
|
|
# font = "monospace 10";
|
|
extraConfig = "[urgency=low]
|
|
border-color=#cccccc
|
|
[urgency=normal]
|
|
border-color=#d08770
|
|
[urgency=high]
|
|
border-color=#bf616a
|
|
default-timeout=3000
|
|
[category=mpd]
|
|
default-timeout=2000
|
|
group-by=category
|
|
";
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:02df9dfc-d1af-4a37-a7a0-d8da0af96a20" class="outline-4">
|
|
<h4 id="h:02df9dfc-d1af-4a37-a7a0-d8da0af96a20"><span class="section-number-4">3.3.23.</span> Sway</h4>
|
|
<div class="outline-text-4" id="text-h:02df9dfc-d1af-4a37-a7a0-d8da0af96a20">
|
|
<p>
|
|
I am currently using SwayFX, which adds some nice effects to sway, like rounded corners and hiding the separator between title and content of a window.
|
|
</p>
|
|
|
|
<p>
|
|
Currently, I am too lazy to explain every option here, but most of it is very self-explaining in any case.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
wayland.windowManager.sway = {
|
|
enable = true;
|
|
checkConfig = false; # delete this line once SwayFX is fixed upstream
|
|
package = pkgs.swayfx;
|
|
systemd = {
|
|
enable = true;
|
|
xdgAutostart = true;
|
|
};
|
|
wrapperFeatures.gtk = true;
|
|
config = rec {
|
|
modifier = "Mod4";
|
|
terminal = "kitty";
|
|
menu = "fuzzel";
|
|
bars = [{ command = "waybar"; }];
|
|
keybindings =
|
|
let
|
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
|
in
|
|
{
|
|
"${modifier}+q" = "kill";
|
|
"${modifier}+f" = "exec firefox";
|
|
"${modifier}+Space" = "exec fuzzel";
|
|
"${modifier}+Shift+Space" = "floating toggle";
|
|
"${modifier}+e" = "exec emacsclient -nquc -a emacs -e \"(dashboard-open)\"";
|
|
"${modifier}+Shift+m" = "exec emacsclient -nquc -a emacs -e \"(mu4e)\"";
|
|
"${modifier}+Shift+c" = "exec emacsclient -nquc -a emacs -e \"(swarsel/open-calendar)\"";
|
|
"${modifier}+Shift+s" = "exec \"bash ~/.dotfiles/scripts/checkspotify.sh\"";
|
|
"${modifier}+m" = "exec \"bash ~/.dotfiles/scripts/checkspotifytui.sh\"";
|
|
"${modifier}+x" = "exec \"bash ~/.dotfiles/scripts/checkkitty.sh\"";
|
|
"${modifier}+d" = "exec \"bash ~/.dotfiles/scripts/checkdiscord.sh\"";
|
|
"${modifier}+Shift+r" = "exec \"bash ~/.dotfiles/scripts/restart.sh\"";
|
|
"${modifier}+Shift+t" = "exec \"bash ~/.dotfiles/scripts/toggle_opacity.sh\"";
|
|
"${modifier}+Shift+F12" = "move scratchpad";
|
|
"${modifier}+F12" = "scratchpad show";
|
|
"${modifier}+c" = "exec qalculate-gtk";
|
|
"${modifier}+p" = "exec pass-fuzzel";
|
|
"${modifier}+o" = "exec pass-fuzzel-otp";
|
|
"${modifier}+Shift+p" = "exec pass-fuzzel --type";
|
|
"${modifier}+Shift+o" = "exec pass-fuzzel-otp --type";
|
|
"${modifier}+Escape" = "mode $exit";
|
|
# "${modifier}+Shift+Escape" = "exec com.github.stsdc.monitor";
|
|
"${modifier}+Shift+Escape" = "exec kitty -o confirm_os_window_close=0 btm";
|
|
"${modifier}+s" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
|
|
"${modifier}+i" = "exec \"bash ~/.dotfiles/scripts/startup.sh\"";
|
|
"${modifier}+1" = "workspace 1:一";
|
|
"${modifier}+Shift+1" = "move container to workspace 1:一";
|
|
"${modifier}+2" = "workspace 2:二";
|
|
"${modifier}+Shift+2" = "move container to workspace 2:二";
|
|
"${modifier}+3" = "workspace 3:三";
|
|
"${modifier}+Shift+3" = "move container to workspace 3:三";
|
|
"${modifier}+4" = "workspace 4:四";
|
|
"${modifier}+Shift+4" = "move container to workspace 4:四";
|
|
"${modifier}+5" = "workspace 5:五";
|
|
"${modifier}+Shift+5" = "move container to workspace 5:五";
|
|
"${modifier}+6" = "workspace 6:六";
|
|
"${modifier}+Shift+6" = "move container to workspace 6:六";
|
|
"${modifier}+7" = "workspace 7:七";
|
|
"${modifier}+Shift+7" = "move container to workspace 7:七";
|
|
"${modifier}+8" = "workspace 8:八";
|
|
"${modifier}+Shift+8" = "move container to workspace 8:八";
|
|
"${modifier}+9" = "workspace 9:九";
|
|
"${modifier}+Shift+9" = "move container to workspace 9:九";
|
|
"${modifier}+0" = "workspace 10:十";
|
|
"${modifier}+Shift+0" = "move container to workspace 10:十";
|
|
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%";
|
|
"XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
|
|
"${modifier}+Left" = "focus left";
|
|
"${modifier}+Right" = "focus right";
|
|
"${modifier}+Down" = "focus down";
|
|
"${modifier}+Up" = "focus up";
|
|
"${modifier}+Shift+Left" = "move left 40px";
|
|
"${modifier}+Shift+Right" = "move right 40px";
|
|
"${modifier}+Shift+Down" = "move down 40px";
|
|
"${modifier}+Shift+Up" = "move up 40px";
|
|
"${modifier}+h" = "focus left";
|
|
"${modifier}+l" = "focus right";
|
|
"${modifier}+j" = "focus down";
|
|
"${modifier}+k" = "focus up";
|
|
"${modifier}+Shift+h" = "move left 40px";
|
|
"${modifier}+Shift+l" = "move right 40px";
|
|
"${modifier}+Shift+j" = "move down 40px";
|
|
"${modifier}+Shift+k" = "move up 40px";
|
|
"${modifier}+Ctrl+Shift+c" = "reload";
|
|
"${modifier}+Shift+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
|
|
"${modifier}+r" = "mode resize";
|
|
"${modifier}+Return" = "exec kitty";
|
|
};
|
|
modes = {
|
|
resize = {
|
|
Down = "resize grow height 10 px or 10 ppt";
|
|
Escape = "mode default";
|
|
Left = "resize shrink width 10 px or 10 ppt";
|
|
Return = "mode default";
|
|
Right = "resize grow width 10 px or 10 ppt";
|
|
Up = "resize shrink height 10 px or 10 ppt";
|
|
};
|
|
};
|
|
defaultWorkspace = "workspace 1:一";
|
|
startup = [
|
|
{ command = "kitty -T kittyterm"; }
|
|
{ command = "sleep 60; kitty -T spotifytui -o confirm_os_window_close=0 spotify_player"; }
|
|
];
|
|
window = {
|
|
border = 1;
|
|
titlebar = false;
|
|
};
|
|
assigns = {
|
|
"1:一" = [{ app_id = "firefox"; }];
|
|
};
|
|
floating = {
|
|
border = 1;
|
|
criteria = [
|
|
{ title = "^Picture-in-Picture$"; }
|
|
{ app_id = "qalculate-gtk"; }
|
|
{ app_id = "org.gnome.clocks"; }
|
|
{ app_id = "com.github.stsdc.monitor"; }
|
|
{ app_id = "blueman"; }
|
|
{ app_id = "pavucontrol"; }
|
|
{ app_id = "syncthingtray"; }
|
|
{ title = "Syncthing Tray"; }
|
|
{ app_id = "SchildiChat"; }
|
|
{ app_id = "Element"; }
|
|
{ app_id = "com.nextcloud.desktopclient.nextcloud"; }
|
|
{ app_id = "gnome-system-monitor"; }
|
|
{ title = "(?:Open|Save) (?:File|Folder|As)"; }
|
|
{ title = "^Add$"; }
|
|
{ title = "com-jgoodies-jdiskreport-JDiskReport"; }
|
|
{ app_id = "discord"; }
|
|
{ window_role = "pop-up"; }
|
|
{ window_role = "bubble"; }
|
|
{ window_role = "dialog"; }
|
|
{ window_role = "task_dialog"; }
|
|
{ window_role = "menu"; }
|
|
{ window_role = "Preferences"; }
|
|
];
|
|
titlebar = false;
|
|
};
|
|
window = {
|
|
commands = [
|
|
{
|
|
command = "opacity 0.95";
|
|
criteria = {
|
|
class = ".*";
|
|
};
|
|
}
|
|
{
|
|
command = "opacity 1";
|
|
criteria = {
|
|
app_id = "Gimp-2.10";
|
|
};
|
|
}
|
|
{
|
|
command = "opacity 0.99";
|
|
criteria = {
|
|
app_id = "firefox";
|
|
};
|
|
}
|
|
{
|
|
command = "sticky enable, shadows enable";
|
|
criteria = {
|
|
title = "^Picture-in-Picture$";
|
|
};
|
|
}
|
|
{
|
|
command = "opacity 0.8, sticky enable, border normal, move container to scratchpad";
|
|
criteria = {
|
|
title = "^kittyterm$";
|
|
};
|
|
}
|
|
{
|
|
command = "opacity 0.95, sticky enable, border normal, move container to scratchpad";
|
|
criteria = {
|
|
title = "^spotifytui$";
|
|
};
|
|
}
|
|
# {
|
|
# command = "resize set width 60 ppt height 60 ppt, sticky enable, move container to scratchpad";
|
|
# criteria = {
|
|
# app_id="^$";
|
|
# class="^$";
|
|
# };
|
|
# }
|
|
{
|
|
|
|
command = "resize set width 60 ppt height 60 ppt, sticky enable, move container to scratchpad";
|
|
criteria = {
|
|
class = "Spotify";
|
|
};
|
|
}
|
|
{
|
|
command = "sticky enable";
|
|
criteria = {
|
|
app_id = "discord";
|
|
};
|
|
}
|
|
{
|
|
command = "resize set width 60 ppt height 60 ppt, sticky enable";
|
|
criteria = {
|
|
class = "Element";
|
|
};
|
|
}
|
|
{
|
|
command = "resize set width 60 ppt height 60 ppt, sticky enable";
|
|
criteria = {
|
|
app_id = "SchildiChat";
|
|
};
|
|
}
|
|
];
|
|
};
|
|
gaps = {
|
|
inner = 5;
|
|
};
|
|
};
|
|
extraSessionCommands = ''
|
|
export SDL_VIDEODRIVER=wayland
|
|
export QT_QPA_PLATFORM=wayland
|
|
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
|
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
|
export XDG_CURRENT_DESKTOP=sway
|
|
export XDG_SESSION_DESKTOP=sway
|
|
export QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox";
|
|
export ANKI_WAYLAND=1;
|
|
export OBSIDIAN_USE_WAYLAND=1;
|
|
'';
|
|
# extraConfigEarly = "
|
|
# exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
|
# exec hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK
|
|
# ";
|
|
extraConfig =
|
|
let
|
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
|
swayfxSettings = "
|
|
blur enable
|
|
blur_xray disable
|
|
blur_passes 1
|
|
blur_radius 1
|
|
shadows enable
|
|
corner_radius 2
|
|
titlebar_separator disable
|
|
default_dim_inactive 0.02
|
|
";
|
|
in
|
|
"
|
|
exec_always autotiling
|
|
set $exit \"exit: [s]leep, [p]oweroff, [r]eboot, [l]ogout\"
|
|
mode $exit {
|
|
|
|
bindsym --to-code {
|
|
s exec \"systemctl suspend\", mode \"default\"
|
|
p exec \"systemctl poweroff\"
|
|
r exec \"systemctl reboot\"
|
|
l exec \"swaymsg exit\"
|
|
|
|
Return mode \"default\"
|
|
Escape mode \"default\"
|
|
${modifier}+x mode \"default\"
|
|
}
|
|
}
|
|
|
|
exec systemctl --user import-environment
|
|
|
|
${swayfxSettings}
|
|
|
|
";
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:aee5ec75-7ca6-40d8-b6ac-a3e7e33a474b" class="outline-3">
|
|
<h3 id="h:aee5ec75-7ca6-40d8-b6ac-a3e7e33a474b"><span class="section-number-3">3.4.</span> flake.nix template and Closing Parenthesis (this needs to be the last heading in the Systems header)</h3>
|
|
<div class="outline-text-3" id="text-h:aee5ec75-7ca6-40d8-b6ac-a3e7e33a474b">
|
|
<p>
|
|
This sections puts together the <code>flake.nix</code> file from the <a href="#h:d39b8dfb-536d-414f-9fc0-7d67df48cee4">Noweb-Ref blocks</a> section.
|
|
</p>
|
|
|
|
<p>
|
|
Here we also close the opening parenthesis of modules/common.nix (home-manager) and profiles/common.nix (NixOS):
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:24e2a65b-b0cc-42cb-8e61-5a4cc39d6b2f" class="outline-4">
|
|
<h4 id="h:24e2a65b-b0cc-42cb-8e61-5a4cc39d6b2f"><span class="section-number-4">3.4.1.</span> Closing parentheses for common/home.nix and common/nixos.nix</h4>
|
|
<div class="outline-text-4" id="text-h:24e2a65b-b0cc-42cb-8e61-5a4cc39d6b2f">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:4f89db68-a21c-415d-87a5-21c66f2b6ded" class="outline-4">
|
|
<h4 id="h:4f89db68-a21c-415d-87a5-21c66f2b6ded"><span class="section-number-4">3.4.2.</span> flake.nix</h4>
|
|
<div class="outline-text-4" id="text-h:4f89db68-a21c-415d-87a5-21c66f2b6ded">
|
|
<p>
|
|
This tangles the flake.nix file; This block only needs to be touched when updating the general structure of the flake. For everything else, see the respective noweb-ref block.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
{
|
|
description = "SwarseFlake - Nix Flake for all SwarselSystems";
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
|
|
|
# user-level configuration
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# overlay to access bleeding edge emacs
|
|
emacs-overlay = {
|
|
url = "github:nix-community/emacs-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# nix user repository
|
|
# i use this mainly to not have to build all firefox extensions
|
|
# myself as well as for the emacs-init package (tbd)
|
|
nur.url = "github:nix-community/NUR";
|
|
|
|
# provides GL to non-NixOS hosts
|
|
nixgl.url = "github:guibou/nixGL";
|
|
|
|
# manages all theming using Home-Manager
|
|
stylix.url = "github:danth/stylix";
|
|
|
|
# nix secrets management
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
|
|
|
# enable secure boot on NixOS
|
|
lanzaboote.url = "github:nix-community/lanzaboote";
|
|
|
|
# nix for android
|
|
nix-on-droid = {
|
|
url = "github:t184256/nix-on-droid/release-23.05";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# generate NixOS images
|
|
nixos-generators = {
|
|
url = "github:nix-community/nixos-generators";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
# hardware quirks on nix
|
|
nixos-hardware = {
|
|
url = "github:NixOS/nixos-hardware/master";
|
|
};
|
|
|
|
# dynamic library loading
|
|
nix-alien = {
|
|
url = "github:thiagokokada/nix-alien";
|
|
};
|
|
|
|
# automatic nintendo switch payload injection
|
|
nswitch-rcm-nix = {
|
|
url = "github:Swarsel/nswitch-rcm-nix";
|
|
};
|
|
|
|
# weekly updated nix-index database
|
|
nix-index-database = {
|
|
url = "github:nix-community/nix-index-database";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
};
|
|
|
|
outputs = inputs@{
|
|
|
|
nixpkgs,
|
|
nixpkgs-stable,
|
|
home-manager,
|
|
nix-on-droid,
|
|
emacs-overlay,
|
|
nur,
|
|
nixgl,
|
|
stylix,
|
|
sops-nix,
|
|
lanzaboote,
|
|
nixos-hardware,
|
|
nix-alien,
|
|
nixos-generators,
|
|
nswitch-rcm-nix,
|
|
nix-index-database,
|
|
|
|
...
|
|
}: let
|
|
|
|
system = "x86_64-linux"; # not very portable, but I do not use other architectures at the moment
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [
|
|
emacs-overlay.overlay
|
|
nur.overlay
|
|
nixgl.overlay
|
|
(final: _prev: {
|
|
stable = import nixpkgs-stable {
|
|
inherit (final) system config;
|
|
};
|
|
})
|
|
];
|
|
config.allowUnfree = true;
|
|
};
|
|
|
|
# NixOS modules that can only be used on NixOS systems
|
|
nixModules = [
|
|
stylix.nixosModules.stylix
|
|
sops-nix.nixosModules.sops
|
|
nswitch-rcm-nix.nixosModules.nswitch-rcm
|
|
./profiles/common/nixos.nix
|
|
# dynamic library loading
|
|
({ self, system, ... }: {
|
|
environment.systemPackages = with self.inputs.nix-alien.packages.${system}; [
|
|
nix-alien
|
|
];
|
|
# needed for `nix-alien-ld`
|
|
programs.nix-ld.enable = true;
|
|
})
|
|
];
|
|
|
|
# Home-Manager modules wanted on non-NixOS systems
|
|
homeModules = [
|
|
stylix.homeManagerModules.stylix
|
|
];
|
|
# Home-Manager modules wanted on both NixOS and non-NixOS systems
|
|
mixedModules = [
|
|
sops-nix.homeManagerModules.sops
|
|
nix-index-database.hmModules.nix-index
|
|
./profiles/common/home.nix
|
|
];
|
|
|
|
in {
|
|
|
|
# NixOS setups - run home-manager as a NixOS module for better compatibility
|
|
# another benefit - full rebuild on nixos-rebuild switch
|
|
# run rebuild using `nswitch`
|
|
|
|
# NEW HOSTS: For a new host, decide whether a NixOS (nixosConfigurations) or non-NixOS (homeConfigurations) is used.
|
|
# Make sure to move hardware-configuration to the appropriate location, by default it is found in /etc/nixos/.
|
|
|
|
nixosConfigurations = {
|
|
|
|
onett = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
./profles/onett/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/onett/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
sandbox = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/sandbox/nixos.nix
|
|
];
|
|
};
|
|
|
|
twoson = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
./profiles/twoson/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/twoson/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
threed = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
lanzaboote.nixosModules.lanzaboote
|
|
./profiles/threed/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/threed/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
fourside = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
nixos-hardware.nixosModules.lenovo-thinkpad-p14s-amd-gen2
|
|
./profiles/fourside/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/fourside/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
winters = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
nixos-hardware.nixosModules.framework-16-inch-7040-amd
|
|
./profiles/winters/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.swarsel.imports = mixedModules ++ [
|
|
./profiles/winters/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
stand = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = nixModules ++ [
|
|
./profiles/stand/nixos.nix
|
|
home-manager.nixosModules.home-manager
|
|
{
|
|
home-manager.users.homelen.imports = mixedModules ++ [
|
|
./profiles/stand/home.nix
|
|
];
|
|
}
|
|
];
|
|
};
|
|
|
|
nginx = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/nginx/nixos.nix
|
|
];
|
|
};
|
|
|
|
calibre = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/calibre/nixos.nix
|
|
];
|
|
};
|
|
|
|
jellyfin = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
# sops-nix.nixosModules.sops
|
|
./profiles/server1/jellyfin/nixos.nix
|
|
];
|
|
};
|
|
|
|
transmission = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/transmission/nixos.nix
|
|
];
|
|
};
|
|
|
|
matrix = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
# this is to import a service module that is not on nixpkgs
|
|
# this way avoids infinite recursion errors
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/matrix/nixos.nix
|
|
];
|
|
};
|
|
|
|
sound = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/sound/nixos.nix
|
|
];
|
|
};
|
|
|
|
spotifyd = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/spotifyd/nixos.nix
|
|
];
|
|
};
|
|
|
|
paperless = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/server1/paperless/nixos.nix
|
|
];
|
|
};
|
|
|
|
#ovm swarsel
|
|
sync = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/remote/oracle/sync/nixos.nix
|
|
];
|
|
};
|
|
|
|
#ovm swarsel
|
|
swatrix = nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs pkgs; };
|
|
modules = [
|
|
sops-nix.nixosModules.sops
|
|
./profiles/remote/oracle/matrix/nixos.nix
|
|
];
|
|
};
|
|
};
|
|
|
|
# pure Home Manager setups - for non-NixOS machines
|
|
# run rebuild using `hmswitch`
|
|
|
|
homeConfigurations = {
|
|
|
|
"leons@PCisLee" = home-manager.lib.homeManagerConfiguration {
|
|
inherit pkgs;
|
|
modules = homeModules ++ mixedModules ++ [
|
|
./profiles/surface/home.nix
|
|
];
|
|
};
|
|
|
|
};
|
|
|
|
nixOnDroidConfigurations = {
|
|
|
|
default = nix-on-droid.lib.nixOnDroidConfiguration {
|
|
modules = [
|
|
./profiles/mysticant/configuration.nix
|
|
];
|
|
};
|
|
|
|
};
|
|
|
|
packages.x86_64-linux = {
|
|
|
|
proxmox-lxc = nixos-generators.nixosGenerate {
|
|
inherit system;
|
|
modules = [
|
|
./profiles/server1/TEMPLATE/nixos.nix
|
|
];
|
|
format = "proxmox-lxc";
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:ed4cd05c-0879-41c6-bc39-3f1246a96f04" class="outline-2">
|
|
<h2 id="h:ed4cd05c-0879-41c6-bc39-3f1246a96f04"><span class="section-number-2">4.</span> Emacs</h2>
|
|
<div class="outline-text-2" id="text-h:ed4cd05c-0879-41c6-bc39-3f1246a96f04">
|
|
</div>
|
|
<div id="outline-container-h:2c331451-45ed-4592-9e00-d36b5bf31248" class="outline-3">
|
|
<h3 id="h:2c331451-45ed-4592-9e00-d36b5bf31248"><span class="section-number-3">4.1.</span> Initialization (early-init.el)</h3>
|
|
<div class="outline-text-3" id="text-h:2c331451-45ed-4592-9e00-d36b5bf31248">
|
|
<p>
|
|
In this section I handle my early init file; it takes care of frame-setup for emacsclient buffers.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:38e03b65-9dfc-4547-b27d-236664d7dc15" class="outline-4">
|
|
<h4 id="h:38e03b65-9dfc-4547-b27d-236664d7dc15"><span class="section-number-4">4.1.1.</span> Increase startup performance</h4>
|
|
<div class="outline-text-4" id="text-h:38e03b65-9dfc-4547-b27d-236664d7dc15">
|
|
<p>
|
|
First, I use some advice from doomemacs regarding garbace collection; here I make sure that during startup, the garbace collectur will not run, which will improve startup times. Now, that might not really be needed since I will usually only start the emacs server once during startup and then not touch it again, however, since I am building my emacs configuration using NixOS, there is some merit to this since I will usually need to restart the server once I rebuild my configuration.
|
|
</p>
|
|
|
|
<p>
|
|
Also, inspired by a setting I have seen in protesilaos' configuration, I apply the same idea to the <code>file-name-handler-alist</code> and <code>vc-handled-backends</code>.
|
|
</p>
|
|
|
|
<p>
|
|
In the end, we need to restore those values to values that will work during normal operation. For that, I add a hook to the startup function that will revert the values once Emacs has finished initialization.
|
|
</p>
|
|
|
|
<p>
|
|
Also packed into the hook function is the line <code>(fset 'epg-wait-for-status 'ignore)</code>. This line is needed at the end of the configuration in order to allow for my Yubikey to be used to encrypt and decrypt <code>.gpg</code> files. Without it, Emacs will just hang forever and basically crash.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">(defvar swarsel-file-name-handler-alist file-name-handler-alist)
|
|
(defvar swarsel-vc-handled-backends vc-handled-backends)
|
|
|
|
(setq gc-cons-threshold most-positive-fixnum
|
|
gc-cons-percentage 0.6
|
|
file-name-handler-alist nil
|
|
vc-handled-backends nil)
|
|
|
|
(add-hook 'emacs-startup-hook
|
|
(lambda ()
|
|
(progn
|
|
(setq gc-cons-threshold (* 1000 1000 8)
|
|
gc-cons-percentage 0.1
|
|
file-name-handler-alist swarsel-file-name-handler-alist
|
|
vc-handled-backends swarsel-vc-handled-backends)
|
|
(fset 'epg-wait-for-status 'ignore)
|
|
)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:782b3632-afb2-4c67-8c46-ff94408aef5d" class="outline-4">
|
|
<h4 id="h:782b3632-afb2-4c67-8c46-ff94408aef5d"><span class="section-number-4">4.1.2.</span> Setup frames</h4>
|
|
<div class="outline-text-4" id="text-h:782b3632-afb2-4c67-8c46-ff94408aef5d">
|
|
<p>
|
|
Next, I will setup the basic frame for my emacs buffers. Note that I use a tiling window manager, so I do not need to hold myself up with sizing the windows myself. I also disable some GUI tools that I (like many others) do not find to be particularly useful. Also I inhibit many startup functions here, even though it does not affect me greatly since I use another solution for that.
|
|
</p>
|
|
|
|
<p>
|
|
We also make require immediate compilation of native code.
|
|
</p>
|
|
|
|
<p>
|
|
For the <code>default-frame-alist</code>, I used to also set <code>'(right-divider-width . 4)</code> and <code>'(bottom-divider-width . 4)</code>, but I did not like the look of the divider bar and usually know my splits anyways, so this is no longer set.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">(tool-bar-mode 0)
|
|
(menu-bar-mode 0)
|
|
(scroll-bar-mode 0)
|
|
|
|
(setq frame-inhibit-implied-resize t
|
|
ring-bell-function 'ignore
|
|
use-dialog-box nil
|
|
use-file-dialog nil
|
|
use-short-answers t
|
|
inhibit-startup-message t
|
|
inhibit-splash-screen t
|
|
inhibit-startup-screen t
|
|
inhibit-x-resources t
|
|
inhibit-startup-buffer-menu t
|
|
inhibit-startup-echo-area-message user-login-name ; this needs to be set to the username or it will not have an effect
|
|
comp-deferred-compilation nil ; compile all Elisp to native code immediately
|
|
)
|
|
|
|
(setq-default left-margin-width 1
|
|
right-margin-width 1)
|
|
|
|
(setq-default default-frame-alist
|
|
(append
|
|
(list
|
|
'(undecorated . t) ; no title bar, borders etc.
|
|
'(background-color . "#1D252C") ; load doom-citylight colors to avoid white flash
|
|
'(foreground-color . "#A0B3C5") ; load doom-citylight colors to avoid white flash
|
|
'(vertical-scroll-bars . nil)
|
|
'(horizontal-scroll-bars . nil)
|
|
'(internal-border-width . 5)
|
|
'(tool-bar-lines . 0)
|
|
'(menu-bar-lines . 0))))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:396c47f2-7e2f-4fad-ae71-6483bf7e3e42" class="outline-4">
|
|
<h4 id="h:396c47f2-7e2f-4fad-ae71-6483bf7e3e42"><span class="section-number-4">4.1.3.</span> Make C-i, C-m, C-[ available in graphic sessions</h4>
|
|
<div class="outline-text-4" id="text-h:396c47f2-7e2f-4fad-ae71-6483bf7e3e42">
|
|
<p>
|
|
By default, emacs binds
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li><code>C-i</code> to the <code>TAB</code> key</li>
|
|
<li><code>C-m</code> to the <code>RET</code> key</li>
|
|
<li><code>C-[</code> to the <code>ECS</code> key</li>
|
|
</ul>
|
|
|
|
<p>
|
|
These keybinds exist to make Emacs work well in terminal mode. However, most of the time I am using Emacs in a graphic session, and I would hence like to have these keybinds available for personal use.
|
|
</p>
|
|
|
|
<p>
|
|
NOTE: To use these keybinds, you need to enclose the binding in angled brackets (<code><></code>). Then they can be used normally
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(add-hook
|
|
'after-make-frame-functions
|
|
(lambda (frame)
|
|
(with-selected-frame frame
|
|
(when (display-graphic-p)
|
|
(define-key input-decode-map (kbd "C-i") [DUMMY-i])
|
|
(define-key input-decode-map (kbd "C-[") [DUMMY-lsb])
|
|
(define-key input-decode-map (kbd "C-m") [DUMMY-m])
|
|
))))
|
|
|
|
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:601ba407-b906-4869-8ef6-67a9fc285fba" class="outline-3">
|
|
<h3 id="h:601ba407-b906-4869-8ef6-67a9fc285fba"><span class="section-number-3">4.2.</span> Personal settings</h3>
|
|
<div class="outline-text-3" id="text-h:601ba407-b906-4869-8ef6-67a9fc285fba">
|
|
<p>
|
|
This section is used to define my own functions, own variables, and own keybindings.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:b7b5976a-db2b-493d-8794-1924a0e12aec" class="outline-4">
|
|
<h4 id="h:b7b5976a-db2b-493d-8794-1924a0e12aec"><span class="section-number-4">4.2.1.</span> Custom functions</h4>
|
|
<div class="outline-text-4" id="text-h:b7b5976a-db2b-493d-8794-1924a0e12aec">
|
|
<p>
|
|
In this section I define extra functions that I need. Some of these functions I wrote myself, some I found after internet reseach. For functions I found on the internet, I will link the original source I found it in.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:b715d7cf-da09-4e0c-95bc-8281b4f3ce9c"></a>Emacs/Evil state toggle<br />
|
|
<div class="outline-text-5" id="text-h:b715d7cf-da09-4e0c-95bc-8281b4f3ce9c">
|
|
<p>
|
|
Since I am rebinding the <code>C-z</code> hotkey for emacs-evil-state toggling, I want to have a function that still lets me perform this action quickly.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/toggle-evil-state ()
|
|
(interactive)
|
|
(if (or (evil-emacs-state-p) (evil-insert-state-p))
|
|
(evil-normal-state)
|
|
(evil-emacs-state)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:1e0ee570-e509-4ecb-a3af-b75543731bb0"></a>Switching to last used buffer<br />
|
|
<div class="outline-text-5" id="text-h:1e0ee570-e509-4ecb-a3af-b75543731bb0">
|
|
<p>
|
|
I often find myself bouncing between two buffers when I do not want to use a window split. This funnction simply jumps to the last used buffer.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/last-buffer () (interactive) (switch-to-buffer nil))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:34506761-06b9-43b5-a818-506d9b3faf28"></a>mu4e functions<br />
|
|
<div class="outline-text-5" id="text-h:34506761-06b9-43b5-a818-506d9b3faf28">
|
|
<p>
|
|
I use these functions to let me switch between my main email accounts, as mu4e by itself has trouble doing so. <code>mu4e-switch-account</code> allows for manual choosing of the sender account, while <code>mu4e-rfs--matching-address</code> and <code>mu4e-send-from-correct-address</code> are used when replying to a mail; they switch the sender account to the one that received the mail.
|
|
</p>
|
|
|
|
<p>
|
|
By default, the sender email will not be changed after sending a mail; however, I want Emacs to always use my main address when not replying to another email. For that I use <code>mu4e-restore-default</code>.
|
|
</p>
|
|
|
|
<p>
|
|
Used here: <a href="#h:b92a18cf-eec3-4605-a8c2-37133ade3574">mu4e</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/mu4e-switch-account ()
|
|
(interactive)
|
|
(let ((account (completing-read "Select account: " mu4e-user-mail-address-list)))
|
|
(setq user-mail-address account)))
|
|
|
|
(defun swarsel/mu4e-rfs--matching-address ()
|
|
(cl-loop for to-data in (mu4e-message-field mu4e-compose-parent-message :to)
|
|
for to-email = (pcase to-data
|
|
(`(_ . email) email)
|
|
(x (mu4e-contact-email x)))
|
|
for to-name = (pcase to-data
|
|
(`(_ . name) name)
|
|
(x (mu4e-contact-name x)))
|
|
when (mu4e-user-mail-address-p to-email)
|
|
return (list to-name to-email)))
|
|
|
|
(defun swarsel/mu4e-send-from-correct-address ()
|
|
(when mu4e-compose-parent-message
|
|
(save-excursion
|
|
(when-let ((dest (swarsel/mu4e-rfs--matching-address)))
|
|
(cl-destructuring-bind (from-user from-addr) dest
|
|
(setq user-mail-address from-addr)
|
|
(message-position-on-field "From")
|
|
(message-beginning-of-line)
|
|
(delete-region (point) (line-end-position))
|
|
(insert (format "%s <%s>" (or from-user user-full-name) from-addr)))))))
|
|
|
|
(defun swarsel/mu4e-restore-default ()
|
|
(setq user-mail-address "leon@swarsel.win"
|
|
user-full-name "Leon Schwarzäugl"))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:4b9d74ef-0376-45bb-bc15-d24a04ca7e81"></a>Create non-existant directories when finding file<br />
|
|
<div class="outline-text-5" id="text-h:4b9d74ef-0376-45bb-bc15-d24a04ca7e81">
|
|
<p>
|
|
This function will check if a directory for which a file we want to open exists; if not, it will offer to create the directories for me.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/with-buffer-name-prompt-and-make-subdirs ()
|
|
(let ((parent-directory (file-name-directory buffer-file-name)))
|
|
(when (and (not (file-exists-p parent-directory))
|
|
(y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory)))
|
|
(make-directory parent-directory t))))
|
|
|
|
(add-to-list 'find-file-not-found-functions #'swarsel/with-buffer-name-prompt-and-make-subdirs)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:91e2f45f-54fa-4b60-8758-b2ef9b439af7"></a>[crux] Duplicate Lines<br />
|
|
<div class="outline-text-5" id="text-h:91e2f45f-54fa-4b60-8758-b2ef9b439af7">
|
|
<p>
|
|
When programming, I like to be able to duplicate a line. There are easier functions than the one below, but they either
|
|
</p>
|
|
|
|
<ol class="org-ol">
|
|
<li>screw with undo/redo</li>
|
|
<li>move the cursor wildly</li>
|
|
</ol>
|
|
|
|
<p>
|
|
The below function avoids these problems. Originally I used the function <code>duplicate-line</code> found here: <a href="https://stackoverflow.com/questions/88399/how-do-i-duplicate-a-whole-line-in-emacs">https://stackoverflow.com/questions/88399/how-do-i-duplicate-a-whole-line-in-emacs</a>
|
|
</p>
|
|
|
|
<p>
|
|
However, this function does not work on regions. Later, I found a solution implemented by <a href="https://github.com/bbatsov/crux">crux</a>. I do not need the whole package, so I just extracted the three functions I needed from it.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun crux-get-positions-of-line-or-region ()
|
|
"Return positions (beg . end) of the current line or region."
|
|
(let (beg end)
|
|
(if (and mark-active (> (point) (mark)))
|
|
(exchange-point-and-mark))
|
|
(setq beg (line-beginning-position))
|
|
(if mark-active
|
|
(exchange-point-and-mark))
|
|
(setq end (line-end-position))
|
|
(cons beg end)))
|
|
|
|
(defun crux-duplicate-current-line-or-region (arg)
|
|
"Duplicates the current line or region ARG times.
|
|
If there's no region, the current line will be duplicated. However, if
|
|
there's a region, all lines that region covers will be duplicated."
|
|
(interactive "p")
|
|
(pcase-let* ((origin (point))
|
|
(`(,beg . ,end) (crux-get-positions-of-line-or-region))
|
|
(region (buffer-substring-no-properties beg end)))
|
|
(dotimes (_i arg)
|
|
(goto-char end)
|
|
(newline)
|
|
(insert region)
|
|
(setq end (point)))
|
|
(goto-char (+ origin (* (length region) arg) arg))))
|
|
|
|
(defun crux-duplicate-and-comment-current-line-or-region (arg)
|
|
"Duplicates and comments the current line or region ARG times.
|
|
If there's no region, the current line will be duplicated. However, if
|
|
there's a region, all lines that region covers will be duplicated."
|
|
(interactive "p")
|
|
(pcase-let* ((origin (point))
|
|
(`(,beg . ,end) (crux-get-positions-of-line-or-region))
|
|
(region (buffer-substring-no-properties beg end)))
|
|
(comment-or-uncomment-region beg end)
|
|
(setq end (line-end-position))
|
|
(dotimes (_ arg)
|
|
(goto-char end)
|
|
(newline)
|
|
(insert region)
|
|
(setq end (point)))
|
|
(goto-char (+ origin (* (length region) arg) arg))))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:4819720a-9220-4c34-b903-ed4179f3ad1c"></a>[prot] org-id-headings<br />
|
|
<div class="outline-text-5" id="text-h:4819720a-9220-4c34-b903-ed4179f3ad1c">
|
|
<p>
|
|
These functions by protesilaos generate heading links in an org-file similar to the normal <code>org-store-link</code> approach when not using properties. This approach has a weakness however - if the heading name is changed, the link breaks. These functions generate a unique identifier for each heading which will not break and also works when exporting the file to html, for example.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun prot-org--id-get ()
|
|
"Get the CUSTOM_ID of the current entry.
|
|
If the entry already has a CUSTOM_ID, return it as-is, else
|
|
create a new one."
|
|
(let* ((pos (point))
|
|
(id (org-entry-get pos "CUSTOM_ID")))
|
|
(if (and id (stringp id) (string-match-p "\\S-" id))
|
|
id
|
|
(setq id (org-id-new "h"))
|
|
(org-entry-put pos "CUSTOM_ID" id)
|
|
id)))
|
|
|
|
(declare-function org-map-entries "org")
|
|
|
|
(defun prot-org-id-headlines ()
|
|
"Add missing CUSTOM_ID to all headlines in current file."
|
|
(interactive)
|
|
(org-map-entries
|
|
(lambda () (prot-org--id-get))))
|
|
|
|
(defun prot-org-id-headline ()
|
|
"Add missing CUSTOM_ID to headline at point."
|
|
(interactive)
|
|
(prot-org--id-get))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:285e5c0a-875d-46a8-bb9b-0222b3d73878"></a>Inhibit Messages in Echo Area<br />
|
|
<div class="outline-text-5" id="text-h:285e5c0a-875d-46a8-bb9b-0222b3d73878">
|
|
<p>
|
|
Emacs likes to send messages to the echo area; this is generally a good thing. However, it bothers me a lot when I am currently working in minibuffer where I receive an echo area message that is actually important and it is then overwritten by e.g. the mu4e update message. This section makes it possible to find the root function calling the message function and disabling it here.
|
|
</p>
|
|
|
|
<p>
|
|
Usage: Enable the <code>(advice-add 'message :around #'who-called-me?)</code> by running this code block, which will show a full trace of all messages being sent to the echo area:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(advice-add 'message :around #'who-called-me?)
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Once the root function has been found, it can be disabled via <code>advice=add</code> as in the last block in this section. To disable the stack tracing, run <code>(advice-remove 'message #'who-called-me?)</code> or the following code block:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(advice-remove 'message #'who-called-me?)
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
Lastly, individual messages can be reenabled using the <code>(advice-remove '<FUNCTION-NAME> #'suppress-messages)</code> approach. Use this when you accidentally disabled a helpful message.
|
|
</p>
|
|
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun suppress-messages (old-fun &rest args)
|
|
(cl-flet ((silence (&rest args1) (ignore)))
|
|
(advice-add 'message :around #'silence)
|
|
(unwind-protect
|
|
(apply old-fun args)
|
|
(advice-remove 'message #'silence))))
|
|
|
|
(advice-add 'pixel-scroll-precision :around #'suppress-messages)
|
|
(advice-add 'mu4e--server-filter :around #'suppress-messages)
|
|
(advice-add 'org-unlogged-message :around #'suppress-messages)
|
|
(advice-add 'magit-auto-revert-mode--init-kludge :around #'suppress-messages)
|
|
(advice-add 'push-mark :around #'suppress-messages)
|
|
|
|
;; to reenable
|
|
;; (advice-remove 'timer-event-handler #'suppress-messages)
|
|
|
|
(defun who-called-me? (old-fun format &rest args)
|
|
(let ((trace nil) (n 1) (frame nil))
|
|
(while (setf frame (backtrace-frame n))
|
|
(setf n (1+ n)
|
|
trace (cons (cadr frame) trace)) )
|
|
(apply old-fun (concat "<<%S>>\n" format) (cons trace args))))
|
|
|
|
;; enable to get message backtrace, the first function shown in backtrace calls the other functions
|
|
;; (advice-add 'message :around #'who-called-me?)
|
|
|
|
;; disable to stop receiving backtrace
|
|
(advice-remove 'message #'who-called-me?)
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:de249f2a-6a2b-4114-8046-09d1014a7391"></a>Move up one directory for find-file<br />
|
|
<div class="outline-text-5" id="text-h:de249f2a-6a2b-4114-8046-09d1014a7391">
|
|
<p>
|
|
I find it very annoying that the standard behavior for M-DEL only deletes one word when using find-file. This function makes it so that we always go up by one directory level instead.
|
|
</p>
|
|
|
|
<p>
|
|
This function was found here: <a href="https://www.reddit.com/r/emacs/comments/re31i6/how_to_go_up_one_directory_when_using_findfile_cx/">https://www.reddit.com/r/emacs/comments/re31i6/how_to_go_up_one_directory_when_using_findfile_cx/</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun up-directory (path)
|
|
"Move up a directory in PATH without affecting the kill buffer."
|
|
(interactive "p")
|
|
(if (string-match-p "/." (minibuffer-contents))
|
|
(let ((end (point)))
|
|
(re-search-backward "/.")
|
|
(forward-char)
|
|
(delete-region (point) end))))
|
|
|
|
(define-key minibuffer-local-filename-completion-map
|
|
[C-backspace] #'up-directory)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:06b77d28-3fd5-4554-8c7d-32c1b0ec8da5"></a>org-mode: General setup<br />
|
|
<div class="outline-text-5" id="text-h:06b77d28-3fd5-4554-8c7d-32c1b0ec8da5">
|
|
<p>
|
|
Sets up the basic settings that I want to have active in org-mode buffers.
|
|
</p>
|
|
|
|
<p>
|
|
Used here: <a href="#h:877c9401-a354-4e44-a235-db1a90d19e00">General org-mode</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/org-mode-setup ()
|
|
(org-indent-mode)
|
|
(variable-pitch-mode 1)
|
|
;;(auto-fill-mode 0)
|
|
(setq display-line-numbers-type 'relative
|
|
display-line-numbers-current-absolute 1
|
|
display-line-numbers-width-start nil
|
|
display-line-numbers-width 6
|
|
display-line-numbers-grow-only 1)
|
|
(add-hook 'org-tab-first-hook 'org-end-of-line)
|
|
(visual-line-mode 1))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:fa710375-2efe-49b4-af6a-a875aca6e4a2"></a>org-mode: Visual-fill column<br />
|
|
<div class="outline-text-5" id="text-h:fa710375-2efe-49b4-af6a-a875aca6e4a2">
|
|
<p>
|
|
This function sets the width of buffers in org-mode.
|
|
</p>
|
|
|
|
<p>
|
|
Used in: <a href="#h:bbcfa895-4d46-4b1d-b84e-f634e982c46e">Centered org-mode Buffers</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/org-mode-visual-fill ()
|
|
(setq visual-fill-column-width 150
|
|
visual-fill-column-center-text t)
|
|
(visual-fill-column-mode 1))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:59d4306e-9b73-4b2c-b039-6a6518c357fc"></a>org-mode: Upon-save actions (Auto-tangle, export to html, formatting)<br />
|
|
<div class="outline-text-5" id="text-h:59d4306e-9b73-4b2c-b039-6a6518c357fc">
|
|
<p>
|
|
This section handles everything that shoudld happen when I save <code>SwarselSystems.org</code>. It:
|
|
</p>
|
|
|
|
<ol class="org-ol">
|
|
<li>automatically tangles all configuration blocks in this file</li>
|
|
<li>exports the configuration file as html for an easier reading experience with working links and index</li>
|
|
<li>formats the generated <code>.nix</code> files in accordance to the <code>Alejandra</code>-style.</li>
|
|
</ol>
|
|
|
|
<p>
|
|
We set a hook that runs everytime we save the file. It would be a bit more efficient to only export and format when we enter a magit window for instance (since especially the html export takes times), however, since I cannot be sure to only ever commit from magit (I do indeed sometimes use git from the command line), I prefer this approach.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">(defun swarsel/run-formatting ()
|
|
(interactive)
|
|
(let ((default-directory (expand-file-name "~/.dotfiles")))
|
|
(shell-command "nixpkgs-fmt . > /dev/null")))
|
|
|
|
(defun swarsel/org-babel-tangle-config ()
|
|
(when (string-equal (buffer-file-name)
|
|
swarsel-swarsel-org-filepath)
|
|
;; Dynamic scoping to the rescue
|
|
(let ((org-confirm-babel-evaluate nil))
|
|
(org-html-export-to-html)
|
|
(org-babel-tangle)
|
|
(swarsel/run-formatting))))
|
|
|
|
(setq org-html-htmlize-output-type nil)
|
|
|
|
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'swarsel/org-babel-tangle-config)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:dfa66e78-5748-45e3-a975-db3da104bb3a"></a>org-mode: Fold current heading<br />
|
|
<div class="outline-text-5" id="text-h:dfa66e78-5748-45e3-a975-db3da104bb3a">
|
|
<p>
|
|
Normally emacs cycles between three states:
|
|
</p>
|
|
|
|
<ol class="org-ol">
|
|
<li>fully folded</li>
|
|
<li>One heading expanded</li>
|
|
<li>All headings expanded</li>
|
|
</ol>
|
|
|
|
<p>
|
|
However, I want to be able to fold a single heading consistently.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun org-fold-outer ()
|
|
(interactive)
|
|
(org-beginning-of-line)
|
|
(if (string-match "^*+" (thing-at-point 'line t))
|
|
(outline-up-heading 1))
|
|
(outline-hide-subtree)
|
|
)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:a1802f9b-bb71-4fd5-86fa-945da18e8b81"></a>corfu: Do not interrupt navigation<br />
|
|
<div class="outline-text-5" id="text-h:a1802f9b-bb71-4fd5-86fa-945da18e8b81">
|
|
<p>
|
|
These three functions allow me to keep using the normal navigation keys even when a corfu completion pops up.
|
|
</p>
|
|
|
|
<p>
|
|
These functions are used here: <a href="#h:5653d693-ecca-4c95-9633-66b9e3241070">Corfu</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/corfu-normal-return (&optional arg)
|
|
(interactive)
|
|
(corfu-quit)
|
|
(newline)
|
|
)
|
|
|
|
(defun swarsel/corfu-quit-and-up (&optional arg)
|
|
(interactive)
|
|
(corfu-quit)
|
|
(evil-previous-visual-line))
|
|
|
|
(defun swarsel/corfu-quit-and-down (&optional arg)
|
|
(interactive)
|
|
(corfu-quit)
|
|
(evil-next-visual-line))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:291e43d9-eae2-4e23-8e38-160e223bf314"></a>python shell reloading<br />
|
|
<div class="outline-text-5" id="text-h:291e43d9-eae2-4e23-8e38-160e223bf314">
|
|
<p>
|
|
The standard Emacs behaviour for the Python process shell is a bit annoying. This is my attempt at making it show automatically on opening a python buffer and making it refresh on its own as well. This does not nicely work yet.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; run the python inferior shell immediately upon entering a python buffer
|
|
;; (add-hook 'python-mode-hook 'swarsel/run-python)
|
|
|
|
;; (defun swarsel/run-python ()
|
|
;; (save-selected-window
|
|
;; (switch-to-buffer-other-window (process-buffer (python-shell-get-or-create-process (python-shell-parse-command))))))
|
|
|
|
;; reload python shell automatically
|
|
(defun my-python-shell-run ()
|
|
(interactive)
|
|
(when (get-buffer-process "*Python*")
|
|
(set-process-query-on-exit-flag (get-buffer-process "*Python*") nil)
|
|
(kill-process (get-buffer-process "*Python*"))
|
|
;; Uncomment If you want to clean the buffer too.
|
|
;;(kill-buffer "*Python*")
|
|
;; Not so fast!
|
|
(sleep-for 0.5))
|
|
(run-python (python-shell-parse-command) nil nil)
|
|
(python-shell-send-buffer)
|
|
;; Pop new window only if shell isnt visible
|
|
;; in any frame.
|
|
(unless (get-buffer-window "*Python*" t)
|
|
(python-shell-switch-to-shell)))
|
|
|
|
(defun my-python-shell-run-region ()
|
|
(interactive)
|
|
(python-shell-send-region (region-beginning) (region-end))
|
|
(python-shell-switch-to-shell))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="org5914746"></a>Nix common prefix bracketer<br />
|
|
<div class="outline-text-5" id="text-4-2-1-15">
|
|
<p>
|
|
This function searches for common delimiters in region and removes them, summarizing all captured lines by it.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/prefix-block (start end)
|
|
(interactive "r")
|
|
(save-excursion
|
|
(goto-char start)
|
|
(setq start (line-beginning-position))
|
|
(goto-char end)
|
|
(setq end (line-end-position))
|
|
(let ((common-prefix (save-excursion
|
|
(goto-char start)
|
|
(if (re-search-forward "^\\([^.\n]+\\)\\." end t)
|
|
(match-string 1)
|
|
(error "No common prefix found")))))
|
|
(save-excursion
|
|
(goto-char start)
|
|
(insert common-prefix " = {\n")
|
|
(goto-char (+ end (length common-prefix) 6))
|
|
(insert "};\n")
|
|
(goto-char start)
|
|
(while (re-search-forward (concat "^" (regexp-quote common-prefix) "\\.") end t)
|
|
(replace-match ""))))))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="orgd08d04a"></a>Nix formatters<br />
|
|
<div class="outline-text-5" id="text-4-2-1-16">
|
|
<p>
|
|
This formats the org code block at <code>point</code> in accordance to the <code>nixpkgs-fmt</code> formatter
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(defun swarsel/org-nixpkgs-fmt-block-lite ()
|
|
(interactive)
|
|
(org-babel-mark-block)
|
|
(call-interactively 'nixpkgs-fmt-region))
|
|
|
|
|
|
(defun swarsel/org-nixpkgs-fmt-block ()
|
|
(interactive)
|
|
(save-excursion
|
|
(let* ((element (org-element-at-point))
|
|
(begin (org-element-property :begin element))
|
|
(end (org-element-property :end element))
|
|
(lang (org-element-property :language element)))
|
|
(when lang
|
|
(goto-char begin)
|
|
(forward-line)
|
|
(insert "{")
|
|
(goto-char end)
|
|
(forward-line -1)
|
|
(beginning-of-line)
|
|
(forward-char -1)
|
|
(insert "}")
|
|
(org-babel-mark-block)
|
|
(call-interactively 'nixpkgs-fmt-region)))))
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:2b827c27-0de7-45ed-9d9e-6c511e2c6bb5" class="outline-4">
|
|
<h4 id="h:2b827c27-0de7-45ed-9d9e-6c511e2c6bb5"><span class="section-number-4">4.2.2.</span> Custom Keybindings</h4>
|
|
<div class="outline-text-4" id="text-h:2b827c27-0de7-45ed-9d9e-6c511e2c6bb5">
|
|
<p>
|
|
This defines a set of keybinds that I want to have available globally. I have one set of keys that is globally available through the <code>C-SPC</code> prefix. This set is used mostly for functions that I have trouble remembering the original keybind for, or that I just want to have gathered in a common space.
|
|
</p>
|
|
|
|
<p>
|
|
I also define some keybinds to some combinations directly. Those are used mostly for custom functions that I call often enough to warrant this.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; Make ESC quit prompts
|
|
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
|
|
|
;; Set up general keybindings
|
|
(use-package general
|
|
:config
|
|
(general-create-definer swarsel/leader-keys
|
|
:keymaps '(normal insert visual emacs)
|
|
:prefix "SPC"
|
|
:global-prefix "C-SPC")
|
|
|
|
(swarsel/leader-keys
|
|
"e" '(:ignore e :which-key "evil")
|
|
"eo" '(evil-jump-backward :which-key "cursor jump backwards")
|
|
"eO" '(evil-jump-forward :which-key "cursor jump forwards")
|
|
"t" '(:ignore t :which-key "toggles")
|
|
"ts" '(hydra-text-scale/body :which-key "scale text")
|
|
"te" '(swarsel/toggle-evil-state :which-key "emacs/evil")
|
|
"tl" '(display-line-numbers-mode :which-key "line numbers")
|
|
"tp" '(evil-cleverparens-mode :wk "cleverparens")
|
|
"to" '(olivetti-mode :wk "olivetti")
|
|
"td" '(darkroom-tentative-mode :wk "darkroom")
|
|
"tw" '((lambda () (interactive) (toggle-truncate-lines)) :which-key "line wrapping")
|
|
"m" '(:ignore m :which-key "modes/programs")
|
|
"mm" '((lambda () (interactive) (mu4e)) :which-key "mu4e")
|
|
"mg" '((lambda () (interactive) (magit-list-repositories)) :which-key "magit-list-repos")
|
|
"mc" '((lambda () (interactive) (swarsel/open-calendar)) :which-key "calendar")
|
|
"mp" '(popper-toggle :which-key "popper")
|
|
"md" '(dirvish :which-key "dirvish")
|
|
"o" '(:ignore o :which-key "org")
|
|
"op" '((lambda () (interactive) (org-present)) :which-key "org-present")
|
|
"ob" '((lambda () (interactive) (org-babel-mark-block)) :which-key "Mark whole src-block")
|
|
"ol" '((lambda () (interactive) (org-insert-link)) :which-key "insert link")
|
|
"os" '((lambda () (interactive) (org-store-link)) :which-key "store link")
|
|
"od" '((lambda () (interactive) (org-babel-demarcate-block)) :which-key "demarcate (split) src-block")
|
|
;; "c" '(:ignore c :which-key "capture")
|
|
;; "cj" '((lambda () (interactive) (org-capture nil "jj")) :which-key "journal")
|
|
;; "cs" '(markdown-download-screenshot :which-key "screenshot")
|
|
"l" '(:ignore l :which-key "links")
|
|
"lc" '((lambda () (interactive) (progn (find-file swarsel-swarsel-org-filepath) (org-overview) )) :which-key "SwarselSystems.org")
|
|
"le" '((lambda () (interactive) (progn (find-file swarsel-swarsel-org-filepath) (goto-char (org-find-exact-headline-in-buffer "Emacs") ) (org-overview) (org-cycle) )) :which-key "Emacs.org")
|
|
"ln" '((lambda () (interactive) (progn (find-file swarsel-swarsel-org-filepath) (goto-char (org-find-exact-headline-in-buffer "System") ) (org-overview) (org-cycle))) :which-key "Nixos.org")
|
|
"ls" '((lambda () (interactive) (find-file "/smb:Swarsel@192.168.1.3:")) :which-key "Server")
|
|
"lo" '(dired swarsel-obsidian-vault-directory :which-key "obsidian")
|
|
;; "la" '((lambda () (interactive) (find-file swarsel-org-anki-filepath)) :which-key "anki")
|
|
;; "ln" '((lambda () (interactive) (find-file swarsel-nix-org-filepath)) :which-key "Nix.org")
|
|
"lp" '((lambda () (interactive) (projectile-switch-project)) :which-key "switch project")
|
|
"lg" '((lambda () (interactive) (magit-list-repositories)) :which-key "list git repos")
|
|
;; "a" '(:ignore a :which-key "anki")
|
|
;; "ap" '(anki-editor-push-tree :which-key "push new cards")
|
|
;; "an" '((lambda () (interactive) (org-capture nil "a")) :which-key "new card")
|
|
;; "as" '(swarsel-anki-set-deck-and-notetype :which-key "change deck and notetype")
|
|
"h" '(:ignore h :which-key "help")
|
|
"hy" '(yas-describe-tables :which-key "yas tables")
|
|
"hb" '(embark-bindings :which-key "current key bindings")
|
|
"h" '(:ignore t :which-key "describe")
|
|
"he" 'view-echo-area-messages
|
|
"hf" 'describe-function
|
|
"hF" 'describe-face
|
|
"hl" '(view-lossage :which-key "show command keypresses")
|
|
"hL" 'find-library
|
|
"hm" 'describe-mode
|
|
"ho" 'describe-symbol
|
|
"hk" 'describe-key
|
|
"hK" 'describe-keymap
|
|
"hp" 'describe-package
|
|
"hv" 'describe-variable
|
|
"hd" 'devdocs-lookup
|
|
"w" '(:ignore t :which-key "window")
|
|
"wl" 'windmove-right
|
|
"wh" 'windmove-left
|
|
"wk" 'windmove-up
|
|
"wj" 'windmove-down
|
|
"wr" 'winner-redo
|
|
"wd" 'delete-window
|
|
"w=" 'balance-windows-area
|
|
"wD" 'kill-buffer-and-window
|
|
"wu" 'winner-undo
|
|
"wr" 'winner-redo
|
|
"w/" 'evil-window-vsplit
|
|
"w-" 'evil-window-split
|
|
"wm" '(delete-other-windows :wk "maximize")
|
|
"<right>" 'up-list
|
|
"<left>" 'down-list
|
|
))
|
|
|
|
;; General often used hotkeys
|
|
(general-define-key
|
|
"C-M-a" (lambda () (interactive) (org-capture nil "a")) ; make new anki card
|
|
;; "C-M-d" 'swarsel-obsidian-daily ; open daily obsidian file and create if not exist
|
|
;; "C-M-S" 'swarsel-anki-set-deck-and-notetype ; switch deck and notetype for new anki cards
|
|
;; "C-M-s" 'markdown-download-screenshot ; wrapper for org-download-screenshot
|
|
"C-c d" 'crux-duplicate-current-line-or-region
|
|
"C-c D" 'crux-duplicate-and-comment-current-line-or-region
|
|
"<DUMMY-m>" 'swarsel/last-buffer
|
|
"M-\\" 'indent-region
|
|
"C-<f9>" 'my-python-shell-run
|
|
)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:07951589-54ba-4e3e-bd7b-4106cd22ff6a" class="outline-4">
|
|
<h4 id="h:07951589-54ba-4e3e-bd7b-4106cd22ff6a"><span class="section-number-4">4.2.3.</span> Directory setup / File structure</h4>
|
|
<div class="outline-text-4" id="text-h:07951589-54ba-4e3e-bd7b-4106cd22ff6a">
|
|
<p>
|
|
In this section I setup some aliases that I use for various directories on my system. Some of these are actually used for magit repository finding etc., but many of them serve no real use and I need to clean this up someday.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; set Nextcloud directory for journals etc.
|
|
(setq swarsel-sync-directory "~/Nextcloud"
|
|
swarsel-emacs-directory "~/.emacs.d"
|
|
swarsel-dotfiles-directory "~/.dotfiles"
|
|
swarsel-projects-directory "~/Documents/GitHub")
|
|
|
|
(setq swarsel-emacs-org-filepath (expand-file-name "Emacs.org" swarsel-dotfiles-directory)
|
|
swarsel-nix-org-filepath (expand-file-name "Nix.org" swarsel-dotfiles-directory)
|
|
swarsel-swarsel-org-filepath (expand-file-name "SwarselSystems.org" swarsel-dotfiles-directory)
|
|
)
|
|
|
|
|
|
;; set Emacs main configuration .org names
|
|
(setq swarsel-emacs-org-file "Emacs.org"
|
|
swarsel-anki-org-file "Anki.org"
|
|
swarsel-tasks-org-file "Tasks.org"
|
|
swarsel-archive-org-file "Archive.org"
|
|
swarsel-org-folder-name "Org"
|
|
swarsel-obsidian-daily-folder-name "⭐ Personal/Journal"
|
|
swarsel-obsidian-folder-name "Obsidian"
|
|
swarsel-obsidian-vault-name "Main")
|
|
|
|
|
|
;; set directory paths
|
|
(setq swarsel-org-directory (expand-file-name swarsel-org-folder-name swarsel-sync-directory)) ; path to org folder
|
|
(setq swarsel-obsidian-directory (expand-file-name swarsel-obsidian-folder-name swarsel-sync-directory)) ; path to obsidian
|
|
(setq swarsel-obsidian-vault-directory (expand-file-name swarsel-obsidian-vault-name swarsel-obsidian-directory)) ; path to obsidian vault
|
|
(setq swarsel-obsidian-daily-directory (expand-file-name swarsel-obsidian-daily-folder-name swarsel-obsidian-vault-directory)) ; path to obsidian daily folder
|
|
|
|
;; filepaths to certain documents
|
|
(setq swarsel-org-anki-filepath (expand-file-name swarsel-anki-org-file swarsel-org-directory) ; path to anki export file
|
|
swarsel-org-tasks-filepath (expand-file-name swarsel-tasks-org-file swarsel-org-directory)
|
|
swarsel-org-archive-filepath (expand-file-name swarsel-archive-org-file swarsel-org-directory))
|
|
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:0cf30b76-91d9-41da-a10b-74199bc36d40" class="outline-4">
|
|
<h4 id="h:0cf30b76-91d9-41da-a10b-74199bc36d40"><span class="section-number-4">4.2.4.</span> Unclutter .emacs.d</h4>
|
|
<div class="outline-text-4" id="text-h:0cf30b76-91d9-41da-a10b-74199bc36d40">
|
|
<p>
|
|
In this section I move the <code>custom.el</code> out of it's standard location in <code>.emacs.d</code>. Firstly, I dislike using this file at all since I would rather have fully stateful configuration as commanded by this file. Secondly, this file is too easily permanently changed. Recently I figured out the last bits that I needed to remove from custom.el to no longer be reliant on it, so I now just write it to a temporary file (through <code>make-temp=file</code>) which will be cleaned on shutdown. However, I like to retain the custom framework because it is nice for testing out theme customizations, hence why I still load the file.
|
|
</p>
|
|
|
|
<p>
|
|
This section also sets the emacs directory to the <code>~/.cache/</code> directory which is useful for files that I do not want to have lying around in my <code>.emacs.d</code>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; Change the user-emacs-directory to keep unwanted things out of ~/.emacs.d
|
|
(setq user-emacs-directory (expand-file-name "~/.cache/emacs/")
|
|
url-history-file (expand-file-name "url/history" user-emacs-directory))
|
|
|
|
;; Use no-littering to automatically set common paths to the new user-emacs-directory
|
|
(use-package no-littering)
|
|
(setq custom-file (make-temp-file "emacs-custom-"))
|
|
(load custom-file t)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:329f529a-ef9f-4787-b311-1c485e05b754" class="outline-4">
|
|
<h4 id="h:329f529a-ef9f-4787-b311-1c485e05b754"><span class="section-number-4">4.2.5.</span> Move backup files to another location</h4>
|
|
<div class="outline-text-4" id="text-h:329f529a-ef9f-4787-b311-1c485e05b754">
|
|
<p>
|
|
Many people dislike the Emacs backup files; I do enjoy them, but have to admit that they clutter the filesystem a little too much. Also, I rarely need to access these over different sessions. Hence I move them to <code>/tmp</code> - if Emacs unexpectedly crashes, the files can be recovered, but the backup files will not gather everywhere and will be deleted upon shutdown.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(let ((backup-dir "~/tmp/emacs/backups")
|
|
(auto-saves-dir "~/tmp/emacs/auto-saves/"))
|
|
(dolist (dir (list backup-dir auto-saves-dir))
|
|
(when (not (file-directory-p dir))
|
|
(make-directory dir t)))
|
|
(setq backup-directory-alist `(("." . ,backup-dir))
|
|
auto-save-file-name-transforms `((".*" ,auto-saves-dir t))
|
|
auto-save-list-file-prefix (concat auto-saves-dir ".saves-")
|
|
tramp-backup-directory-alist `((".*" . ,backup-dir))
|
|
tramp-auto-save-directory auto-saves-dir))
|
|
|
|
(setq backup-by-copying t ; Don't delink hardlinks
|
|
delete-old-versions t ; Clean up the backups
|
|
version-control t ; Use version numbers on backups,
|
|
kept-new-versions 5 ; keep some new versions
|
|
kept-old-versions 2) ; and some old ones, too
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:786b447d-03ad-4c1d-b114-c37caa2d591c" class="outline-3">
|
|
<h3 id="h:786b447d-03ad-4c1d-b114-c37caa2d591c"><span class="section-number-3">4.3.</span> General init.el setup + UI</h3>
|
|
<div class="outline-text-3" id="text-h:786b447d-03ad-4c1d-b114-c37caa2d591c">
|
|
<p>
|
|
In this general section I have settings that I either consider to be integral to my experience when using emacs or have no other section that I feel they belong to.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:76a5bd78-a20d-4068-bea8-a38fdb26428e" class="outline-4">
|
|
<h4 id="h:76a5bd78-a20d-4068-bea8-a38fdb26428e"><span class="section-number-4">4.3.1.</span> General setup</h4>
|
|
<div class="outline-text-4" id="text-h:76a5bd78-a20d-4068-bea8-a38fdb26428e">
|
|
<p>
|
|
Here I set up some things that are too minor to put under other categories.
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li>Firstly we disable to having to type `yes` and `no` and switch it to `y` and `n`.</li>
|
|
<li>We also enable the marking of trailing whitespaces.</li>
|
|
<li>Also, make emacs highlight the current line globally</li>
|
|
<li>Emacs defaults to pausing all display redrawing on any input. This may have been useful previously, but is not necessary nowadays.</li>
|
|
<li>I also disable the suspend-frame function, as I never use it and it is quite confusing when accidentally hitting the keys for it.</li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; use UTF-8 everywhere
|
|
(set-language-environment "UTF-8")
|
|
|
|
;; set default font size
|
|
(defvar swarsel/default-font-size 130)
|
|
(setq swarsel-standard-font "FiraCode Nerd Font Mono"
|
|
swarsel-alt-font "FiraCode Nerd Font Mono")
|
|
|
|
;; (defalias 'yes-or-no-p 'y-or-n-p)
|
|
;;(setq-default show-trailing-whitespace t)
|
|
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
|
(global-hl-line-mode 1)
|
|
;; (setq redisplay-dont-pause t) ;; obsolete
|
|
(setq blink-cursor-mode nil) ;; blink-cursor is an unexpected source of slowdown
|
|
(global-subword-mode 1) ; Iterate through CamelCase words
|
|
(setq blink-matching-paren nil) ;; this makes the cursor jump around annoyingly
|
|
(delete-selection-mode 1)
|
|
(setq vc-follow-symlinks t)
|
|
(setq require-final-newline t)
|
|
(winner-mode 1)
|
|
(setq load-prefer-newer t)
|
|
|
|
(setq undo-limit 80000000
|
|
evil-want-fine-undo t
|
|
auto-save-default t
|
|
password-cache-expiry nil
|
|
)
|
|
(setq browse-url-browser-function 'browse-url-firefox)
|
|
;; disable a keybind that does more harm than good
|
|
(global-set-key [remap suspend-frame]
|
|
(lambda ()
|
|
(interactive)
|
|
(message "This keybinding is disabled (was 'suspend-frame')")))
|
|
|
|
(setq visible-bell nil)
|
|
(setq initial-major-mode 'fundamental-mode
|
|
initial-scratch-message nil)
|
|
|
|
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
|
|
(add-hook 'text-mode-hook 'display-line-numbers-mode)
|
|
(global-visual-line-mode 1)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:0debe8fd-b319-4ab7-a92c-784fa7896b75" class="outline-4">
|
|
<h4 id="h:0debe8fd-b319-4ab7-a92c-784fa7896b75"><span class="section-number-4">4.3.2.</span> Mark all themes as safe</h4>
|
|
<div class="outline-text-4" id="text-h:0debe8fd-b319-4ab7-a92c-784fa7896b75">
|
|
<p>
|
|
Normally when switching themes in emacs, the user will be warned that themes can run malicious code. I only run one theme really and deem it safe. It is however annoying to be asked this on every new system and it also creates lines in custom.el to answer that query, so here I declare all themes as safe.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq custom-safe-themes t)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:b587e869-9911-443b-bc6d-8fb3ce31908d" class="outline-4">
|
|
<h4 id="h:b587e869-9911-443b-bc6d-8fb3ce31908d"><span class="section-number-4">4.3.3.</span> Show less compilation warnings</h4>
|
|
<div class="outline-text-4" id="text-h:b587e869-9911-443b-bc6d-8fb3ce31908d">
|
|
<p>
|
|
When Emacs compiles stuff, it often shows a bunch of warnings that I do not need to deal with. Here we silence those. Some will be disabled completely, and some only when we have native compilation available (which should be most of the time, however).
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local))
|
|
;; Make native compilation silent and prune its cache.
|
|
(when (native-comp-available-p)
|
|
(setq native-comp-async-report-warnings-errors 'silent) ; Emacs 28 with native compilation
|
|
(setq native-compile-prune-cache t)) ; Emacs 29
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:6527b3ce-b76d-431a-9960-a57da7c53e1b" class="outline-4">
|
|
<h4 id="h:6527b3ce-b76d-431a-9960-a57da7c53e1b"><span class="section-number-4">4.3.4.</span> Indentation</h4>
|
|
<div class="outline-text-4" id="text-h:6527b3ce-b76d-431a-9960-a57da7c53e1b">
|
|
<p>
|
|
Here I define several options related to indentation; I first make it so that only whitespace will be used instead of tab characters for indentation, and I also set a small standard indent.
|
|
</p>
|
|
|
|
<p>
|
|
We set <code>tab-always-indent</code> to <code>'complete</code> in order to indent first and then do completion if there are any. Also we make it so that python will not complain about missing indentation info.
|
|
</p>
|
|
|
|
<p>
|
|
Lastly, I load the <code>highlight-indent-guides</code> package. This adds a neat visual indicator of the indentation level, which is useful for languages like python.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq-default indent-tabs-mode nil
|
|
tab-width 2)
|
|
|
|
(setq tab-always-indent 'complete)
|
|
(setq python-indent-guess-indent-offset-verbose nil)
|
|
|
|
(use-package highlight-indent-guides
|
|
:hook (prog-mode . highlight-indent-guides-mode)
|
|
:init
|
|
(setq highlight-indent-guides-method 'column)
|
|
(setq highlight-indent-guides-responsive 'top)
|
|
)
|
|
|
|
(with-eval-after-load 'highlight-indent-guides
|
|
(set-face-attribute 'highlight-indent-guides-even-face nil :background "gray10")
|
|
(set-face-attribute 'highlight-indent-guides-odd-face nil :background "gray20")
|
|
(set-face-attribute 'highlight-indent-guides-stack-even-face nil :background "gray40")
|
|
(set-face-attribute 'highlight-indent-guides-stack-odd-face nil :background "gray50"))
|
|
|
|
(use-package aggressive-indent)
|
|
(global-aggressive-indent-mode 1)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:3dc9fb1d-cd16-4bd0-a9ac-55a944415a90" class="outline-4">
|
|
<h4 id="h:3dc9fb1d-cd16-4bd0-a9ac-55a944415a90"><span class="section-number-4">4.3.5.</span> Scrolling</h4>
|
|
<div class="outline-text-4" id="text-h:3dc9fb1d-cd16-4bd0-a9ac-55a944415a90">
|
|
<p>
|
|
By default, emacs scrolls half a page when reaching the bottom of the buffer. This is extremely annoying. This sets up more granular scrolling that allows scrolling with a mouse wheel or the two-finger touchscreen gesture. This now also works in buffers with a very small frame.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq mouse-wheel-scroll-amount
|
|
'(1
|
|
((shift) . 5)
|
|
((meta) . 0.5)
|
|
((control) . text-scale))
|
|
mouse-drag-copy-region nil
|
|
make-pointer-invisible t
|
|
mouse-wheel-progressive-speed t
|
|
mouse-wheel-follow-mouse t)
|
|
|
|
(setq-default scroll-preserve-screen-position t
|
|
scroll-conservatively 1
|
|
scroll-margin 0
|
|
next-screen-context-lines 0)
|
|
|
|
(pixel-scroll-precision-mode 1)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:5bf9f014-ee96-42da-b285-7b34f04e6bb1" class="outline-4">
|
|
<h4 id="h:5bf9f014-ee96-42da-b285-7b34f04e6bb1"><span class="section-number-4">4.3.6.</span> Evil</h4>
|
|
<div class="outline-text-4" id="text-h:5bf9f014-ee96-42da-b285-7b34f04e6bb1">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:218376e8-086b-46bf-91b3-78295d5d440f"></a>General evil<br />
|
|
<div class="outline-text-5" id="text-h:218376e8-086b-46bf-91b3-78295d5d440f">
|
|
<p>
|
|
This setups up evil, which brings vim-like keybindings to emacs. In the same location, I also unbind the <code>C-z</code> key (I am very unhappy with this implementation, but it is the only thing that works consistently so far) to make it available for <a href="#h:c3cc1c12-3ab8-42b7-be07-63f54eac397f">cape</a> later.
|
|
</p>
|
|
|
|
<p>
|
|
Also, I setup initial modes for several major-modes depending on what I deem fit.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; Emulate vim in emacs
|
|
(use-package evil
|
|
:init
|
|
(setq evil-want-integration t) ; loads evil
|
|
(setq evil-want-keybinding nil) ; loads "helpful bindings" for other modes
|
|
(setq evil-want-C-u-scroll t) ; scrolling using C-u
|
|
(setq evil-want-C-i-jump nil) ; jumping with C-i
|
|
(setq evil-want-Y-yank-to-eol t) ; give Y some utility
|
|
(setq evil-shift-width 2) ; uniform indent
|
|
(setq evil-respect-visual-line-mode t) ; i am torn on this one
|
|
(setq evil-split-window-below t)
|
|
(setq evil-vsplit-window-right t)
|
|
:config
|
|
(evil-mode 1)
|
|
(define-key evil-normal-state-map (kbd "C-z") nil)
|
|
(define-key evil-insert-state-map (kbd "C-z") nil)
|
|
(define-key evil-visual-state-map (kbd "C-z") nil)
|
|
(define-key evil-motion-state-map (kbd "C-z") nil)
|
|
(define-key evil-operator-state-map (kbd "C-z") nil)
|
|
(define-key evil-replace-state-map (kbd "C-z") nil)
|
|
(define-key global-map (kbd "C-z") nil)
|
|
(evil-set-undo-system 'undo-tree)
|
|
|
|
;; Don't use evil-mode in these contexts, or use it in a specific mode
|
|
(evil-set-initial-state 'messages-buffer-mode 'emacs)
|
|
(evil-set-initial-state 'dashboard-mode 'emacs)
|
|
(evil-set-initial-state 'dired-mode 'emacs)
|
|
(evil-set-initial-state 'cfw:details-mode 'emacs)
|
|
(evil-set-initial-state 'Custom-mode 'emacs) ; god knows why this mode is in uppercase
|
|
(evil-set-initial-state 'mu4e-headers-mode 'normal)
|
|
(evil-set-initial-state 'python-inferior-mode 'normal)
|
|
(add-hook 'org-capture-mode-hook 'evil-insert-state)
|
|
(add-to-list 'evil-buffer-regexps '("COMMIT_EDITMSG" . insert)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:bde208f3-01ef-4dc6-9981-65f3d2a8189b"></a>evil-collection<br />
|
|
<div class="outline-text-5" id="text-h:bde208f3-01ef-4dc6-9981-65f3d2a8189b">
|
|
<p>
|
|
This gives support for many different modes, and works beautifully out of the box.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package evil-collection
|
|
:after evil
|
|
:config
|
|
(evil-collection-init)
|
|
(setq forge-add-default-bindings nil))
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:d80e3f7d-0185-4a15-832b-d756e576265c"></a>evil-snipe<br />
|
|
<div class="outline-text-5" id="text-h:d80e3f7d-0185-4a15-832b-d756e576265c">
|
|
<p>
|
|
This package changes the char-search commands like <code>f</code> by showing the results in a more visual manner. It also gives a 2-character search using <code>s</code> and <code>S</code>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">;; enables 2-char inline search
|
|
(use-package evil-snipe
|
|
:after evil
|
|
:demand
|
|
:config
|
|
(evil-snipe-mode +1)
|
|
;; replace 1-char searches (f&t) with this better UI
|
|
(evil-snipe-override-mode +1))
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:b06a378d-5248-4451-8eee-e65a3a768b1d"></a>evil-cleverparens<br />
|
|
<div class="outline-text-5" id="text-h:b06a378d-5248-4451-8eee-e65a3a768b1d">
|
|
<p>
|
|
This helps keeping parentheses balanced which is useful when writing in languages like Elisp. I do not activate this by default, as most languages do not profit from this enough in my eyes.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">;; for parentheses-heavy languades modify evil commands to keep balance of parantheses
|
|
(use-package evil-cleverparens)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:aac82e5e-d882-4870-b644-ebdd0a2daae3"></a>evil-surround<br />
|
|
<div class="outline-text-5" id="text-h:aac82e5e-d882-4870-b644-ebdd0a2daae3">
|
|
<p>
|
|
This minor-mode adds functionality for doing better surround-commands; for example <code>ci[</code> will let you change the word within square brackets.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; enables surrounding text with S
|
|
(use-package evil-surround
|
|
:config
|
|
(global-evil-surround-mode 1))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:e888d7a7-1755-4109-af11-5358b8cf140e" class="outline-4">
|
|
<h4 id="h:e888d7a7-1755-4109-af11-5358b8cf140e"><span class="section-number-4">4.3.7.</span> ispell</h4>
|
|
<div class="outline-text-4" id="text-h:e888d7a7-1755-4109-af11-5358b8cf140e">
|
|
<p>
|
|
This should setup a wordlist that can be used as a dictionary. However, for some reason this does not work, and I will need to further investigate this issue.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; set the NixOS wordlist by hand
|
|
(setq ispell-alternate-dictionary "/nix/store/gjmvnbs97cnw19wnqh9m075cdbhy8r8g-wordlist-WORDLIST")
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:60f87342-0491-4c56-8057-6f075cf35753" class="outline-4">
|
|
<h4 id="h:60f87342-0491-4c56-8057-6f075cf35753"><span class="section-number-4">4.3.8.</span> Font Configuration</h4>
|
|
<div class="outline-text-4" id="text-h:60f87342-0491-4c56-8057-6f075cf35753">
|
|
<p>
|
|
Here I define my fonts to be used. Honestly I do not understand the face-attributes and pitches of emacs all too well. It seems this configuration works fine, but I might have to revisit this at some point in the future.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(dolist (face '(default fixed-pitch))
|
|
(set-face-attribute face nil
|
|
:font "FiraCode Nerd Font Mono"))
|
|
(add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font Mono"))
|
|
|
|
(set-face-attribute 'default nil :height 100)
|
|
(set-face-attribute 'fixed-pitch nil :height 1.0)
|
|
|
|
(set-face-attribute 'variable-pitch nil
|
|
:family "IBM Plex Sans"
|
|
:weight 'regular
|
|
:height 1.06)
|
|
|
|
;; these settings used to be in custom.el
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:72a9704b-83d2-4b74-a1f6-d333203f62db" class="outline-4">
|
|
<h4 id="h:72a9704b-83d2-4b74-a1f6-d333203f62db"><span class="section-number-4">4.3.9.</span> Theme</h4>
|
|
<div class="outline-text-4" id="text-h:72a9704b-83d2-4b74-a1f6-d333203f62db">
|
|
<p>
|
|
I have grown to love the <code>doom-citylights</code> theme and have modeled my whole system after it. Also solaire-mode is a nice mode that inverts the alt-faces with the normal faces for specific 'minor' buffers (like Help-buffers).
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package solaire-mode
|
|
:custom
|
|
(solaire-global-mode +1))
|
|
|
|
(use-package doom-themes
|
|
:hook
|
|
(server-after-make-frame . (lambda () (load-theme
|
|
'doom-city-lights t)))
|
|
:config
|
|
(load-theme 'doom-city-lights t)
|
|
(doom-themes-treemacs-config)
|
|
(doom-themes-org-config))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:eb0ea526-a83a-4664-b3a1-2b40d3a31493" class="outline-4">
|
|
<h4 id="h:eb0ea526-a83a-4664-b3a1-2b40d3a31493"><span class="section-number-4">4.3.10.</span> Icons</h4>
|
|
<div class="outline-text-4" id="text-h:eb0ea526-a83a-4664-b3a1-2b40d3a31493">
|
|
<p>
|
|
This section loads the base icons used in my configuration. I am using <code>nerd-icons</code> over <code>all-the-icons</code> since the former seems to have more integrations with different packages than the latter.
|
|
</p>
|
|
|
|
<p>
|
|
Used in:
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li><a href="#h:b190d512-bfb5-42ec-adec-8d86bab726ce">Vertico and friends</a></li>
|
|
<li><a href="#h:5653d693-ecca-4c95-9633-66b9e3241070">IN USE Corfu</a></li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package nerd-icons)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:455ed7ac-ee7f-4f94-b857-f2c58b2282d0" class="outline-4">
|
|
<h4 id="h:455ed7ac-ee7f-4f94-b857-f2c58b2282d0"><span class="section-number-4">4.3.11.</span> Variable Pitch Mode</h4>
|
|
<div class="outline-text-4" id="text-h:455ed7ac-ee7f-4f94-b857-f2c58b2282d0">
|
|
<p>
|
|
This minor mode allows mixing fixed and variable pitch fonts within the same buffer.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package mixed-pitch
|
|
:custom
|
|
(mixed-pitch-set-height nil)
|
|
(mixed-pitch-variable-pitch-cursor nil)
|
|
:hook
|
|
(text-mode . mixed-pitch-mode))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:ed585848-875a-4673-910c-d2e1901dd95b" class="outline-4">
|
|
<h4 id="h:ed585848-875a-4673-910c-d2e1901dd95b"><span class="section-number-4">4.3.12.</span> Modeline</h4>
|
|
<div class="outline-text-4" id="text-h:ed585848-875a-4673-910c-d2e1901dd95b">
|
|
<p>
|
|
Here I set up the modeline with some information that I find useful. Specficially I am using the doom modeline. Most informations I disable for it, except for the cursor information (row + column) as well as a widget for <code>mu4e</code> and git information.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package doom-modeline
|
|
:init
|
|
(doom-modeline-mode)
|
|
(column-number-mode)
|
|
:custom
|
|
((doom-modeline-height 22)
|
|
(doom-modeline-indent-info nil)
|
|
(doom-modeline-buffer-encoding nil)))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:39ae01e9-8053-4f76-aa77-8cbbbcff9652" class="outline-4">
|
|
<h4 id="h:39ae01e9-8053-4f76-aa77-8cbbbcff9652"><span class="section-number-4">4.3.13.</span> Helper Modes</h4>
|
|
<div class="outline-text-4" id="text-h:39ae01e9-8053-4f76-aa77-8cbbbcff9652">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:b190d512-bfb5-42ec-adec-8d86bab726ce"></a>Vertico, Orderless, Marginalia, Consult, Embark<br />
|
|
<div class="outline-text-5" id="text-h:b190d512-bfb5-42ec-adec-8d86bab726ce">
|
|
<p>
|
|
This set of packages uses the default emacs completion framework and works together to provide a very nice user experience:
|
|
</p>
|
|
|
|
<ul class="org-ul">
|
|
<li>Vertico simply provides a vertically stacking completion</li>
|
|
<li>Marginalia adds more information to completion results</li>
|
|
<li>Orderless allows for fuzzy matching</li>
|
|
<li>Consult provides better implementations for several user functions, e.g. <code>consult-line</code> or <code>consult-outline</code></li>
|
|
<li>Embark allows acting on the results in the minibuffer while the completion is still ongoing - this is extremely useful since it allows to, for example, read the documentation for several functions without closing the help search. It can also collect the results of a grep operation into a seperate buffer that edits the result in their original location.</li>
|
|
</ul>
|
|
|
|
<p>
|
|
Nerd icons is originally enabled here: <a href="#h:eb0ea526-a83a-4664-b3a1-2b40d3a31493">Icons</a>
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:d7c7f597-f870-4e01-8f7e-27dd31dd245d"></a>vertico<br />
|
|
<div class="outline-text-6" id="text-h:d7c7f597-f870-4e01-8f7e-27dd31dd245d">
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq read-buffer-completion-ignore-case t
|
|
read-file-name-completion-ignore-case t
|
|
completion-ignore-case t)
|
|
|
|
(use-package vertico
|
|
:custom
|
|
(vertico-scroll-margin 0)
|
|
(vertico-count 10)
|
|
(vertico-resize t)
|
|
(vertico-cycle t)
|
|
:init
|
|
(vertico-mode)
|
|
(vertico-mouse-mode))
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:10d4f2bd-8c72-430b-a9ed-9b5e279ec0b4"></a>vertico-directory<br />
|
|
<div class="outline-text-6" id="text-h:10d4f2bd-8c72-430b-a9ed-9b5e279ec0b4">
|
|
<p>
|
|
This package allows for <code>Ido</code>-like directory navigation.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">(use-package vertico-directory
|
|
:ensure nil
|
|
:after vertico
|
|
:bind (:map vertico-map
|
|
("RET" . vertico-directory-enter)
|
|
("C-DEL" . vertico-directory-delete-word)
|
|
("DEL" . vertico-directory-delete-char))
|
|
;; Tidy shadowed file names
|
|
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:211fc0bd-0d64-4577-97d8-6abc94435f04"></a>orderless<br />
|
|
<div class="outline-text-6" id="text-h:211fc0bd-0d64-4577-97d8-6abc94435f04">
|
|
<p>
|
|
When first installing orderless, I often times faced the problem, that when editing long files and calling <code>consult-line</code>, Emacs would hang when changing a search term in the middle (e.g. from <code>servicse.xserver</code> to <code>servic.xserver</code> in order to fix the typo). The below orderless rules have a more strict matching that has a positive impact on performance.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package orderless
|
|
:config
|
|
(orderless-define-completion-style orderless+initialism
|
|
(orderless-matching-styles '(orderless-initialism orderless-literal orderless-regexp)))
|
|
(setq completion-styles '(orderless)
|
|
completion-category-defaults nil
|
|
completion-category-overrides
|
|
'((file (styles partial-completion orderless+initialism))
|
|
(buffer (styles orderless+initialism))
|
|
(consult-multi (styles orderless+initialism))
|
|
(command (styles orderless+initialism))
|
|
(eglot (styles orderless+initialism))
|
|
(variable (styles orderless+initialism))
|
|
(symbol (styles orderless+initialism)))
|
|
orderless-matching-styles '(orderless-literal orderless-regexp)))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:49ab82bf-812d-4fbe-a5b6-d3ad703fe32c"></a>consult<br />
|
|
<div class="outline-text-6" id="text-h:49ab82bf-812d-4fbe-a5b6-d3ad703fe32c">
|
|
<p>
|
|
The big winner here are the convenient keybinds being setup here for general use. Also, I setup vim-navigation for minibuffer completions. <code>consult-buffer</code> is set twice because I am still used to that weird <code>C-M-j</code> command that I chose for <code>ivy-switch-buffer</code> when I first started using Emacs. I want to move to the other command but for now it is not feasible to delete the other one.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package consult
|
|
:config
|
|
(setq consult-fontify-max-size 1024)
|
|
:bind
|
|
(("C-x b" . consult-buffer)
|
|
("C-c <C-m>" . consult-global-mark)
|
|
("C-c C-a" . consult-org-agenda)
|
|
("C-x O" . consult-org-heading)
|
|
("C-M-j" . consult-buffer)
|
|
("C-s" . consult-line)
|
|
("M-g M-g" . consult-goto-line)
|
|
("M-g i" . consult-imenu)
|
|
("M-s M-s" . consult-line-multi)
|
|
:map minibuffer-local-map
|
|
("C-j" . next-line)
|
|
("C-k" . previous-line)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:1c564ee5-ccd7-48be-b69a-d963400c4704"></a>embark<br />
|
|
<div class="outline-text-6" id="text-h:1c564ee5-ccd7-48be-b69a-d963400c4704">
|
|
<p>
|
|
I have stripped down the embark keybinds heavily. It is very useful to me even in it's current state, but it quickly becomes overwhelming. <code>embark-dwim</code> acts on a candidate without closing the minibuffer, which is very useful. <code>embark-act</code> lets the user choose from all actions, but has an overwhelming interface.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package embark
|
|
:bind
|
|
(("C-." . embark-act)
|
|
("M-." . embark-dwim)
|
|
("C-h B" . embark-bindings)
|
|
("C-c c" . embark-collect))
|
|
:custom
|
|
(prefix-help-command #'embark-prefix-help-command)
|
|
(embark-quit-after-action '((t . nil)))
|
|
:config
|
|
(add-to-list 'display-buffer-alist
|
|
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
|
nil
|
|
(window-parameters (mode-line-format . none)))))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:6287551c-a6f7-4870-b3f3-210d6f038b6f"></a>embark-consult<br />
|
|
<div class="outline-text-6" id="text-h:6287551c-a6f7-4870-b3f3-210d6f038b6f">
|
|
<p>
|
|
Provides previews for embark.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package embark-consult
|
|
:after (embark consult)
|
|
:demand t ; only necessary if you have the hook below
|
|
;; if you want to have consult previews as you move around an
|
|
;; auto-updating embark collect buffer
|
|
:hook
|
|
(embark-collect-mode . consult-preview-at-point-mode))
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:f32040a4-882f-4e6b-97f1-a0105c44c034"></a>marginalia<br />
|
|
<div class="outline-text-6" id="text-h:f32040a4-882f-4e6b-97f1-a0105c44c034">
|
|
<p>
|
|
I set the annotation-mode of marginalia to <code>heavy</code>. This gives even more information on the stuff that you are looking at. One thing I am missing from ivy is the highlighting on <code>mode</code>-commands based on the current state of the mode. Also, I do not understand all the shorthands used by marginalia yet.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">(use-package marginalia
|
|
:after vertico
|
|
:init
|
|
(marginalia-mode)
|
|
(setq marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:d70ec2fb-da43-4523-9ee4-774ececdb80e"></a>nerd-icons-completion<br />
|
|
<div class="outline-text-6" id="text-h:d70ec2fb-da43-4523-9ee4-774ececdb80e">
|
|
<p>
|
|
As stated above, this simply provides nerd-icons to the completion framework.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package nerd-icons-completion
|
|
:after (marginalia nerd-icons)
|
|
:hook (marginalia-mode . nerd-icons-completion-marginalia-setup)
|
|
:init
|
|
(nerd-icons-completion-mode))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:cbf6bd48-2503-489a-89da-e3359564e989"></a>Helpful + which-key: Better help defaults<br />
|
|
<div class="outline-text-5" id="text-h:cbf6bd48-2503-489a-89da-e3359564e989">
|
|
<p>
|
|
This pair of packages provides information on keybinds in addition to function names, which makes it easier to remember keybinds (<code>which-key</code>). The <code>helpful</code> package provides a better <code>Help</code> framework for Emacs. For some reason, the Help windows are always being focused by the cursor even though I have set <code>help-window-select</code> to nil. I do not understand why.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package which-key
|
|
:init (which-key-mode)
|
|
:diminish which-key-mode
|
|
:config
|
|
(setq which-key-idle-delay 0.3))
|
|
|
|
(use-package helpful
|
|
:bind
|
|
(("C-h f" . helpful-callable)
|
|
("C-h v" . helpful-variable)
|
|
("C-h k" . helpful-key)
|
|
("C-h C-." . helpful-at-point))
|
|
:config
|
|
(setq help-window-select nil))
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:bbbd9cc8-3a84-4810-a3d5-b8536a5fbda1" class="outline-4">
|
|
<h4 id="h:bbbd9cc8-3a84-4810-a3d5-b8536a5fbda1"><span class="section-number-4">4.3.14.</span> Ligatures</h4>
|
|
<div class="outline-text-4" id="text-h:bbbd9cc8-3a84-4810-a3d5-b8536a5fbda1">
|
|
<p>
|
|
Personally, I think ligatures are fancy. With this mode, they stay 'cursorable'. However, I do not need them in all modes, so I only use them in programming modes.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package ligature
|
|
:init
|
|
(global-ligature-mode t)
|
|
:config
|
|
(ligature-set-ligatures 'prog-mode
|
|
'("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
|
|
":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
|
|
"!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
|
|
"<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
|
|
"<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
|
|
"..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
|
|
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
|
|
"[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
|
|
">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
|
|
"<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
|
|
"##" "#(" "#?" "#_" "%%" ".=" ".." ".?" "+>" "++" "?:" "?="
|
|
"?." "??" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)" "\\\\"
|
|
"://" ";;")))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:e9d40e63-0e1f-47df-98f7-5427992588a4" class="outline-4">
|
|
<h4 id="h:e9d40e63-0e1f-47df-98f7-5427992588a4"><span class="section-number-4">4.3.15.</span> Popup (popper) + Shackle Buffers</h4>
|
|
<div class="outline-text-4" id="text-h:e9d40e63-0e1f-47df-98f7-5427992588a4">
|
|
<p>
|
|
The popper package allows to declare different buffers as 'popup-type', which sort of acts like a scratchpad. It can be toggled at any time using <code>popper-toggle</code> and the resulting frame can be freely customized (with <code>shackle</code>) to a certain size. It is also possible to prevent a buffer from appearing - I do this for example to the <code>*Warnings*</code> buffer, since usually I am not interested in it's output.
|
|
</p>
|
|
|
|
<p>
|
|
<code>popper-echo-mode</code> shows all buffers that are currently stored as a popup in the echo area when a popup is opened - this is useful since you can cycle between all popup buffers.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package popper
|
|
:bind (("M-[" . popper-toggle))
|
|
:init
|
|
(setq popper-reference-buffers
|
|
'("\\*Messages\\*"
|
|
("\\*Warnings\\*" . hide)
|
|
"Output\\*$"
|
|
"\\*Async Shell Command\\*"
|
|
"\\*Async-native-compile-log\\*"
|
|
help-mode
|
|
helpful-mode
|
|
"*Occur*"
|
|
"*scratch*"
|
|
"*julia*"
|
|
"*Python*"
|
|
"*rustic-compilation*"
|
|
"*cargo-run*"
|
|
;; ("*tex-shell*" . hide)
|
|
(compilation-mode . hide)))
|
|
(popper-mode +1)
|
|
(popper-echo-mode +1))
|
|
|
|
(use-package shackle
|
|
:config
|
|
(setq shackle-rules '(("*Messages*" :select t :popup t :align right :size 0.3)
|
|
("*Warnings*" :ignore t :popup t :align right :size 0.3)
|
|
("*Occur*" :select t :popup t :align below :size 0.2)
|
|
("*scratch*" :select t :popup t :align below :size 0.2)
|
|
("*Python*" :select t :popup t :align below :size 0.2)
|
|
("*rustic-compilation*" :select t :popup t :align below :size 0.4)
|
|
("*cargo-run*" :select t :popup t :align below :size 0.2)
|
|
("*tex-shell*" :ignore t :popup t :align below :size 0.2)
|
|
(helpful-mode :select t :popup t :align right :size 0.35)
|
|
(help-mode :select t :popup t :align right :size 0.4)))
|
|
(shackle-mode 1))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:a6d23c8c-125f-4e36-af30-ff0a1e0d5a28" class="outline-4">
|
|
<h4 id="h:a6d23c8c-125f-4e36-af30-ff0a1e0d5a28"><span class="section-number-4">4.3.16.</span> Indicate first and last line of buffer</h4>
|
|
<div class="outline-text-4" id="text-h:a6d23c8c-125f-4e36-af30-ff0a1e0d5a28">
|
|
<p>
|
|
This places little angled indicators on the fringe of a window which indicate buffer boundaries. This is not super useful, but makes use of a space that I want to keep for aesthetic reasons anyways and makes it a bit more useful in the process.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq-default indicate-buffer-boundaries t)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:053a36bf-168f-4f63-a0c4-f0139dc6cc3b" class="outline-4">
|
|
<h4 id="h:053a36bf-168f-4f63-a0c4-f0139dc6cc3b"><span class="section-number-4">4.3.17.</span> Authentication</h4>
|
|
<div class="outline-text-4" id="text-h:053a36bf-168f-4f63-a0c4-f0139dc6cc3b">
|
|
<p>
|
|
This defines the authentication sources used by <code>org-calfw</code> (<a href="#h:c760f04e-622f-4b3e-8916-53ca8cce6edc">Calendar</a>) and <a href="#h:1a8585ed-d9f2-478f-a132-440ada1cde2c">Forge</a>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq auth-sources '( "~/.emacs.d/.caldav" "~/.emacs.d/.authinfo.gpg")
|
|
auth-source-cache-expiry nil) ; default is 2h
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:f2622fd3-7f14-47a8-8c21-33574fcbf14b" class="outline-3">
|
|
<h3 id="h:f2622fd3-7f14-47a8-8c21-33574fcbf14b"><span class="section-number-3">4.4.</span> Modules</h3>
|
|
<div class="outline-text-3" id="text-h:f2622fd3-7f14-47a8-8c21-33574fcbf14b">
|
|
<p>
|
|
This section houses all configuration bits that are related to a specific package that is not fundamental to my Emacs experience.
|
|
</p>
|
|
|
|
<p>
|
|
At some point this will receive further sorting, but for now this is good enough.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:99544398-72af-4382-b8e1-01b2221baff4" class="outline-4">
|
|
<h4 id="h:99544398-72af-4382-b8e1-01b2221baff4"><span class="section-number-4">4.4.1.</span> Org Mode</h4>
|
|
<div class="outline-text-4" id="text-h:99544398-72af-4382-b8e1-01b2221baff4">
|
|
<p>
|
|
org-mode is probably my most-used mode in Emcas. It acts as my organizer, config management tool and calender even.
|
|
</p>
|
|
|
|
<p>
|
|
Note that nearly all headings within the <code>Org-mode</code> heading are coded within the <code>use-package</code> setup, so be very careful about moving stuff about here.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:877c9401-a354-4e44-a235-db1a90d19e00"></a>General org-mode<br />
|
|
<div class="outline-text-5" id="text-h:877c9401-a354-4e44-a235-db1a90d19e00">
|
|
<p>
|
|
This sets up the basic org-mode. I wrote a function to handle some of the initial org-mode behaviour in <a href="#h:06b77d28-3fd5-4554-8c7d-32c1b0ec8da5">org-mode setup.
|
|
</a>
|
|
This part of the configuration mostly makes some aesthetic changes, enables neat LaTeX and points Emacs to some files that it needs for org-mode
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package org
|
|
;;:diminish (org-indent-mode)
|
|
:hook (org-mode . swarsel/org-mode-setup)
|
|
:bind
|
|
(("C-<tab>" . org-fold-outer)
|
|
("C-c s" . org-store-link))
|
|
:config
|
|
(setq org-ellipsis " ⤵"
|
|
org-link-descriptive t
|
|
org-hide-emphasis-markers t)
|
|
(setq org-startup-folded t)
|
|
(setq org-support-shift-select t)
|
|
|
|
;; (setq org-agenda-start-with-log-mode t)
|
|
;; (setq org-log-done 'time)
|
|
;; (setq org-log-into-drawer t)
|
|
(setq org-startup-with-inline-images t)
|
|
(setq org-image-actual-width nil)
|
|
(setq org-format-latex-options '(:foreground "White" :background default :scale 2.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:2b3b4eb6-68a1-476d-b5d1-940a21484f1d"></a>org-agenda<br />
|
|
<div class="outline-text-5" id="text-h:2b3b4eb6-68a1-476d-b5d1-940a21484f1d">
|
|
<p>
|
|
Here I setup a plethora of keywords, keybinds and paths to give my org-agenda more power.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq org-agenda-files '("/home/swarsel/Nextcloud/Org/Tasks.org"
|
|
"/home/swarsel/Nextcloud/Org/Archive.org"
|
|
"/home/swarsel/Nextcloud/Org/Anki.org"
|
|
"/home/swarsel/Calendars/leon_cal.org"))
|
|
|
|
(setq org-refile-targets
|
|
'((swarsel-archive-org-file :maxlevel . 1)
|
|
(swarsel-anki-org-file :maxlevel . 1)
|
|
(swarsel-tasks-org-file :maxlevel . 1)))
|
|
|
|
(setq org-todo-keywords
|
|
'((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)")
|
|
(sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)")))
|
|
|
|
|
|
;; Configure custom agenda views
|
|
(setq org-agenda-custom-commands
|
|
'(("d" "Dashboard"
|
|
((agenda "" ((org-deadline-warning-days 7)))
|
|
(todo "NEXT"
|
|
((org-agenda-overriding-header "Next Tasks")))
|
|
(tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects")))))
|
|
|
|
("n" "Next Tasks"
|
|
((todo "NEXT"
|
|
((org-agenda-overriding-header "Next Tasks")))))
|
|
|
|
("W" "Work Tasks" tags-todo "+work-email")
|
|
|
|
|
|
("w" "Workflow Status"
|
|
((todo "WAIT"
|
|
((org-agenda-overriding-header "Waiting on External")
|
|
(org-agenda-files org-agenda-files)))
|
|
(todo "REVIEW"
|
|
((org-agenda-overriding-header "In Review")
|
|
(org-agenda-files org-agenda-files)))
|
|
(todo "PLAN"
|
|
((org-agenda-overriding-header "In Planning")
|
|
(org-agenda-todo-list-sublevels nil)
|
|
(org-agenda-files org-agenda-files)))
|
|
(todo "BACKLOG"
|
|
((org-agenda-overriding-header "Project Backlog")
|
|
(org-agenda-todo-list-sublevels nil)
|
|
(org-agenda-files org-agenda-files)))
|
|
(todo "READY"
|
|
((org-agenda-overriding-header "Ready for Work")
|
|
(org-agenda-files org-agenda-files)))
|
|
(todo "ACTIVE"
|
|
((org-agenda-overriding-header "Active Projects")
|
|
(org-agenda-files org-agenda-files)))
|
|
(todo "COMPLETED"
|
|
((org-agenda-overriding-header "Completed Projects")
|
|
(org-agenda-files org-agenda-files)))
|
|
(todo "CANC"
|
|
((org-agenda-overriding-header "Cancelled Projects")
|
|
(org-agenda-files org-agenda-files)))))))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:23183635-3d46-4d7d-8eda-e0a085b335ef"></a>org capture templates<br />
|
|
<div class="outline-text-5" id="text-h:23183635-3d46-4d7d-8eda-e0a085b335ef">
|
|
<p>
|
|
I wrote these capture templates to allow myself to quickly create Anki cards from within Emacs. I nearly never use this feature, but it cannot hurt to have.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq org-capture-templates
|
|
`(
|
|
("a" "Anki basic"
|
|
entry
|
|
(file+headline swarsel-org-anki-filepath "Dispatch")
|
|
(function swarsel-anki-make-template-string))
|
|
|
|
("A" "Anki cloze"
|
|
entry
|
|
(file+headline org-swarsel-anki-file "Dispatch")
|
|
"* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: Cloze\n:ANKI_DECK: 🦁 All::01 ❤️ Various::00 ✨ Allgemein\n:END:\n** Text\n%?\n** Extra\n")
|
|
("t" "Tasks / Projects")
|
|
("tt" "Task" entry (file+olp swarsel-org-tasks-filepath "Inbox")
|
|
"* TODO %?\n %U\n %a\n %i" :empty-lines 1)
|
|
))
|
|
)
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:40528f5a-c8cd-471b-b862-4088e8e61860"></a>Font Faces<br />
|
|
<div class="outline-text-5" id="text-h:40528f5a-c8cd-471b-b862-4088e8e61860">
|
|
<p>
|
|
Again, my understanding of the font-faces in Emacs is limited. This is mostly just tuned so that my org-files look acceptable.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
|
|
|
|
;; Set faces for heading levels
|
|
(with-eval-after-load 'org-faces (dolist (face '((org-level-1 . 1.1)
|
|
(org-level-2 . 0.9)
|
|
(org-level-3 . 0.9)
|
|
(org-level-4 . 0.9)
|
|
(org-level-5 . 0.9)
|
|
(org-level-6 . 0.9)
|
|
(org-level-7 . 0.9)
|
|
(org-level-8 . 0.9)))
|
|
(set-face-attribute (car face) nil :font swarsel-alt-font :weight 'medium :height (cdr face)))
|
|
|
|
;; Ensure that anything that should be fixed-pitch in Org files appears that way
|
|
(set-face-attribute 'org-block nil :inherit 'fixed-pitch)
|
|
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
|
|
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
|
|
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
|
|
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
|
|
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
|
|
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
|
|
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:62829574-a069-44b8-afb3-401a268d2747"></a>org-appear<br />
|
|
<div class="outline-text-5" id="text-h:62829574-a069-44b8-afb3-401a268d2747">
|
|
<p>
|
|
This package makes emphasis-markers appear when the cursor moves over them. Very useful as I enjoy the clean look of not always seeing them, but it is annoying not to be able to edit them properly.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package org-appear
|
|
:hook (org-mode . org-appear-mode)
|
|
:init
|
|
(setq org-appear-autolinks t)
|
|
(setq org-appear-autokeywords t)
|
|
(setq org-appear-autoentities t)
|
|
(setq org-appear-autosubmarkers t))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:bbcfa895-4d46-4b1d-b84e-f634e982c46e"></a>Centered org-mode Buffers<br />
|
|
<div class="outline-text-5" id="text-h:bbcfa895-4d46-4b1d-b84e-f634e982c46e">
|
|
<p>
|
|
I like org-mode buffers to be centered, as I do not find that enormous lines are of big use.
|
|
</p>
|
|
|
|
<p>
|
|
Function definition in: <a href="#h:fa710375-2efe-49b4-af6a-a875aca6e4a2">Visual-fill column</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package visual-fill-column
|
|
:hook (org-mode . swarsel/org-mode-visual-fill))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:c1a0adea-ca97-43d7-b5a0-b856d2ebc9a8"></a>Fix headings not folding sometimes<br />
|
|
<div class="outline-text-5" id="text-h:c1a0adea-ca97-43d7-b5a0-b856d2ebc9a8">
|
|
<p>
|
|
There is a weird bug in org-mode that makes it so that headings were not folding correctly sometimes. This setting seems to fix it.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq org-fold-core-style 'overlays)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:3e0b6da3-0497-4080-bb49-bab949c03bc4"></a>Babel<br />
|
|
<div class="outline-text-5" id="text-h:3e0b6da3-0497-4080-bb49-bab949c03bc4">
|
|
<p>
|
|
org-babel allows to run blocks in other programming languages within an org-mode buffer, similar to what e.g. jupyterhub offers for python.
|
|
</p>
|
|
|
|
<p>
|
|
It also offers a very useful utility of exporting org-mode buffers to different formats; the feature I enjoy most is what makes this file useful: the tangling functionality.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:5d5ed7be-ec5f-4e17-bbb8-820ab6a9961c"></a>Language Configuration<br />
|
|
<div class="outline-text-6" id="text-h:5d5ed7be-ec5f-4e17-bbb8-820ab6a9961c">
|
|
<ul class="org-ul">
|
|
<li>This configures the languages that babel recognizes.</li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(org-babel-do-load-languages
|
|
'org-babel-load-languages
|
|
'((emacs-lisp . t)
|
|
(python . t)
|
|
(js . t)
|
|
(shell . t)
|
|
))
|
|
|
|
(push '("conf-unix" . conf-unix) org-src-lang-modes)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:d112ed66-b2dd-45cc-8d70-9cf6631f28a9"></a>old easy structure templates<br />
|
|
<div class="outline-text-6" id="text-h:d112ed66-b2dd-45cc-8d70-9cf6631f28a9">
|
|
<ul class="org-ul">
|
|
<li><p>
|
|
org 9.2 changed the way structure templates work. This brings back the old way it worked.
|
|
</p>
|
|
|
|
<p>
|
|
Usage: Type <code><</code>, followed by one of the below keywords and press <code>RET</code>. The corresponding source block should appear.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(require 'org-tempo)
|
|
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
|
|
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
|
|
(add-to-list 'org-structure-template-alist '("py" . "src python :results output"))
|
|
(add-to-list 'org-structure-template-alist '("nix" . "src nix :tangle"))
|
|
|
|
</pre>
|
|
</div></li>
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
<li><a id="h:4696e2fc-3296-47dc-8fc3-66912c329d4c"></a>aucTex<br />
|
|
<div class="outline-text-5" id="text-h:4696e2fc-3296-47dc-8fc3-66912c329d4c">
|
|
<p>
|
|
This provides several utilities for LaTeX in Emacs, including many completions and convenience functions for math-mode.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package auctex)
|
|
(setq TeX-auto-save t)
|
|
(setq TeX-save-query nil)
|
|
(setq TeX-parse-self t)
|
|
(setq-default TeX-master nil)
|
|
|
|
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
|
|
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
|
|
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
|
|
(add-hook 'LaTeX-mode-hook 'reftex-mode)
|
|
(setq LaTeX-electric-left-right-brace t)
|
|
(setq font-latex-fontify-script nil)
|
|
(setq TeX-electric-sub-and-superscript t)
|
|
;; (setq reftex-plug-into-AUCTeX t)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:406e5ecb-66f0-49bf-85ca-8b499f73ec5b"></a>org-download<br />
|
|
<div class="outline-text-5" id="text-h:406e5ecb-66f0-49bf-85ca-8b499f73ec5b">
|
|
<p>
|
|
This package allows to download and copy images into org-mode buffers. Sadly it does not work in a very stable manner - if you copy images that are also links to another page (like is often the case in a Google image search), Emacs might crash from this.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package org-download
|
|
:after org
|
|
:defer nil
|
|
:custom
|
|
(org-download-method 'directory)
|
|
(org-download-image-dir "./images")
|
|
(org-download-heading-lvl 0)
|
|
(org-download-timestamp "org_%Y%m%d-%H%M%S_")
|
|
;;(org-image-actual-width 500)
|
|
(org-download-screenshot-method "grim -g \"$(slurp)\" %s")
|
|
:bind
|
|
("C-M-y" . org-download-screenshot)
|
|
:config
|
|
(require 'org-download))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:a02b1162-3e19-46f1-8efc-9f375971645c"></a>org-fragtog<br />
|
|
<div class="outline-text-5" id="text-h:a02b1162-3e19-46f1-8efc-9f375971645c">
|
|
<p>
|
|
This package automatically toggles LaTeX-fragments in org-files. It seems to also work in markdown-files which is a nice addition, as my Obsidian notes are held in markdown.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package org-fragtog)
|
|
(add-hook 'org-mode-hook 'org-fragtog-mode)
|
|
(add-hook 'markdown-mode-hook 'org-fragtog-mode)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:95b42e77-767c-4461-9ba8-b1c1cd18266c"></a>org-modern<br />
|
|
<div class="outline-text-5" id="text-h:95b42e77-767c-4461-9ba8-b1c1cd18266c">
|
|
<p>
|
|
This just makes org-mode a little bit more beautiful, mostly by making the <code>begin_src</code> and <code>end_src</code> tags in source-blocks turn into more beautiful icons, as well as hiding <code>#+</code> tags before them, as well as in the properties section of the file.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package org-modern
|
|
:config (setq org-modern-block-name
|
|
'((t . t)
|
|
("src" "»" "∥")))
|
|
:hook (org-mode . org-modern-mode))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:4e11a845-a7bb-4eb5-b4ce-5b2f52e07425"></a>Presentations<br />
|
|
<div class="outline-text-5" id="text-h:4e11a845-a7bb-4eb5-b4ce-5b2f52e07425">
|
|
<p>
|
|
Recently I have grown fond of holding presentations using Emacs :)
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package org-present
|
|
:bind (:map org-present-mode-keymap
|
|
("q" . org-present-quit)
|
|
("<left>" . swarsel/org-present-prev)
|
|
("<up>" . 'ignore)
|
|
("<down>" . 'ignore)
|
|
("<right>" . swarsel/org-present-next))
|
|
:hook ((org-present-mode . swarsel/org-present-start)
|
|
(org-present-mode-quit . swarsel/org-present-end))
|
|
)
|
|
|
|
|
|
(use-package hide-mode-line)
|
|
|
|
(defun swarsel/org-present-start ()
|
|
(setq-local face-remapping-alist '((default (:height 1.5) variable-pitch)
|
|
(header-line (:height 4.0) variable-pitch)
|
|
(org-document-title (:height 1.75) org-document-title)
|
|
(org-code (:height 1.55) org-code)
|
|
(org-verbatim (:height 1.55) org-verbatim)
|
|
(org-block (:height 1.25) org-block)
|
|
(org-block-begin-line (:height 0.7) org-block)
|
|
))
|
|
(dolist (face '((org-level-1 . 1.1)
|
|
(org-level-2 . 1.2)
|
|
(org-level-3 . 1.2)
|
|
(org-level-4 . 1.2)
|
|
(org-level-5 . 1.2)
|
|
(org-level-6 . 1.2)
|
|
(org-level-7 . 1.2)
|
|
(org-level-8 . 1.2)))
|
|
(set-face-attribute (car face) nil :font swarsel-alt-font :weight 'medium :height (cdr face)))
|
|
|
|
(setq header-line-format " ")
|
|
(setq visual-fill-column-width 90)
|
|
(setq indicate-buffer-boundaries nil)
|
|
(setq inhibit-message nil)
|
|
(breadcrumb-mode 0)
|
|
(org-display-inline-images)
|
|
(global-hl-line-mode 0)
|
|
(display-line-numbers-mode 0)
|
|
(org-modern-mode 0)
|
|
(evil-insert-state 1)
|
|
(beginning-of-buffer)
|
|
(org-present-read-only)
|
|
;; (org-present-hide-cursor)
|
|
(swarsel/org-present-slide)
|
|
)
|
|
|
|
(defun swarsel/org-present-end ()
|
|
(setq-local face-remapping-alist '((default variable-pitch default)))
|
|
(dolist (face '((org-level-1 . 1.1)
|
|
(org-level-2 . 0.9)
|
|
(org-level-3 . 0.9)
|
|
(org-level-4 . 0.9)
|
|
(org-level-5 . 0.9)
|
|
(org-level-6 . 0.9)
|
|
(org-level-7 . 0.9)
|
|
(org-level-8 . 0.9)))
|
|
(set-face-attribute (car face) nil :font swarsel-alt-font :weight 'medium :height (cdr face)))
|
|
(setq header-line-format nil)
|
|
(setq visual-fill-column-width 150)
|
|
(setq indicate-buffer-boundaries t)
|
|
(setq inhibit-message nil)
|
|
(breadcrumb-mode 1)
|
|
(global-hl-line-mode 1)
|
|
(display-line-numbers-mode 1)
|
|
(org-remove-inline-images)
|
|
(org-modern-mode 1)
|
|
(evil-normal-state 1)
|
|
;; (org-present-show-cursor)
|
|
)
|
|
|
|
(defun swarsel/org-present-slide ()
|
|
(org-overview)
|
|
(org-show-entry)
|
|
(org-show-children)
|
|
)
|
|
|
|
(defun swarsel/org-present-prev ()
|
|
(interactive)
|
|
(org-present-prev)
|
|
(swarsel/org-present-slide))
|
|
|
|
(defun swarsel/org-present-next ()
|
|
(interactive)
|
|
(unless (eobp)
|
|
(org-next-visible-heading 1)
|
|
(org-fold-show-entry))
|
|
(when (eobp)
|
|
(org-present-next)
|
|
(swarsel/org-present-slide)
|
|
))
|
|
|
|
(defun clojure-leave-clojure-mode-function ()
|
|
)
|
|
|
|
(add-hook 'buffer-list-update-hook #'clojure-leave-clojure-mode-function)
|
|
(add-hook 'org-present-mode-hook 'swarsel/org-present-start)
|
|
(add-hook 'org-present-mode-quit-hook 'swarsel/org-present-end)
|
|
(add-hook 'org-present-after-navigate-functions 'swarsel/org-present-slide)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:406c2ecc-0e3e-4d9f-9ae3-3eb1f8b87d1b" class="outline-4">
|
|
<h4 id="h:406c2ecc-0e3e-4d9f-9ae3-3eb1f8b87d1b"><span class="section-number-4">4.4.2.</span> Nix Mode</h4>
|
|
<div class="outline-text-4" id="text-h:406c2ecc-0e3e-4d9f-9ae3-3eb1f8b87d1b">
|
|
<p>
|
|
This adds a rudimentary nix-mode to Emacs. I have not really tried this out, as I am mostly editing nix-files in org-mode anyways.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package nix-mode
|
|
:mode "\\.nix\\'")
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-orgc3f7bff" class="outline-4">
|
|
<h4 id="orgc3f7bff"><span class="section-number-4">4.4.3.</span> nixpkgs-fmt</h4>
|
|
<div class="outline-text-4" id="text-4-4-3">
|
|
<p>
|
|
Adds functions for formatting nix code.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package nixpkgs-fmt)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:50327461-a11b-4e81-830a-90febc720cfa" class="outline-4">
|
|
<h4 id="h:50327461-a11b-4e81-830a-90febc720cfa"><span class="section-number-4">4.4.4.</span> Markdown Mode</h4>
|
|
<div class="outline-text-4" id="text-h:50327461-a11b-4e81-830a-90febc720cfa">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:734dc40a-a2c4-4839-b884-cb99b81aa6fe"></a>Mode<br />
|
|
<div class="outline-text-5" id="text-h:734dc40a-a2c4-4839-b884-cb99b81aa6fe">
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq markdown-command "pandoc")
|
|
|
|
(use-package markdown-mode
|
|
:ensure t
|
|
:mode ("README\\.md\\'" . gfm-mode)
|
|
:init (setq markdown-command "multimarkdown")
|
|
:bind (:map markdown-mode-map
|
|
("C-c C-e" . markdown-do)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:8d90fe51-0b32-423a-a159-4f853bc29b68"></a>LaTeX in Markdown<br />
|
|
<div class="outline-text-5" id="text-h:8d90fe51-0b32-423a-a159-4f853bc29b68">
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(add-hook 'markdown-mode-hook
|
|
(lambda ()
|
|
(local-set-key (kbd "C-c C-x C-l") 'org-latex-preview)
|
|
(local-set-key (kbd "C-c C-x C-u") 'markdown-toggle-url-hiding)
|
|
))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:65e69741-9860-4ed0-bbed-7b7be9a2a9d6" class="outline-4">
|
|
<h4 id="h:65e69741-9860-4ed0-bbed-7b7be9a2a9d6"><span class="section-number-4">4.4.5.</span> Olivetti</h4>
|
|
<div class="outline-text-4" id="text-h:65e69741-9860-4ed0-bbed-7b7be9a2a9d6">
|
|
<p>
|
|
Olivetti is a mode specialized for writing prose in Emacs. I went for a very simple setup with little distractions.
|
|
</p>
|
|
|
|
<p>
|
|
This mode is not automatically activated anywhere because I only rarely need it.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package olivetti
|
|
:init
|
|
(setq olivetti-body-width 100)
|
|
(setq olivetti-recall-visual-line-mode-entry-state t))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:94d4a0dc-b0d7-4702-b760-beeaa6da2b8f" class="outline-4">
|
|
<h4 id="h:94d4a0dc-b0d7-4702-b760-beeaa6da2b8f"><span class="section-number-4">4.4.6.</span> darkroom</h4>
|
|
<div class="outline-text-4" id="text-h:94d4a0dc-b0d7-4702-b760-beeaa6da2b8f">
|
|
<p>
|
|
Darkroom is package that reduces all forms of distraction to a minimum - this can be useful when simply reading a file for example. For this mode I have increased the text scale by a large margin to make for comfortable reading
|
|
This mode is not automatically activated anywhere because I only rarely need it.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package darkroom
|
|
:init
|
|
(setq darkroom-text-scale-increase 3))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:87453f1c-8ea5-4d0a-862d-8973d5bc5405" class="outline-4">
|
|
<h4 id="h:87453f1c-8ea5-4d0a-862d-8973d5bc5405"><span class="section-number-4">4.4.7.</span> Ripgrep</h4>
|
|
<div class="outline-text-4" id="text-h:87453f1c-8ea5-4d0a-862d-8973d5bc5405">
|
|
<p>
|
|
This is the ripgrep command for Emacs.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package rg)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:543641d0-02a9-459e-a2d6-96c8fcc06864" class="outline-4">
|
|
<h4 id="h:543641d0-02a9-459e-a2d6-96c8fcc06864"><span class="section-number-4">4.4.8.</span> Tree-sitter</h4>
|
|
<div class="outline-text-4" id="text-h:543641d0-02a9-459e-a2d6-96c8fcc06864">
|
|
<p>
|
|
Tree-sitter is a parsing library integrated into Emacs to provide better syntax highlighting and code analysis. It generates concrete syntax trees for source code, enabling more accurate and efficient text processing. Emacs' tree-sitter integration enhances language support, offering features like incremental parsing and precise syntax-aware editing. This improves the development experience by providing robust and dynamic syntax features, making it easier for me to navigate and manipulate code.
|
|
</p>
|
|
|
|
<p>
|
|
In order to update the language grammars, run the next command below.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(mapc #'treesit-install-language-grammar (mapcar #'car treesit-language-source-alist))
|
|
|
|
</pre>
|
|
</div>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package emacs
|
|
:ensure nil
|
|
:init
|
|
(setq treesit-language-source-alist
|
|
'((bash . ("https://github.com/tree-sitter/tree-sitter-bash"))
|
|
(c . ("https://github.com/tree-sitter/tree-sitter-c"))
|
|
(cmake . ("https://github.com/uyha/tree-sitter-cmake"))
|
|
(cpp . ("https://github.com/tree-sitter/tree-sitter-cpp"))
|
|
(css . ("https://github.com/tree-sitter/tree-sitter-css"))
|
|
(elisp . ("https://github.com/Wilfred/tree-sitter-elisp"))
|
|
(go . ("https://github.com/tree-sitter/tree-sitter-go"))
|
|
(html . ("https://github.com/tree-sitter/tree-sitter-html"))
|
|
(javascript . ("https://github.com/tree-sitter/tree-sitter-javascript"))
|
|
(json . ("https://github.com/tree-sitter/tree-sitter-json"))
|
|
(julia . ("https://github.com/tree-sitter/tree-sitter-julia"))
|
|
(latex . ("https://github.com/latex-lsp/tree-sitter-latex"))
|
|
(make . ("https://github.com/alemuller/tree-sitter-make"))
|
|
(markdown . ("https://github.com/ikatyang/tree-sitter-markdown"))
|
|
(R . ("https://github.com/r-lib/tree-sitter-r"))
|
|
(python . ("https://github.com/tree-sitter/tree-sitter-python"))
|
|
(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "typescript/src" "typescript"))
|
|
(rust . ("https://github.com/tree-sitter/tree-sitter-rust"))
|
|
(sql . ("https://github.com/m-novikov/tree-sitter-sql"))
|
|
(toml . ("https://github.com/tree-sitter/tree-sitter-toml"))
|
|
(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src"))
|
|
(yaml . ("https://github.com/ikatyang/tree-sitter-yaml"))))
|
|
)
|
|
|
|
(use-package treesit-auto
|
|
:config
|
|
(global-treesit-auto-mode)
|
|
(setq treesit-auto-install 'prompt))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:82ddeef2-99f8-465b-ba36-07c3eaad717b" class="outline-4">
|
|
<h4 id="h:82ddeef2-99f8-465b-ba36-07c3eaad717b"><span class="section-number-4">4.4.9.</span> direnv (envrc)</h4>
|
|
<div class="outline-text-4" id="text-h:82ddeef2-99f8-465b-ba36-07c3eaad717b">
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package direnv
|
|
:custom (direnv-always-show-summary nil)
|
|
:config (direnv-mode))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:efb3f0fd-e846-4df9-ba48-2e45d776f68f" class="outline-4">
|
|
<h4 id="h:efb3f0fd-e846-4df9-ba48-2e45d776f68f"><span class="section-number-4">4.4.10.</span> avy</h4>
|
|
<div class="outline-text-4" id="text-h:efb3f0fd-e846-4df9-ba48-2e45d776f68f">
|
|
<p>
|
|
<code>avy</code> provides the ability to search for any character on the screen (not only in the current buffer!) - I enjoy this utility a lot and use it possibly even more often than the native vim commands.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package avy
|
|
:bind
|
|
(("M-o" . avy-goto-char-timer))
|
|
:config
|
|
(setq avy-all-windows 'all-frames))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:1c1821c6-98de-4079-a4f3-6ba6e6dcb668" class="outline-4">
|
|
<h4 id="h:1c1821c6-98de-4079-a4f3-6ba6e6dcb668"><span class="section-number-4">4.4.11.</span> crdt (Collaborative Editing)</h4>
|
|
<div class="outline-text-4" id="text-h:1c1821c6-98de-4079-a4f3-6ba6e6dcb668">
|
|
<p>
|
|
With this it is possible to work on the same file collaboratively. I have never tried it out, but it sounds cool.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package crdt)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:d9a6cb44-736e-4608-951f-e928e1b757c0" class="outline-4">
|
|
<h4 id="h:d9a6cb44-736e-4608-951f-e928e1b757c0"><span class="section-number-4">4.4.12.</span> devdocs</h4>
|
|
<div class="outline-text-4" id="text-h:d9a6cb44-736e-4608-951f-e928e1b757c0">
|
|
<p>
|
|
<code>devdocs</code> is a very nice package that provides documentation from <a href="https:devdocs.io">https:devdocs.io</a>. This is very useful since e.g. <code>pyright</code> provides only a very bad documentation and I do not want to leave Emacs all the time just to read documentation.
|
|
</p>
|
|
|
|
<p>
|
|
To install a documentation, use the <code>devdocs=install</code> command and select the appropriate version. <code>devdocs-update-all</code> can be used to download and reinstall all installed documents if a newer version is available. Check documentation with <code>devdocs-lookup</code> (<code>C-SPC h d</code>).
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package devdocs)
|
|
|
|
(add-hook 'python-mode-hook
|
|
(lambda () (setq-local devdocs-current-docs '("python~3.12" "numpy~1.23" "matplotlib~3.7" "pandas~1"))))
|
|
(add-hook 'python-ts-mode-hook
|
|
(lambda () (setq-local devdocs-current-docs '("python~3.12" "numpy~1.23" "matplotlib~3.7" "pandas~1"))))
|
|
|
|
(add-hook 'c-mode-hook
|
|
(lambda () (setq-local devdocs-current-docs '("c"))))
|
|
(add-hook 'c-ts-mode-hook
|
|
(lambda () (setq-local devdocs-current-docs '("c"))))
|
|
|
|
(add-hook 'c++-mode-hook
|
|
(lambda () (setq-local devdocs-current-docs '("cpp"))))
|
|
(add-hook 'c++-ts-mode-hook
|
|
(lambda () (setq-local devdocs-current-docs '("cpp"))))
|
|
|
|
; (devdocs-update-all)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:5cde5032-251e-4cc4-9202-b4ce996f92c2" class="outline-4">
|
|
<h4 id="h:5cde5032-251e-4cc4-9202-b4ce996f92c2"><span class="section-number-4">4.4.13.</span> Projectile</h4>
|
|
<div class="outline-text-4" id="text-h:5cde5032-251e-4cc4-9202-b4ce996f92c2">
|
|
<p>
|
|
projectile is useful for keeping track of your git projects within Emacs. I mostly use it to quickly switch between projects.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package projectile
|
|
:diminish projectile-mode
|
|
:config (projectile-mode)
|
|
:custom ((projectile-completion-system 'auto)) ;; integrate ivy into completion system
|
|
:bind-keymap
|
|
("C-c p" . projectile-command-map) ; all projectile commands under this
|
|
:init
|
|
;; NOTE: Set this to the folder where you keep your Git repos!
|
|
(when (file-directory-p swarsel-projects-directory)
|
|
(setq projectile-project-search-path (list swarsel-projects-directory)))
|
|
(setq projectile-switch-project-action #'magit-status))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:d2c7323d-f8c6-4f23-b70a-930e3e4ecce5" class="outline-4">
|
|
<h4 id="h:d2c7323d-f8c6-4f23-b70a-930e3e4ecce5"><span class="section-number-4">4.4.14.</span> Magit</h4>
|
|
<div class="outline-text-4" id="text-h:d2c7323d-f8c6-4f23-b70a-930e3e4ecce5">
|
|
<p>
|
|
magit is the best git utility I have ever used - it has a beautiful interface and is very verbose. Here I mostly just setup the list of repositories that I want to expost to magit.
|
|
</p>
|
|
|
|
<p>
|
|
Also, Emacs needs a little extra love to accept my Yubikey for git commits etc. We also set that here.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package magit
|
|
:config
|
|
(setq magit-repository-directories `((,swarsel-projects-directory . 1)
|
|
(,swarsel-emacs-directory . 0)
|
|
(,swarsel-obsidian-directory . 0)
|
|
("~/.dotfiles/" . 0)))
|
|
:custom
|
|
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) ; stay in the same window
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:d78709dd-4f79-441c-9166-76f61f90359a" class="outline-4">
|
|
<h4 id="h:d78709dd-4f79-441c-9166-76f61f90359a"><span class="section-number-4">4.4.15.</span> Yubikey support</h4>
|
|
<div class="outline-text-4" id="text-h:d78709dd-4f79-441c-9166-76f61f90359a">
|
|
<p>
|
|
The following settings are needed to make sure emacs works for magit commits and pushes. It is not a beautiful solution since commiting uses pinentry-emacs and pushing uses pinentry-gtk2, but it works for now at least.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
|
|
;; yubikey support for pushing commits
|
|
;; commiting is enabled through nixos gpg-agent config
|
|
(use-package pinentry)
|
|
(pinentry-start)
|
|
(setq epg-pinentry-mode 'loopback)
|
|
(setenv "SSH_AUTH_SOCK" (string-chop-newline (shell-command-to-string "gpgconf --list-dirs agent-ssh-socket")))
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:1a8585ed-d9f2-478f-a132-440ada1cde2c" class="outline-4">
|
|
<h4 id="h:1a8585ed-d9f2-478f-a132-440ada1cde2c"><span class="section-number-4">4.4.16.</span> Forge</h4>
|
|
<div class="outline-text-4" id="text-h:1a8585ed-d9f2-478f-a132-440ada1cde2c">
|
|
<p>
|
|
NOTE: Make sure to configure a GitHub token before using this package!
|
|
</p>
|
|
<ul class="org-ul">
|
|
<li><a href="https://magit.vc/manual/forge/Token-Creation.html#Token-Creation">https://magit.vc/manual/forge/Token-Creation.html#Token-Creation</a></li>
|
|
<li><a href="https://magit.vc/manual/ghub/Getting-Started.html#Getting-Started">https://magit.vc/manual/ghub/Getting-Started.html#Getting-Started</a></li>
|
|
<li><a href="https://magit.vc/manual/ghub/Storing-a-Token.html">https://magit.vc/manual/ghub/Storing-a-Token.html</a></li>
|
|
<li><p>
|
|
<a href="https://www.emacswiki.org/emacs/GnuPG">https://www.emacswiki.org/emacs/GnuPG</a>
|
|
</p>
|
|
|
|
<p>
|
|
(1) in practice: github -<> settings -<> developer option -<>
|
|
create classic token with repo; user; read:org permissions
|
|
(2) install GnuGP (and add to PATH)
|
|
(3) create ~/.authinfo.gpg with the following info scheme:
|
|
machine api.github.com login USERNAME<sup>forge</sup> password 012345abcdef…
|
|
</p></li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package forge
|
|
:after magit)
|
|
|
|
(with-eval-after-load 'forge
|
|
(add-to-list 'forge-alist
|
|
'("sgit.iue.tuwien.ac.at"
|
|
"sgit.iue.tuwien.ac.at/api/v1"
|
|
"sgit.iue.tuwien.ac.at"
|
|
forge-gitea-repository)))
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:cf5b0e6b-56a5-4a93-99fb-258eb7cb2eb4" class="outline-4">
|
|
<h4 id="h:cf5b0e6b-56a5-4a93-99fb-258eb7cb2eb4"><span class="section-number-4">4.4.17.</span> git-timemachine</h4>
|
|
<div class="outline-text-4" id="text-h:cf5b0e6b-56a5-4a93-99fb-258eb7cb2eb4">
|
|
<p>
|
|
This is just a nice utility to browse different versions of a file of a git project within Emacs.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package git-timemachine
|
|
:hook (git-time-machine-mode . evil-normalize-keymaps)
|
|
:init (setq git-timemachine-show-minibuffer-details t))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:d9671ab7-a75a-47c6-a1f4-376d126c9b0a" class="outline-4">
|
|
<h4 id="h:d9671ab7-a75a-47c6-a1f4-376d126c9b0a"><span class="section-number-4">4.4.18.</span> Delimiters (brackets): rainbow-delimiters, highlight-parentheses</h4>
|
|
<div class="outline-text-4" id="text-h:d9671ab7-a75a-47c6-a1f4-376d126c9b0a">
|
|
<ul class="org-ul">
|
|
<li>rainbow-delimiters colors all delimiters, also ones not in current selection</li>
|
|
<li>paren highlights the current delimiter selection especially bold</li>
|
|
<li>highlight-parentheses boldly highlights all delimiters in current selection</li>
|
|
</ul>
|
|
|
|
<p>
|
|
I am not completely sure on electric-pair-mode yet, sometimes it is very helpful, sometimes it annoys me to no end.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package rainbow-delimiters
|
|
:hook (prog-mode . rainbow-delimiters-mode))
|
|
|
|
(use-package highlight-parentheses
|
|
:config
|
|
(setq highlight-parentheses-colors '("black" "white" "black" "black" "black" "black" "black"))
|
|
(setq highlight-parentheses-background-colors '("magenta" "blue" "cyan" "green" "yellow" "orange" "red"))
|
|
(global-highlight-parentheses-mode t))
|
|
|
|
(electric-pair-mode 1)
|
|
(setq electric-pair-preserve-balance t)
|
|
(setq electric-pair-skip-self nil)
|
|
(setq electric-pair-delete-adjacent-pairs t)
|
|
;; don't skip newline when auto-pairing parenthesis
|
|
(setq electric-pair-skip-whitespace-chars '(9 32))
|
|
|
|
;; in org-mode buffers, do not pair < and > in order not to interfere with org-tempo
|
|
(add-hook 'org-mode-hook (lambda ()
|
|
(setq-local electric-pair-inhibit-predicate
|
|
`(lambda (c)
|
|
(if (char-equal c ?<) t (,electric-pair-inhibit-predicate c))))))
|
|
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:d1a32a69-2f9a-45ef-95fe-a00e3551dc94" class="outline-4">
|
|
<h4 id="h:d1a32a69-2f9a-45ef-95fe-a00e3551dc94"><span class="section-number-4">4.4.19.</span> rainbow-mode</h4>
|
|
<div class="outline-text-4" id="text-h:d1a32a69-2f9a-45ef-95fe-a00e3551dc94">
|
|
<p>
|
|
Complimentary to the delimiters-packages above, this package sets the background color of the delimiters, which makes it easier to see at a glance where we are in a delimiter-tree.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package rainbow-mode
|
|
:config (rainbow-mode))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:5653d693-ecca-4c95-9633-66b9e3241070" class="outline-4">
|
|
<h4 id="h:5653d693-ecca-4c95-9633-66b9e3241070"><span class="section-number-4">4.4.20.</span> Corfu</h4>
|
|
<div class="outline-text-4" id="text-h:5653d693-ecca-4c95-9633-66b9e3241070">
|
|
<p>
|
|
This is the company equivalent to the vertico gang.
|
|
I dislike the standard behaviour that makes the cursor move into the completion framework on presses of <code><up></code> and <code><down></code>.
|
|
</p>
|
|
|
|
<p>
|
|
Nerd icons is originally enabled here: <a href="#h:eb0ea526-a83a-4664-b3a1-2b40d3a31493">Icons</a>
|
|
</p>
|
|
|
|
<p>
|
|
Navigation functions defined here: <a href="#h:a1802f9b-bb71-4fd5-86fa-945da18e8b81">corfu: Do not interrupt navigation</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; (use-package corfu
|
|
;; :custom
|
|
;; (corfu-cycle t)
|
|
;; :init
|
|
;; (global-corfu-mode))
|
|
|
|
(use-package corfu
|
|
:init
|
|
(global-corfu-mode)
|
|
(corfu-history-mode)
|
|
(corfu-popupinfo-mode) ; Popup completion info
|
|
:custom
|
|
(corfu-auto t)
|
|
(corfu-auto-prefix 3)
|
|
(corfu-auto-delay 0.3)
|
|
(corfu-cycle t)
|
|
(corfu-quit-no-match 'separator)
|
|
(corfu-separator ?\s)
|
|
;; (corfu-quit-no-match t)
|
|
(corfu-popupinfo-max-height 70)
|
|
(corfu-popupinfo-delay '(0.5 . 0.2))
|
|
;; (corfu-preview-current 'insert) ; insert previewed candidate
|
|
(corfu-preselect 'prompt)
|
|
(corfu-on-exact-match nil) ; Don't auto expand tempel snippets
|
|
;; Optionally use TAB for cycling, default is `corfu-complete'.
|
|
:bind (:map corfu-map
|
|
("M-SPC" . corfu-insert-separator)
|
|
("<return>" . swarsel/corfu-normal-return)
|
|
;; ("C-<return>" . swarsel/corfu-complete)
|
|
("S-<up>" . corfu-popupinfo-scroll-down)
|
|
("S-<down>" . corfu-popupinfo-scroll-up)
|
|
("C-<up>" . corfu-previous)
|
|
("C-<down>" . corfu-next)
|
|
("<insert-state> <up>" . swarsel/corfu-quit-and-up)
|
|
("<insert-state> <down>" . swarsel/corfu-quit-and-down))
|
|
)
|
|
|
|
(use-package nerd-icons-corfu)
|
|
|
|
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)
|
|
|
|
(setq nerd-icons-corfu-mapping
|
|
'((array :style "cod" :icon "symbol_array" :face font-lock-type-face)
|
|
(boolean :style "cod" :icon "symbol_boolean" :face font-lock-builtin-face)
|
|
;; ...
|
|
(t :style "cod" :icon "code" :face font-lock-warning-face)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:c3cc1c12-3ab8-42b7-be07-63f54eac397f" class="outline-4">
|
|
<h4 id="h:c3cc1c12-3ab8-42b7-be07-63f54eac397f"><span class="section-number-4">4.4.21.</span> cape</h4>
|
|
<div class="outline-text-4" id="text-h:c3cc1c12-3ab8-42b7-be07-63f54eac397f">
|
|
<p>
|
|
cape adds even more completion capabilities by adding a lot of completion logic that is exposed as separate functions. I tried out adding these to the <code>completion-at-points-functions</code> alist, but I felt like it cluttered my suggestions too much. Hence I now just call the respective functions when I need them. For this I setup the <code>C-z</code> keybinding in <a href="#h:218376e8-086b-46bf-91b3-78295d5d440f">General evil</a>.
|
|
</p>
|
|
|
|
<p>
|
|
I leave the commented out alist extensions here in case I want to try them out at some point in the future.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package cape
|
|
:bind
|
|
("C-z p" . completion-at-point) ;; capf
|
|
("C-z t" . complete-tag) ;; etags
|
|
("C-z d" . cape-dabbrev) ;; or dabbrev-completion
|
|
("C-z h" . cape-history)
|
|
("C-z f" . cape-file)
|
|
("C-z k" . cape-keyword)
|
|
("C-z s" . cape-elisp-symbol)
|
|
("C-z e" . cape-elisp-block)
|
|
("C-z a" . cape-abbrev)
|
|
("C-z l" . cape-line)
|
|
("C-z w" . cape-dict)
|
|
("C-z :" . cape-emoji)
|
|
("C-z \\" . cape-tex)
|
|
("C-z _" . cape-tex)
|
|
("C-z ^" . cape-tex)
|
|
("C-z &" . cape-sgml)
|
|
("C-z r" . cape-rfc1345)
|
|
;; Add to the global default value of `completion-at-point-functions' which is
|
|
;; used by `completion-at-point'. The order of the functions matters, the
|
|
;; first function returning a result wins. Note that the list of buffer-local
|
|
;; completion functions takes precedence over the global list.
|
|
;; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-file)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-elisp-block)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-history)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-keyword)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-tex)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-sgml)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-rfc1345)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-abbrev)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-dict)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-elisp-symbol)
|
|
;; (add-to-list 'completion-at-point-functions #'cape-line)
|
|
)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:3aa20438-edf6-4b13-a90d-3d5c51239c44" class="outline-4">
|
|
<h4 id="h:3aa20438-edf6-4b13-a90d-3d5c51239c44"><span class="section-number-4">4.4.22.</span> rust</h4>
|
|
<div class="outline-text-4" id="text-h:3aa20438-edf6-4b13-a90d-3d5c51239c44">
|
|
<p>
|
|
This sets up rustic-mode with tree-sitter support - there is still one issue to iron out with automatic adding of dependency crates, but everything else works fine now.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package rustic
|
|
:init
|
|
(setq rust-mode-treesitter-derive t)
|
|
:config
|
|
(define-key rust-ts-mode-map (kbd "C-c C-c C-r") 'rustic-cargo-run)
|
|
(define-key rust-ts-mode-map (kbd "C-c C-c C-b") 'rustic-cargo-build)
|
|
(define-key rust-ts-mode-map (kbd "C-c C-c C-k") 'rustic-cargo-check)
|
|
(define-key rust-ts-mode-map (kbd "C-c C-c d") 'rustic-cargo-doc)
|
|
(define-key rust-ts-mode-map (kbd "C-c C-c a") 'rustic-cargo-add)
|
|
(setq rustic-format-on-save t)
|
|
(setq rustic-lsp-client 'eglot)
|
|
:mode ("\\.rs" . rustic-mode))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:b9b27a88-06f3-470b-a604-a20b2079bc26" class="outline-4">
|
|
<h4 id="h:b9b27a88-06f3-470b-a604-a20b2079bc26"><span class="section-number-4">4.4.23.</span> Tramp</h4>
|
|
<div class="outline-text-4" id="text-h:b9b27a88-06f3-470b-a604-a20b2079bc26">
|
|
<p>
|
|
Tramp allows for SSH access of files over Emacs. I have no ideas what the options here mean, but this is a recommended configuration that I found (sadly I lost the link). I need to research more what these options really do.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
|
|
|
|
(use-package tramp
|
|
:init
|
|
(setq vc-ignore-dir-regexp
|
|
(format "\\(%s\\)\\|\\(%s\\)"
|
|
vc-ignore-dir-regexp
|
|
tramp-file-name-regexp))
|
|
(setq tramp-default-method "ssh")
|
|
(setq tramp-auto-save-directory
|
|
(expand-file-name "tramp-auto-save" user-emacs-directory))
|
|
(setq tramp-persistency-file-name
|
|
(expand-file-name "tramp-connection-history" user-emacs-directory))
|
|
(setq password-cache-expiry nil)
|
|
(setq tramp-use-ssh-controlmaster-options nil)
|
|
(setq remote-file-name-inhibit-cache nil)
|
|
:config
|
|
(customize-set-variable 'tramp-ssh-controlmaster-options
|
|
(concat
|
|
"-o ControlPath=/tmp/ssh-tramp-%%r@%%h:%%p "
|
|
"-o ControlMaster=auto -o ControlPersist=yes"))
|
|
)
|
|
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:58415e95-8a7a-4517-acbb-5f1bb1028603" class="outline-4">
|
|
<h4 id="h:58415e95-8a7a-4517-acbb-5f1bb1028603"><span class="section-number-4">4.4.24.</span> diff-hl</h4>
|
|
<div class="outline-text-4" id="text-h:58415e95-8a7a-4517-acbb-5f1bb1028603">
|
|
<p>
|
|
This is a simple highlighting utility that uses the margin to visually show the differences since the last git commit.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package diff-hl
|
|
:hook
|
|
((prog-mode
|
|
org-mode) . diff-hl-mode)
|
|
:init
|
|
(diff-hl-flydiff-mode)
|
|
(diff-hl-margin-mode)
|
|
(diff-hl-show-hunk-mouse-mode))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:d60ce0b1-cabf-43f5-a236-a1e4b400d2f5" class="outline-4">
|
|
<h4 id="h:d60ce0b1-cabf-43f5-a236-a1e4b400d2f5"><span class="section-number-4">4.4.25.</span> Commenting</h4>
|
|
<div class="outline-text-4" id="text-h:d60ce0b1-cabf-43f5-a236-a1e4b400d2f5">
|
|
<p>
|
|
This package allows for swift commenting out and in of code snippets. For some reason, it is a bit broken in my config, as it sometimes comments out too much, sometimes too little, and sometimes it splits lines during commenting. Also, in org-mode when inside a src-block, it often times jumps to the top of the block.
|
|
</p>
|
|
|
|
<p>
|
|
Still, this is avery convenient package.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package evil-nerd-commenter
|
|
:bind ("M-/" . evilnc-comment-or-uncomment-lines))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:9ec11ee4-2250-414a-87b5-73ee680a3a4a" class="outline-4">
|
|
<h4 id="h:9ec11ee4-2250-414a-87b5-73ee680a3a4a"><span class="section-number-4">4.4.26.</span> yasnippet</h4>
|
|
<div class="outline-text-4" id="text-h:9ec11ee4-2250-414a-87b5-73ee680a3a4a">
|
|
<p>
|
|
yasnippet allows to define snippets that can be quickly expanded by hitting the <code>TAB</code> key after inputting a keyword.
|
|
</p>
|
|
|
|
<p>
|
|
I used to run this together with the <code>yasnippet-snippets</code> package, but the snippets in there I did not find all too useful for myself. I need to create some custom snippets here one day.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package yasnippet
|
|
:init (yas-global-mode 1)
|
|
:config
|
|
(yas-reload-all))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:af0a78a5-17c2-4e13-b64a-772c27c4dee2"></a>yasnippet math-snippets<br />
|
|
<div class="outline-text-6" id="text-h:af0a78a5-17c2-4e13-b64a-772c27c4dee2">
|
|
<p>
|
|
The following block is mostly inspired from <a href="https://code.kulupu.party/thesuess/WTFmacs/">https://code.kulupu.party/thesuess/WTFmacs/</a> and sets up a few prefixes that make LaTeX-math-mode nicer to use even with auctex and cape enabled.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
|
|
(setq wtf/latex-mathbb-prefix "''")
|
|
(setq swarsel/latex-mathcal-prefix "``")
|
|
|
|
(use-package yasnippet
|
|
:config
|
|
|
|
(setq wtf/english-alphabet
|
|
'("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"))
|
|
|
|
(dolist (elem wtf/english-alphabet)
|
|
(when (string-equal elem (downcase elem))
|
|
(add-to-list 'wtf/english-alphabet (upcase elem))))
|
|
|
|
|
|
(yas-define-snippets
|
|
'latex-mode
|
|
(mapcar
|
|
(lambda (elem)
|
|
(list (concat wtf/latex-mathbb-prefix elem) (concat "\\mathbb{" elem "}") (concat "Mathbb letter " elem)))
|
|
wtf/english-alphabet))
|
|
|
|
(yas-define-snippets
|
|
'latex-mode
|
|
(mapcar
|
|
(lambda (elem)
|
|
(list (concat swarsel/latex-mathcal-prefix elem) (concat "\\mathcal{" elem "}") (concat "Mathcal letter " elem)))
|
|
wtf/english-alphabet))
|
|
|
|
(setq swtf/latex-math-symbols
|
|
'(("x" . "\\times")
|
|
("*" . "\\cdot")
|
|
("." . "\\ldots")
|
|
("op" . "\\operatorname{$1}$0")
|
|
("o" . "\\circ")
|
|
("V" . "\\forall")
|
|
("v" . "\\vee")
|
|
("w" . "\\wedge")
|
|
("q" . "\\quad")
|
|
("f" . "\\frac{$1}{$2}$0")
|
|
("s" . "\\sum_{$1}^{$2}$0")
|
|
("p" . "\\prod_{$1}^{$2}$0")
|
|
("e" . "\\exists")
|
|
("i" . "\\int_{$1}^{$2}$0")
|
|
("c" . "\\cap")
|
|
("u" . "\\cup")
|
|
("0" . "\\emptyset")))
|
|
|
|
)
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:316857e7-4df8-4ec5-b22e-6dac918fa937" class="outline-4">
|
|
<h4 id="h:316857e7-4df8-4ec5-b22e-6dac918fa937"><span class="section-number-4">4.4.27.</span> eglot</h4>
|
|
<div class="outline-text-4" id="text-h:316857e7-4df8-4ec5-b22e-6dac918fa937">
|
|
<p>
|
|
After having tried out <code>lsp-mode</code> and <code>lsp-bridge</code> for a while each, I must say that <code>eglot</code> feels the most clean and fast to me.
|
|
</p>
|
|
|
|
<p>
|
|
:CUSTOM<sub>ID</sub>: h:424fbc62-84e2-42c7-a1ca-e43ea04c43e5
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package eglot
|
|
:ensure nil
|
|
:hook
|
|
((python-mode
|
|
python-ts-mode
|
|
c-mode
|
|
c-ts-mode
|
|
c++-mode
|
|
c++-ts-mode
|
|
rust-ts-mode
|
|
rustic-mode
|
|
tex-mode
|
|
LaTeX-mode
|
|
) . (lambda () (progn
|
|
(eglot-ensure)
|
|
(add-hook 'before-save-hook 'eglot-format nil 'local))))
|
|
:custom
|
|
(eldoc-echo-area-use-multiline-p nil)
|
|
(completion-category-defaults nil)
|
|
:bind (:map eglot-mode-map
|
|
("M-(" . flymake-goto-next-error)
|
|
("C-c ," . eglot-code-actions)))
|
|
|
|
(defalias 'start-lsp-server #'eglot)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:1de35f27-335d-4cbd-beb6-f85cf5496173" class="outline-4">
|
|
<h4 id="h:1de35f27-335d-4cbd-beb6-f85cf5496173"><span class="section-number-4">4.4.28.</span> Breadcrumb</h4>
|
|
<div class="outline-text-4" id="text-h:1de35f27-335d-4cbd-beb6-f85cf5496173">
|
|
<p>
|
|
This simple shows the path to the current file on the top of the buffer - I just think it looks kind of neat, even though it is not extremely useful :)
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package breadcrumb
|
|
:config (breadcrumb-mode))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:e9a30d0f-423f-4e85-af4b-f8560f1c1b53" class="outline-4">
|
|
<h4 id="h:e9a30d0f-423f-4e85-af4b-f8560f1c1b53"><span class="section-number-4">4.4.29.</span> Prevent breaking of hardlinks</h4>
|
|
<div class="outline-text-4" id="text-h:e9a30d0f-423f-4e85-af4b-f8560f1c1b53">
|
|
<p>
|
|
This setting ensures that hard links are preserved during the backup process, which is useful for maintaining the integrity of files that are linked in multiple locations.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(setq backup-by-copying-when-linked t)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:0918557a-8463-430c-b8df-6546dea9abd0" class="outline-4">
|
|
<h4 id="h:0918557a-8463-430c-b8df-6546dea9abd0"><span class="section-number-4">4.4.30.</span> Dirvish</h4>
|
|
<div class="outline-text-4" id="text-h:0918557a-8463-430c-b8df-6546dea9abd0">
|
|
<p>
|
|
Dirvish is an improvement upon the dired-framework and has more features like file preview etc. Sadly it has an incompatibility with <code>openwith</code> which is why I have disabled that package.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package dirvish
|
|
:init
|
|
(dirvish-override-dired-mode)
|
|
:config
|
|
(dirvish-peek-mode)
|
|
(dirvish-side-follow-mode)
|
|
(setq dirvish-open-with-programs
|
|
(append dirvish-open-with-programs '(
|
|
(("xlsx" "docx" "doc" "odt" "ods") "libreoffice" "%f")
|
|
(("jpg" "jpeg" "png") "imv" "%f")
|
|
(("pdf") "sioyek" "%f")
|
|
(("xopp") "xournalpp" "%f"))))
|
|
:custom
|
|
(delete-by-moving-to-trash t)
|
|
(dired-listing-switches
|
|
"-l --almost-all --human-readable --group-directories-first --no-group")
|
|
(dirvish-attributes
|
|
'(vc-state subtree-state nerd-icons collapse file-time file-size))
|
|
(dirvish-quick-access-entries
|
|
'(("h" "~/" "Home")
|
|
("c" "~/.dotfiles/" "Config")
|
|
("d" "~/Downloads/" "Downloads")
|
|
("D" "~/Documents/" "Documents")
|
|
("p" "~/Documents/GitHub/" "Projects")
|
|
("/" "/" "Root")))
|
|
:bind
|
|
(("<DUMMY-i> d" . 'dirvish)
|
|
("C-=" . 'dirvish-side)
|
|
:map dirvish-mode-map
|
|
("h" . dired-up-directory)
|
|
("<left>" . dired-up-directory)
|
|
("l" . dired-find-file)
|
|
("<right>" . dired-find-file)
|
|
("j" . evil-next-visual-line)
|
|
("k" . evil-previous-visual-line)
|
|
("a" . dirvish-quick-access)
|
|
("f" . dirvish-file-info-menu)
|
|
("z" . dirvish-history-last)
|
|
("J" . dirvish-history-jump)
|
|
("y" . dirvish-yank-menu)
|
|
("/" . dirvish-narrow)
|
|
("TAB" . dirvish-subtree-toggle)
|
|
("M-f" . dirvish-history-go-forward)
|
|
("M-b" . dirvish-history-go-backward)
|
|
("M-l" . dirvish-ls-switches-menu)
|
|
("M-m" . dirvish-mark-menu)
|
|
("M-t" . dirvish-layout-toggle)
|
|
("M-s" . dirvish-setup-menu)
|
|
("M-e" . dirvish-emerge-menu)
|
|
("M-j" . dirvish-fd-jump)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:b108dd3e-f34d-4ed3-98df-0bf9de055889" class="outline-4">
|
|
<h4 id="h:b108dd3e-f34d-4ed3-98df-0bf9de055889"><span class="section-number-4">4.4.31.</span> pdf-tools: pdf-viewer and support for dirvish</h4>
|
|
<div class="outline-text-4" id="text-h:b108dd3e-f34d-4ed3-98df-0bf9de055889">
|
|
<p>
|
|
This enables pdf-previewing in dirvish and gives a much better pdf-viewer than is shipped normally by emacs.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package pdf-tools
|
|
:init
|
|
(if (not (boundp 'pdf-tools-directory))
|
|
(pdf-tools-install))
|
|
:mode ("\\.pdf" . pdf-view-mode))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:c15efae7-b884-4c97-8367-ccc7e7ed9ba8" class="outline-4">
|
|
<h4 id="h:c15efae7-b884-4c97-8367-ccc7e7ed9ba8"><span class="section-number-4">4.4.32.</span> Jupyter</h4>
|
|
<div class="outline-text-4" id="text-h:c15efae7-b884-4c97-8367-ccc7e7ed9ba8">
|
|
<p>
|
|
This is a jupyter client. Using it is a bit cumbersome though, so I have not fully explored all features.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package ein)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:1fc538d1-8c53-48b2-8652-66046f4bbbf8" class="outline-4">
|
|
<h4 id="h:1fc538d1-8c53-48b2-8652-66046f4bbbf8"><span class="section-number-4">4.4.33.</span> undo-tree</h4>
|
|
<div class="outline-text-4" id="text-h:1fc538d1-8c53-48b2-8652-66046f4bbbf8">
|
|
<p>
|
|
Base emacs undo logic is very useful, but not easy to understand for me. I prefer undo-tree, which makes switching between branches easier and also allows quickly switching back to a much older state using the visualizer.
|
|
</p>
|
|
|
|
<p>
|
|
Evil needs to be told to use this mode, see <code>(evil-set-undo-system 'undo-tree)</code> in <a href="#h:218376e8-086b-46bf-91b3-78295d5d440f">Evil/General.</a>
|
|
</p>
|
|
|
|
<p>
|
|
By default, I am not using undo-tree-mode in every buffer. This might change in the future, but for now this is fine. It can be enabled manually should the need arise.
|
|
</p>
|
|
|
|
<p>
|
|
While we are at it, we are also setting up a persistent undo-file for every file that we are working with.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package undo-tree
|
|
;; :init (global-undo-tree-mode)
|
|
:bind (:map undo-tree-visualizer-mode-map
|
|
("h" . undo-tree-visualize-switch-branch-left)
|
|
("l" . undo-tree-visualize-switch-branch-left)
|
|
("j" . undo-tree-visualize-redo)
|
|
("k" . undo-tree-visualize-undo))
|
|
:config
|
|
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo"))))
|
|
|
|
(add-hook 'prog-mode-hook 'undo-tree-mode)
|
|
(add-hook 'text-mode-hook 'undo-tree-mode)
|
|
(add-hook 'org-mode-hook 'undo-tree-mode)
|
|
(add-hook 'latex-mode-hook 'undo-tree-mode)
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:b6c18dd0-3377-47ea-80c3-ac1486454e18" class="outline-4">
|
|
<h4 id="h:b6c18dd0-3377-47ea-80c3-ac1486454e18"><span class="section-number-4">4.4.34.</span> Hydra</h4>
|
|
<div class="outline-text-4" id="text-h:b6c18dd0-3377-47ea-80c3-ac1486454e18">
|
|
<p>
|
|
Hydra allows for the writing of macro-style functions. I have not yet looked into this all too much, but it seems to be a potent feature.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package hydra)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:c5681884-7040-4b55-ab1b-5777631a0514"></a>Text scaling<br />
|
|
<div class="outline-text-5" id="text-h:c5681884-7040-4b55-ab1b-5777631a0514">
|
|
<p>
|
|
I only wrote this in order to try out hydra; rarely do I really need this. However, it can be useful for <a href="#h:4e11a845-a7bb-4eb5-b4ce-5b2f52e07425">Presentations</a>. It simply scales the text size.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
|
|
;; change the text size of the current buffer
|
|
(defhydra hydra-text-scale (:timeout 4)
|
|
"scale text"
|
|
("j" text-scale-increase "in")
|
|
("k" text-scale-decrease "out")
|
|
("f" nil "finished" :exit t))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:fff816a0-6d70-4bda-abab-833345e51100" class="outline-4">
|
|
<h4 id="h:fff816a0-6d70-4bda-abab-833345e51100"><span class="section-number-4">4.4.35.</span> External Applications</h4>
|
|
<div class="outline-text-4" id="text-h:fff816a0-6d70-4bda-abab-833345e51100">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:9335d32d-bf08-4601-820d-f3d1f33f876f"></a>Obsidian<br />
|
|
<div class="outline-text-5" id="text-h:9335d32d-bf08-4601-820d-f3d1f33f876f">
|
|
<p>
|
|
This provides an interface to Obsidian for Emacs - as much as I want to like it, I actually enjoy using the official Obsidian app more - even though that cannot be used by Emacs directly.
|
|
</p>
|
|
|
|
<p>
|
|
My workflow for Obsidian is now as follows:
|
|
</p>
|
|
|
|
<ol class="org-ol">
|
|
<li>create notes either in Emacs or Obsidian</li>
|
|
<li><p>
|
|
look at them in the official client
|
|
</p>
|
|
|
|
<p>
|
|
I hope that this package will improve, then I will come back to it one day.
|
|
</p></li>
|
|
</ol>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; (use-package obsidian
|
|
;; :ensure t
|
|
;; :demand t
|
|
;; :config
|
|
;; (obsidian-specify-path swarsel-obsidian-vault-directory)
|
|
;; (global-obsidian-mode t)
|
|
;; :custom
|
|
;; ;; This directory will be used for `obsidian-capture' if set.
|
|
;; (obsidian-inbox-directory "Inbox")
|
|
;; (bind-key (kbd "C-c M-o") 'obsidian-hydra/body 'obsidian-mode-map)
|
|
;; :bind (:map obsidian-mode-map
|
|
;; ;; Replace C-c C-o with Obsidian.el's implementation. It's ok to use another key binding.
|
|
;; ("C-c C-o" . obsidian-follow-link-at-point)
|
|
;; ;; Jump to backlinks
|
|
;; ("C-c C-b" . obsidian-backlink-jump)
|
|
;; ;; If you prefer you can use `obsidian-insert-link'
|
|
;; ("C-c C-l" . obsidian-insert-wikilink)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:5854c9a6-1319-4961-a112-75b1bf2e1f69"></a>Anki<br />
|
|
<div class="outline-text-5" id="text-h:5854c9a6-1319-4961-a112-75b1bf2e1f69">
|
|
<p>
|
|
This section is here to make Anki usable from within Emacs - an endeavour that I have mostly given up on.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:d20559ed-7ada-4fea-a964-33bfd64b4549"></a>Basic Anki setup<br />
|
|
<div class="outline-text-6" id="text-h:d20559ed-7ada-4fea-a964-33bfd64b4549">
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; (use-package anki-editor
|
|
;; :after org
|
|
;; :bind (:map org-mode-map
|
|
;; ("<f12>" . anki-editor-cloze-region-auto-incr)
|
|
;; ("<f11>" . anki-editor-cloze-region-dont-incr)
|
|
;; ("<f10>" . anki-editor-reset-cloze-number)
|
|
;; ("<f9>" . anki-editor-push-tree))
|
|
;; :hook (org-capture-after-finalize . anki-editor-reset-cloze-number) ; Reset cloze-number after each capture.
|
|
;; :config
|
|
;; (setq anki-editor-create-decks t ;; Allow anki-editor to create a new deck if it doesn't exist
|
|
;; anki-editor-org-tags-as-anki-tags t)
|
|
|
|
;; (defun anki-editor-cloze-region-auto-incr (&optional arg)
|
|
;; "Cloze region without hint and increase card number."
|
|
;; (interactive)
|
|
;; (anki-editor-cloze-region swarsel-anki-editor-cloze-number "")
|
|
;; (setq swarsel-anki-editor-cloze-number (1+ swarsel-anki-editor-cloze-number))
|
|
;; (forward-sexp))
|
|
;; (defun anki-editor-cloze-region-dont-incr (&optional arg)
|
|
;; "Cloze region without hint using the previous card number."
|
|
;; (interactive)
|
|
;; (anki-editor-cloze-region (1- swarsel-anki-editor-cloze-number) "")
|
|
;; (forward-sexp))
|
|
;; (defun anki-editor-reset-cloze-number (&optional arg)
|
|
;; "Reset cloze number to ARG or 1"
|
|
;; (interactive)
|
|
;; (setq swarsel-anki-editor-cloze-number (or arg 1)))
|
|
;; (defun anki-editor-push-tree ()
|
|
;; "Push all notes under a tree."
|
|
;; (interactive)
|
|
;; (anki-editor-push-notes '(4))
|
|
;; (anki-editor-reset-cloze-number))
|
|
;; ;; Initialize
|
|
;; (anki-editor-reset-cloze-number)
|
|
;; )
|
|
|
|
;; (require 'anki-editor)
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:64242e95-6454-4330-bcb9-15353083bade"></a>Own Anki functions<br />
|
|
<div class="outline-text-6" id="text-h:64242e95-6454-4330-bcb9-15353083bade">
|
|
<ul class="org-ul">
|
|
<li>These functions enable you to quickly set the destination note type and deck</li>
|
|
</ul>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; (defvar swarsel-anki-deck nil)
|
|
;; (defvar swarsel-anki-notetype nil)
|
|
;; (defvar swarsel-anki-fields nil)
|
|
|
|
;; (defun swarsel-anki-set-deck-and-notetype ()
|
|
;; (interactive)
|
|
;; (setq swarsel-anki-deck (completing-read "Choose a deck: "
|
|
;; (sort (anki-editor-deck-names) #'string-lessp)))
|
|
;; (setq swarsel-anki-notetype (completing-read "Choose a note type: "
|
|
;; (sort (anki-editor-note-types) #'string-lessp)))
|
|
;; (setq swarsel-anki-fields (progn
|
|
;; (anki-editor--anki-connect-invoke-result "modelFieldNames" `((modelName . ,swarsel-anki-notetype)))))
|
|
;; )
|
|
|
|
;; (defun swarsel-anki-make-template-string ()
|
|
;; (if (not swarsel-anki-deck)
|
|
;; (call-interactively 'swarsel-anki-set-deck-and-notetype))
|
|
;; (setq swarsel-temp swarsel-anki-fields)
|
|
;; (concat (concat "* %<%H:%M>\n:PROPERTIES:\n:ANKI_NOTE_TYPE: " swarsel-anki-notetype "\n:ANKI_DECK: " swarsel-anki-deck "\n:END:\n** ")(pop swarsel-temp) "\n%?\n** " (mapconcat 'identity swarsel-temp "\n\n** ") "\n\n"))
|
|
|
|
;; (defun swarsel-today()
|
|
;; (format-time-string "%Y-%m-%d"))
|
|
|
|
;; (defun swarsel-obsidian-daily ()
|
|
;; (interactive)
|
|
;; (if (not (file-exists-p (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory)))
|
|
;; (write-region "" nil (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory))
|
|
;; )
|
|
;; (find-file (expand-file-name (concat (swarsel-today) ".md") swarsel-obsidian-daily-directory)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:2f333330-b19d-4f64-85ea-146ff28667e8" class="outline-4">
|
|
<h4 id="h:2f333330-b19d-4f64-85ea-146ff28667e8"><span class="section-number-4">4.4.36.</span> Email</h4>
|
|
<div class="outline-text-4" id="text-h:2f333330-b19d-4f64-85ea-146ff28667e8">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:48fde614-7cd0-4764-a7ac-0dae60d8b65a"></a>make sure mu4e is found<br />
|
|
<div class="outline-text-5" id="text-h:48fde614-7cd0-4764-a7ac-0dae60d8b65a">
|
|
<p>
|
|
This seems not to be needed - I do not yet dare to delete it though.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
;; (let ((mu4epath
|
|
;; (concat
|
|
;; (f-dirname
|
|
;; (file-truename
|
|
;; (executable-find "mu")))
|
|
;; "/../share/emacs/site-lisp/mu4e")))
|
|
;; (when (and
|
|
;; (string-prefix-p "/nix/store/" mu4epath)
|
|
;; (file-directory-p mu4epath))
|
|
;; (add-to-list 'load-path mu4epath)))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:b92a18cf-eec3-4605-a8c2-37133ade3574"></a>mu4e<br />
|
|
<div class="outline-text-5" id="text-h:b92a18cf-eec3-4605-a8c2-37133ade3574">
|
|
<p>
|
|
In this section we are setting up mu4e, a mail client for emacs using mu with mbsync as backend. The mail accounts themselves are setup in the NixOS configuration, so we only need to add Emacs specific settings here.
|
|
</p>
|
|
|
|
<p>
|
|
The hook functions are defined here: <a href="#h:34506761-06b9-43b5-a818-506d9b3faf28">mu4e functions</a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package mu4e
|
|
:ensure nil
|
|
;; :load-path "/usr/share/emacs/site-lisp/mu4e/"
|
|
;;:defer 20 ; Wait until 20 seconds after startup
|
|
:config
|
|
|
|
;; This is set to 't' to avoid mail syncing issues when using mbsync
|
|
(setq send-mail-function 'sendmail-send-it)
|
|
(setq mu4e-change-filenames-when-moving t)
|
|
(setq mu4e-mu-binary (executable-find "mu"))
|
|
(setq mu4e-hide-index-messages t)
|
|
|
|
(setq mu4e-update-interval 180)
|
|
(setq mu4e-get-mail-command "mbsync -a")
|
|
(setq mu4e-maildir "~/Mail")
|
|
|
|
;; enable inline images
|
|
(setq mu4e-view-show-images t)
|
|
;; use imagemagick, if available
|
|
(when (fboundp 'imagemagick-register-types)
|
|
(imagemagick-register-types))
|
|
|
|
(setq mu4e-drafts-folder "/Drafts")
|
|
(setq mu4e-sent-folder "/Sent Mail")
|
|
(setq mu4e-refile-folder "/All Mail")
|
|
(setq mu4e-trash-folder "/Trash")
|
|
|
|
(setq mu4e-maildir-shortcuts
|
|
'((:maildir "/leon/Inbox" :key ?1)
|
|
(:maildir "/nautilus/Inbox" :key ?2)
|
|
(:maildir "/mrswarsel/Inbox" :key ?3)
|
|
(:maildir "/Sent Mail" :key ?s)
|
|
(:maildir "/Trash" :key ?t)
|
|
(:maildir "/Drafts" :key ?d)
|
|
(:maildir "/All Mail" :key ?a)))
|
|
|
|
(setq user-mail-address "leon@swarsel.win"
|
|
user-full-name "Leon Schwarzäugl")
|
|
|
|
|
|
(setq mu4e-user-mail-address-list '(leon.schwarzaeugl@gmail.com leon@swarsel.win nautilus.dw@gmail.com mrswarsel@gmail.com)))
|
|
|
|
|
|
(add-hook 'mu4e-compose-mode-hook #'swarsel/mu4e-send-from-correct-address)
|
|
(add-hook 'mu4e-compose-post-hook #'swarsel/mu4e-restore-default)
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:43209eeb-5d46-472e-b7c2-58a3fb465199"></a>mu4e-alert<br />
|
|
<div class="outline-text-5" id="text-h:43209eeb-5d46-472e-b7c2-58a3fb465199">
|
|
<p>
|
|
This adds the simple utility of sending desktop notifications whenever a new mail is received. I am using <code>libnotify</code> because I want to use this with <code>notify-send</code>.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package mu4e-alert
|
|
:config
|
|
(setq mu4e-alert-set-default-style 'libnotify))
|
|
|
|
(add-hook 'after-init-hook #'mu4e-alert-enable-notifications)
|
|
|
|
(mu4e t)
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:c760f04e-622f-4b3e-8916-53ca8cce6edc" class="outline-4">
|
|
<h4 id="h:c760f04e-622f-4b3e-8916-53ca8cce6edc"><span class="section-number-4">4.4.37.</span> Calendar</h4>
|
|
<div class="outline-text-4" id="text-h:c760f04e-622f-4b3e-8916-53ca8cce6edc">
|
|
<p>
|
|
This provides a beautiful calender to emacs.
|
|
</p>
|
|
|
|
<p>
|
|
Yes, I am aware that I am exposing my university-calendar to the public here. I can imagine worse things ;) if you however know how to obscure this, let me know!
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package org-caldav
|
|
:init
|
|
;; set org-caldav-sync-initalization
|
|
(setq swarsel-caldav-synced 0)
|
|
(setq org-caldav-url "https://stash.swarsel.win/remote.php/dav/calendars/Swarsele")
|
|
(setq org-caldav-calendars
|
|
'((:calendar-id "personal"
|
|
:inbox "~/Calendars/leon_cal.org")))
|
|
;; (setq org-caldav-backup-file "~/org-caldav/org-caldav-backup.org")
|
|
;; (setq org-caldav-save-directory "~/org-caldav/")
|
|
|
|
:config
|
|
(setq org-icalendar-alarm-time 1)
|
|
;; This makes sure to-do items as a category can show up on the calendar
|
|
(setq org-icalendar-include-todo t)
|
|
;; This ensures all org "deadlines" show up, and show up as due dates
|
|
(setq org-icalendar-use-deadline '(event-if-todo event-if-not-todo todo-due))
|
|
;; This ensures "scheduled" org items show up, and show up as start times
|
|
(setq org-icalendar-use-scheduled '(todo-start event-if-todo event-if-not-todo))
|
|
)
|
|
|
|
(use-package calfw
|
|
:ensure nil
|
|
:bind ("C-c A" . swarsel/open-calendar)
|
|
:init
|
|
(use-package calfw-cal
|
|
:ensure nil)
|
|
(use-package calfw-org
|
|
:ensure nil)
|
|
(use-package calfw-ical
|
|
:ensure nil)
|
|
:config
|
|
(bind-key "g" 'cfw:refresh-calendar-buffer cfw:calendar-mode-map)
|
|
(bind-key "q" 'evil-quit cfw:details-mode-map)
|
|
;; (custom-set-faces
|
|
;; '(cfw:face-title ((t (:foreground "#f0dfaf" :weight bold :height 65))))
|
|
;; )
|
|
)
|
|
|
|
(defun swarsel/open-calendar ()
|
|
(interactive)
|
|
(unless (eq swarsel-caldav-synced 1) (org-caldav-sync) (setq swarsel-caldav-synced 1))
|
|
;; (select-frame (make-frame '((name . "calendar")))) ; makes a new frame and selects it
|
|
;; (set-face-attribute 'default (selected-frame) :height 65) ; reduces the font size of the new frame
|
|
(cfw:open-calendar-buffer
|
|
:contents-sources
|
|
(list
|
|
(cfw:org-create-source "Purple") ; orgmode source
|
|
(cfw:ical-create-source "TISS" "https://tiss.tuwien.ac.at/events/rest/calendar/personal?locale=de&token=4463bf7a-87a3-490a-b54c-99b4a65192f3" "Cyan"))))
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:48f5be2b-b3d2-4276-bd49-2630733f23d5" class="outline-4">
|
|
<h4 id="h:48f5be2b-b3d2-4276-bd49-2630733f23d5"><span class="section-number-4">4.4.38.</span> Dashboard: emacs startup screen</h4>
|
|
<div class="outline-text-4" id="text-h:48f5be2b-b3d2-4276-bd49-2630733f23d5">
|
|
<p>
|
|
This sets up the <code>dashboard</code>, which is really quite useless. But, it looks cool and makes me happy whenever I start an emacsclient without a file name as argument :)
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-emacs-lisp">
|
|
(use-package dashboard
|
|
:ensure t
|
|
:config
|
|
(dashboard-setup-startup-hook)
|
|
;; (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*")))
|
|
(setq dashboard-display-icons-p t ;; display icons on both GUI and terminal
|
|
dashboard-icon-type 'nerd-icons ;; use `nerd-icons' package
|
|
dashboard-set-file-icons t
|
|
dashboard-items '((recents . 5)
|
|
(projects . 5)
|
|
(agenda . 5))
|
|
dashboard-set-footer nil
|
|
dashboard-banner-logo-title "Welcome to SwarsEmacs!"
|
|
dashboard-image-banner-max-height 300
|
|
dashboard-startup-banner "~/.dotfiles/wallpaper/swarsel.png"
|
|
dashboard-projects-backend 'projectile
|
|
dashboard-projects-switch-function 'magit-status
|
|
dashboard-set-navigator t
|
|
dashboard-startupify-list '(dashboard-insert-banner
|
|
dashboard-insert-newline
|
|
dashboard-insert-banner-title
|
|
dashboard-insert-newline
|
|
dashboard-insert-navigator
|
|
dashboard-insert-newline
|
|
dashboard-insert-init-info
|
|
dashboard-insert-items
|
|
)
|
|
dashboard-navigator-buttons
|
|
`(;; line1
|
|
((,""
|
|
"SwarselSocial"
|
|
"Browse Swarsele"
|
|
(lambda (&rest _) (browse-url "instagram.com/Swarsele")))
|
|
|
|
(,""
|
|
"SwarselSound"
|
|
"Browse SwarselSound"
|
|
(lambda (&rest _) (browse-url "sound.swarsel.win")) )
|
|
(,""
|
|
"SwarselSwarsel"
|
|
"Browse Swarsel"
|
|
(lambda (&rest _) (browse-url "github.com/Swarsel")) )
|
|
(,""
|
|
"SwarselStash"
|
|
"Browse SwarselStash"
|
|
(lambda (&rest _) (browse-url "stash.swarsel.win")) )
|
|
(,""
|
|
"SwarselSport"
|
|
"Browse SwarselSports"
|
|
(lambda (&rest _) (browse-url "social.parkour.wien/@Lenno")))
|
|
)
|
|
(
|
|
(,""
|
|
"swarsel.win"
|
|
"Browse swarsel.win"
|
|
(lambda (&rest _) (browse-url "swarsel.win")))
|
|
)
|
|
)))
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:c4c37b94-0760-4bff-9917-f1b0f023f6c3" class="outline-2">
|
|
<h2 id="h:c4c37b94-0760-4bff-9917-f1b0f023f6c3"><span class="section-number-2">5.</span> Wiki</h2>
|
|
<div class="outline-text-2" id="text-h:c4c37b94-0760-4bff-9917-f1b0f023f6c3">
|
|
<p>
|
|
This houses a few configuration snippets that might be useful if you are new to the nix ecosystem. It will be infrequently updated as I come across things that I deem to be interesting to such a reader. Also, interesting configuration tricks will move here if I happen to obsolete them in my main configuration.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:b917d84e-5549-4966-8817-f1d947083ab9" class="outline-3">
|
|
<h3 id="h:b917d84e-5549-4966-8817-f1d947083ab9"><span class="section-number-3">5.1.</span> Importing a NixOS module that is not in nixpkgs</h3>
|
|
<div class="outline-text-3" id="text-h:b917d84e-5549-4966-8817-f1d947083ab9">
|
|
<p>
|
|
This requires changes in multiple locations. As an example we will use an early version of the mautrix-signal module by Niklas Korz.
|
|
</p>
|
|
|
|
<ol class="org-ol">
|
|
<li><p>
|
|
Add the module source to <code>flake.nix</code>:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">{
|
|
inputs = {
|
|
[...]
|
|
# provides expressions for mautrix-signal
|
|
nixpkgs-mautrix-signal ={
|
|
url = github:niklaskorz/nixpkgs/nixos-23.11-mautrix-signal;
|
|
};
|
|
[...]
|
|
};
|
|
|
|
outputs = inputs@{
|
|
self,
|
|
[...]
|
|
nixpkgs-mautrix-signal,
|
|
[...]
|
|
}: let
|
|
[...]
|
|
pkgsmautrix = import nixpkgs-mautrix-signal { inherit system;
|
|
config.allowUnfree = true;
|
|
};
|
|
[...]
|
|
in {
|
|
nixosConfigurations = {
|
|
matrix = nixpkgs.lib.nixosSystem {
|
|
pkgs = pkgsmautrix;
|
|
# this is to import a service module that is not on nixpkgs
|
|
# this way avoids infinite recursion errors
|
|
specialArgs.unstable = nixpkgs-mautrix-signal;
|
|
modules = [
|
|
[...]
|
|
];
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
</pre>
|
|
</div></li>
|
|
|
|
<li><p>
|
|
Import the module in the configuration (<code>configuration.nix</code>)
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
[...]
|
|
imports = [
|
|
[...]
|
|
(unstable + "/nixos/modules/services/matrix/mautrix-signal.nix")
|
|
];
|
|
|
|
[...]
|
|
</pre>
|
|
</div></li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:0ea4318a-ef11-4d9a-bef4-e994c5020989" class="outline-3">
|
|
<h3 id="h:0ea4318a-ef11-4d9a-bef4-e994c5020989"><span class="section-number-3">5.2.</span> Build a firefox addon</h3>
|
|
<div class="outline-text-3" id="text-h:0ea4318a-ef11-4d9a-bef4-e994c5020989">
|
|
<ol class="org-ol">
|
|
<li>app id can be found in the manifest.json file of the .xpi (.xpi is just a normal archive)</li>
|
|
<li>url can be found by copy url of the "add extension" button on the addon page</li>
|
|
<li><p>
|
|
the rest of the information is also found in the manifest.json, but might not be needed
|
|
</p>
|
|
|
|
<p>
|
|
In <code>configuration.nix</code>:
|
|
</p></li>
|
|
</ol>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">programs.firefox = {
|
|
[...]
|
|
profiles.default = {
|
|
[...]
|
|
extensions = with pkgs.nur.repos.rycee.firefox-addons; [
|
|
[...]
|
|
(buildFirefoxXpiAddon {
|
|
pname = ":emoji:";
|
|
version = "0.1.3";
|
|
addonId = "gonelf@gmail.com";
|
|
url = "https://addons.mozilla.org/firefox/downloads/file/3365324/emojidots-0.1.3.xpi";
|
|
sha256 = "4f7cc25c478fe52eb82f37c9ff4978dcaa3f95020398c5b184e517f6efa2c201";
|
|
meta = with lib;
|
|
{
|
|
description = "emoji autocomplete anywhere on the internet";
|
|
mozPermissions = [ "https://gist.githubusercontent.com/gonelf/d8ae3ccb7902b501c4a5dd625d4089da/raw/5eeda197ba92f8c8139e846a1225d5640077e06f/emoji_pretty.json" "tabs" "storage"];
|
|
platforms = platforms.all;
|
|
};
|
|
})
|
|
[...]
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:ce7a2467-72e0-4a13-89c0-61e3b3dbb6e7" class="outline-3">
|
|
<h3 id="h:ce7a2467-72e0-4a13-89c0-61e3b3dbb6e7"><span class="section-number-3">5.3.</span> Define shell utility as package</h3>
|
|
<div class="outline-text-3" id="text-h:ce7a2467-72e0-4a13-89c0-61e3b3dbb6e7">
|
|
<p>
|
|
In <code>configuration.nix</code> (or <code>home.nix</code>):
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
home.packages = with pkgs; [ # or for NixOS environment.systemPackages = with pkgs; [
|
|
[...]
|
|
(pkgs.writeShellApplication {
|
|
name = "pass-fuzzel";
|
|
runtimeInputs = [ pkgs.pass pkgs.fuzzel ];
|
|
text = ''
|
|
shopt -s nullglob globstar
|
|
|
|
typeit=0
|
|
if [[ $# -ge 1 && $1 == "--type" ]]; then
|
|
typeit=1
|
|
shift
|
|
fi
|
|
|
|
export PASSWORD_STORE_DIR=~/.local/share/password-store
|
|
prefix=''${PASSWORD_STORE_DIR-~/.local/share/password-store}
|
|
password_files=( "$prefix"/**/*.gpg )
|
|
password_files=( "''${password_files[@]#"$prefix"/}" )
|
|
password_files=( "''${password_files[@]%.gpg}" )
|
|
|
|
password=$(printf '%s\n' "''${password_files[@]}" | fuzzel --dmenu "$@")
|
|
|
|
[[ -n $password ]] || exit
|
|
|
|
if [[ $typeit -eq 0 ]]; then
|
|
pass show -c "$password" &>/tmp/pass-fuzzel
|
|
else
|
|
pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | wtype -
|
|
fi
|
|
notify-send -u critical -a pass -t 1000 "Copied/Typed Password"
|
|
'';
|
|
})
|
|
|
|
[...]
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:f98faf13-1e3b-4ba4-9e76-cc4b98f1c308" class="outline-3">
|
|
<h3 id="h:f98faf13-1e3b-4ba4-9e76-cc4b98f1c308"><span class="section-number-3">5.4.</span> Add program with prebuild binaries to nix store</h3>
|
|
<div class="outline-text-3" id="text-h:f98faf13-1e3b-4ba4-9e76-cc4b98f1c308">
|
|
<p>
|
|
In <code>configuration.nix</code>:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
home.packages = with pkgs; [ # or for NixOS environment.systemPackages = with pkgs; [
|
|
[...]
|
|
(stdenv.mkDerivation {
|
|
name = "oama";
|
|
|
|
src = pkgs.fetchurl {
|
|
name = "oama";
|
|
url = "https://github.com/pdobsan/oama/releases/download/0.13.1/oama-0.13.1-Linux-x86_64-static.tgz";
|
|
sha256 = "sha256-OTdCObVfnMPhgZxVtZqehgUXtKT1iyqozdkPIV+i3Gc=";
|
|
};
|
|
|
|
phases = [
|
|
"unpackPhase"
|
|
];
|
|
|
|
unpackPhase = ''
|
|
mkdir -p $out/bin
|
|
tar xvf $src -C $out/
|
|
mv $out/oama-0.13.1-Linux-x86_64-static/oama $out/bin/
|
|
'';
|
|
|
|
})
|
|
|
|
[...]
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:fceba848-f065-40e0-ad3f-d16e48c24db5" class="outline-3">
|
|
<h3 id="h:fceba848-f065-40e0-ad3f-d16e48c24db5"><span class="section-number-3">5.5.</span> Patch a utilty for nix paths:</h3>
|
|
<div class="outline-text-3" id="text-h:fceba848-f065-40e0-ad3f-d16e48c24db5">
|
|
<p>
|
|
See <a href="https://drakerossman.com/blog/how-to-patch-a-package-source-on-nixos">https://drakerossman.com/blog/how-to-patch-a-package-source-on-nixos</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:f87f511f-f2be-486d-8297-4361eee6a0d8" class="outline-3">
|
|
<h3 id="h:f87f511f-f2be-486d-8297-4361eee6a0d8"><span class="section-number-3">5.6.</span> let-block for overriding a package in nixpkgs (here: replacing airsonic with airsonic-advanced)</h3>
|
|
<div class="outline-text-3" id="text-h:f87f511f-f2be-486d-8297-4361eee6a0d8">
|
|
<p>
|
|
This can be useful if a module does not let you use your own package yourself.
|
|
</p>
|
|
|
|
<p>
|
|
In <code>flake.nix</code>:
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
pkgs = import nixpkgs { inherit system;
|
|
overlays = [ emacs-overlay.overlay
|
|
nur.overlay
|
|
nixgl.overlay
|
|
(self: super: {
|
|
airsonic = super.airsonic.overrideAttrs (_: rec {
|
|
version = "11.0.2-kagemomiji";
|
|
name = "airsonic-advanced-${version}";
|
|
src = super.fetchurl {
|
|
url = "https://github.com/kagemomiji/airsonic-advanced/releases/download/11.0.2/airsonic.war";
|
|
sha256 = "PgErtEizHraZgoWHs5jYJJ5NsliDd9VulQfS64ackFo=";
|
|
};
|
|
});
|
|
})
|
|
];
|
|
config.allowUnfree = true;
|
|
};
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-h:236b7d18-d97b-4714-805f-2ca4d8b1c3c2" class="outline-3">
|
|
<h3 id="h:236b7d18-d97b-4714-805f-2ca4d8b1c3c2"><span class="section-number-3">5.7.</span> Reference configurations</h3>
|
|
<div class="outline-text-3" id="text-h:236b7d18-d97b-4714-805f-2ca4d8b1c3c2">
|
|
<p>
|
|
Configurations that I have retired or are there for the general study.
|
|
</p>
|
|
</div>
|
|
<div id="outline-container-h:60bd347b-81c5-47b2-82f7-2e6a0c888d3e" class="outline-4">
|
|
<h4 id="h:60bd347b-81c5-47b2-82f7-2e6a0c888d3e"><span class="section-number-4">5.7.1.</span> non-nixos</h4>
|
|
<div class="outline-text-4" id="text-h:60bd347b-81c5-47b2-82f7-2e6a0c888d3e">
|
|
<p>
|
|
My Surface Pro 3, only used for on-the-go university work. Be careful when pushing large changes to this machine, as it easily runs out of memory on large switches. At the moment the only machine running non-NixOS, so special care must be taken not to break this one during updates.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:63e6e03a-8c1e-45f4-aec2-7ca351eccd35"></a>Channel setup<br />
|
|
<div class="outline-text-6" id="text-h:63e6e03a-8c1e-45f4-aec2-7ca351eccd35">
|
|
<p>
|
|
This installs nixGL, which is needed to run GL apps installed through home-manager, since this machine is not using NixOS.
|
|
</p>
|
|
|
|
<p>
|
|
This is not super clean (because it is not fully replicative), but I do not really care.
|
|
</p>
|
|
|
|
<ol class="org-ol">
|
|
<li>Install nixGL:</li>
|
|
</ol>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">nix-channel --add https://github.com/guibou/nixGL/archive/main.tar.gz nixgl && nix-channel --update
|
|
nix-env -iA nixgl.auto.nixGLDefault # or replace `nixGLDefault` with your desired wrapper
|
|
</pre>
|
|
</div>
|
|
|
|
<p>
|
|
This is needed in order to use EGL. Prefix programs that use it with `nixGL`
|
|
</p>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:483a26b5-5a40-4417-9ffb-67cc2cf07161"></a>Home manager<br />
|
|
<div class="outline-text-6" id="text-h:483a26b5-5a40-4417-9ffb-67cc2cf07161">
|
|
<p>
|
|
Special things to note here: We are running xcape to allow <code>CAPS</code> to act as <code>CTRL</code> and <code>ESC</code>. Also we are using <code>nixGL</code> in most places.
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
{ config, pkgs, lib, fetchFromGitHub, ... }:
|
|
|
|
{
|
|
programs.home-manager.enable = true;
|
|
home.username = "leons";
|
|
home.homeDirectory = "/home/leons";
|
|
|
|
home.stateVersion = "23.05"; # Please read the comment before changing.
|
|
|
|
stylix.image = ../../wallpaper/surfacewp.png;
|
|
<<theme>>
|
|
|
|
nixpkgs = {
|
|
config = {
|
|
allowUnfree = true;
|
|
allowUnfreePredicate = (_: true);
|
|
};
|
|
};
|
|
services.xcape = {
|
|
enable = true;
|
|
mapExpression = {
|
|
Control_L = "Escape";
|
|
};
|
|
};
|
|
#keyboard config
|
|
home.keyboard.layout = "us";
|
|
|
|
sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
|
|
|
|
# waybar config
|
|
programs.waybar.settings.mainBar.cpu.format = "{icon0} {icon1} {icon2} {icon3}";
|
|
|
|
programs.waybar.settings.mainBar.temperature.hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input";
|
|
programs.waybar.settings.mainBar.modules-right = ["custom/outer-left-arrow-dark" "mpris" "custom/left-arrow-light"
|
|
"network"
|
|
"custom/left-arrow-dark"
|
|
"pulseaudio"
|
|
"custom/left-arrow-light"
|
|
"battery"
|
|
"custom/left-arrow-dark"
|
|
"temperature"
|
|
"custom/left-arrow-light"
|
|
"disk"
|
|
"custom/left-arrow-dark"
|
|
"memory"
|
|
"custom/left-arrow-light"
|
|
"cpu"
|
|
"custom/left-arrow-dark"
|
|
"tray"
|
|
"custom/left-arrow-light"
|
|
"clock#2"
|
|
"custom/left-arrow-dark"
|
|
"clock#1" ];
|
|
services.blueman-applet.enable = true;
|
|
home.packages = with pkgs; [
|
|
# nixgl.auto.nixGLDefault
|
|
evince
|
|
# nodejs_20
|
|
|
|
# messaging
|
|
# we use gomuks for RAM preservation, but keep schildi around for files and images
|
|
];
|
|
|
|
programs.zsh.initExtra = "
|
|
export GPG_TTY=\"$(tty)\"
|
|
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
|
gpgconf --launch gpg-agent
|
|
";
|
|
|
|
# sway config
|
|
wayland.windowManager.sway= {
|
|
config = rec {
|
|
input = {
|
|
"*" = {
|
|
xkb_layout = "us";
|
|
xkb_options = "ctrl:nocaps,grp:win_space_toggle";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"type:touchpad" = {
|
|
dwt = "enabled";
|
|
tap = "enabled";
|
|
natural_scroll = "enabled";
|
|
middle_emulation = "enabled";
|
|
};
|
|
};
|
|
|
|
output = {
|
|
eDP-1 = {
|
|
mode = "2160x1440@59.955Hz";
|
|
scale = "1";
|
|
bg = "~/.dotfiles/wallpaper/surfacewp.png fill";
|
|
};
|
|
};
|
|
|
|
keybindings = let
|
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
|
in {
|
|
"${modifier}+F2" = "exec brightnessctl set +5%";
|
|
"${modifier}+F1"= "exec brightnessctl set 5%-";
|
|
"${modifier}+n" = "exec sway output eDP-1 transform normal, splith";
|
|
"${modifier}+Ctrl+p" = "exec nixGL wl-mirror eDP-1";
|
|
"${modifier}+t" = "exec sway output eDP-1 transform 90, splitv";
|
|
"${modifier}+XF86AudioLowerVolume" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
|
|
"${modifier}+XF86AudioRaiseVolume" = "exec grim -g \"$(slurp)\" -t png - | wl-copy -t image/png";
|
|
"${modifier}+w" = "exec \"bash ~/.dotfiles/scripts/checkgomuks.sh\"";
|
|
};
|
|
|
|
startup = [
|
|
{ command = "sleep 60 && nixGL nextcloud --background";}
|
|
# { command = "sleep 60 && nixGL spotify";}
|
|
{ command = "sleep 60 && nixGL discord --start-minimized -enable-features=UseOzonePlatform -ozone-platform=wayland";}
|
|
# { command = "sleep 60 && nixGL schildichat-desktop --hidden";}
|
|
{ command = "sleep 60 && nixGL syncthingtray --wait"; }
|
|
{ command = "sleep 60 && ANKI_WAYLAND=1 nixGL anki";}
|
|
{ command = "nm-applet --indicator";}
|
|
{ command = "sleep 60 && OBSIDIAN_USE_WAYLAND=1 nixGL obsidian -enable-features=UseOzonePlatform -ozone-platform=wayland";}
|
|
];
|
|
|
|
keycodebindings = {
|
|
"124" = "exec systemctl suspend";
|
|
};
|
|
};
|
|
|
|
extraConfig = "
|
|
exec swaymsg input 7062:6917:NTRG0001:01_1B96:1B05 map_to_output eDP-1
|
|
exec swaymsg input 7062:6917:NTRG0001:01_1B96:1B05_Stylus map_to_output eDP-1
|
|
";
|
|
};
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
<div id="outline-container-h:3f747cb3-bf83-4cb6-8fe4-6a4865472eeb" class="outline-4">
|
|
<h4 id="h:3f747cb3-bf83-4cb6-8fe4-6a4865472eeb"><span class="section-number-4">5.7.2.</span> nixos</h4>
|
|
<div class="outline-text-4" id="text-h:3f747cb3-bf83-4cb6-8fe4-6a4865472eeb">
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:80753b6b-667e-4b04-a260-a3b5c73fb624"></a>Onett (Lenovo Y510P)<br />
|
|
<div class="outline-text-6" id="text-h:80753b6b-667e-4b04-a260-a3b5c73fb624">
|
|
<p>
|
|
My laptop, sadly soon to be replaced by a new one, since most basic functions are stopping to work lately.
|
|
</p>
|
|
</div>
|
|
<ol class="org-ol">
|
|
<li><a id="h:6f3fe0dc-a857-440a-b4bd-c32fd9024b8b"></a>NixOS<br />
|
|
<div class="outline-text-7" id="text-h:6f3fe0dc-a857-440a-b4bd-c32fd9024b8b">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
{ config, lib, pkgs, inputs, ... }:
|
|
|
|
{
|
|
|
|
<<wrap>>
|
|
|
|
services = {
|
|
greetd.settings.initial_session.user ="swarsel";
|
|
xserver.videoDrivers = ["nvidia"];
|
|
};
|
|
|
|
|
|
hardware = {
|
|
nvidia = {
|
|
modesetting.enable = true;
|
|
powerManagement.enable = true;
|
|
prime = {
|
|
intelBusId = "PCI:0:2:0";
|
|
nvidiaBusId = "PCI:1:0:0";
|
|
sync.enable = true;
|
|
};
|
|
};
|
|
pulseaudio.configFile = pkgs.runCommand "default.pa" {} ''
|
|
sed 's/module-udev-detect$/module-udev-detect tsched=0/' \
|
|
${pkgs.pulseaudio}/etc/pulse/default.pa > $out
|
|
'';
|
|
bluetooth.enable = true;
|
|
};
|
|
|
|
stylix.image = ../../wallpaper/lenovowp.png;
|
|
<<theme>>
|
|
|
|
boot.loader.grub = {
|
|
enable = true;
|
|
device = "/dev/sda";
|
|
useOSProber = true;
|
|
};
|
|
|
|
networking.hostName = "onett"; # Define your hostname.
|
|
networking.enableIPv6 = false;
|
|
|
|
users.users.swarsel = {
|
|
isNormalUser = true;
|
|
description = "Leon S";
|
|
extraGroups = [ "networkmanager" "wheel" "lp"];
|
|
packages = with pkgs; [];
|
|
};
|
|
|
|
system.stateVersion = "23.05"; # Did you read the comment?
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
];
|
|
|
|
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<li><a id="h:7b76c914-c9b2-47b5-ba89-c501d6391110"></a>Home Manager<br />
|
|
<div class="outline-text-7" id="text-h:7b76c914-c9b2-47b5-ba89-c501d6391110">
|
|
<div class="org-src-container">
|
|
<pre class="src src-nix">
|
|
{ config, pkgs, lib, fetchFromGitHub, ... }:
|
|
|
|
{
|
|
|
|
<<gpgagent>>
|
|
|
|
home = {
|
|
username = "swarsel";
|
|
homeDirectory = "/home/swarsel";
|
|
stateVersion = "23.05"; # Please read the comment before changing.
|
|
keyboard.layout = "de";
|
|
packages = with pkgs; [
|
|
];
|
|
};
|
|
|
|
sops.age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/sops" ];
|
|
|
|
# # waybar config
|
|
programs.waybar.settings.mainBar = {
|
|
cpu.format = "{icon0} {icon1} {icon2} {icon3} {icon4} {icon5} {icon6} {icon7}";
|
|
temperature.hwmon-path = "/sys/devices/platform/coretemp.0/hwmon/hwmon3/temp3_input";
|
|
};
|
|
<<waybarlaptop>>
|
|
|
|
services.blueman-applet.enable = true;
|
|
|
|
wayland.windowManager.sway= {
|
|
config = rec {
|
|
input = {
|
|
"1:1:AT_Translated_Set_2_keyboard" = {
|
|
xkb_layout = "us";
|
|
xkb_options = "grp:win_space_toggle";
|
|
# xkb_options = "ctrl:nocaps,grp:win_space_toggle";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
"2362:33538:ipad_keyboard_Keyboard" = {
|
|
xkb_layout = "us";
|
|
xkb_options = "altwin:swap_lalt_lwin,ctrl:nocaps,grp:win_space_toggle";
|
|
xkb_variant = "colemak_dh";
|
|
};
|
|
"36125:53060:splitkb.com_Kyria_rev3" = {
|
|
xkb_layout = "us";
|
|
xkb_variant = "altgr-intl";
|
|
};
|
|
|
|
"type:touchpad" = {
|
|
dwt = "enabled";
|
|
tap = "enabled";
|
|
natural_scroll = "enabled";
|
|
middle_emulation = "enabled";
|
|
};
|
|
};
|
|
|
|
output = {
|
|
eDP-1 = {
|
|
mode = "1920x1080";
|
|
scale = "1";
|
|
bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
|
|
position = "1920,0";
|
|
};
|
|
VGA-1 = {
|
|
mode = "1920x1080";
|
|
scale = "1";
|
|
bg = "~/.dotfiles/wallpaper/lenovowp.png fill";
|
|
position = "0,0";
|
|
};
|
|
};
|
|
|
|
keybindings = let
|
|
inherit (config.wayland.windowManager.sway.config) modifier;
|
|
in {
|
|
"${modifier}+F2" = "exec brightnessctl set +5%";
|
|
"${modifier}+F1"= "exec brightnessctl set 5%-";
|
|
"XF86MonBrightnessUp" = "exec brightnessctl set +5%";
|
|
"XF86MonBrightnessDown"= "exec brightnessctl set 5%-";
|
|
"${modifier}+Ctrl+p" = "exec wl-mirror eDP-1";
|
|
"XF86HomePage" = "exec wtype -P Escape -p Escape";
|
|
"${modifier}+w" = "exec \"bash ~/.dotfiles/scripts/checkschildi.sh\"";
|
|
};
|
|
keycodebindings = {
|
|
"94" = "exec wtype c";
|
|
"Shift+94" = "exec wtype C";
|
|
"Ctrl+94" = "exec wtype -M ctrl c -m ctrl";
|
|
"Ctrl+Shift+94" = "exec wtype -M ctrl -M shift c -m ctrl -m shift";
|
|
};
|
|
|
|
startup = [
|
|
<<startupnixos>>
|
|
];
|
|
};
|
|
|
|
extraConfig = "
|
|
";
|
|
};
|
|
}
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="postamble" class="status">
|
|
<p class="author">Author: Leon Schwarzäugl</p>
|
|
<p class="date">Created: 2024-07-20 Sa 00:16</p>
|
|
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
|
</div>
|
|
</body>
|
|
</html>
|