Files
nixos/henrovnix_ok/README.html
T
2026-03-04 15:07:03 +01:00

3928 lines
125 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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>
<!-- 2026-03-04 wo 15:07 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>&lrm;</title>
<meta name="author" content="henrov" />
<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>
<style>code{font-size:1.2em;}</style>
</head>
<body>
<div id="content" class="content">
<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="#orgba6ad26">1. Introduction</a>
<ul>
<li><a href="#org18b5d41">1.1. What do you get?</a></li>
<li><a href="#org8ab3b4f">1.2. What you do not get</a></li>
</ul>
</li>
<li><a href="#org5e5a0eb">2. What Is a Literate System in the Context of NixOS?</a>
<ul>
<li><a href="#org5612042">2.1. Two Types of Code Blocks</a></li>
<li><a href="#org6c129b1">2.2. The Two Core Commands</a></li>
<li><a href="#org9cf64ee">2.3. Editing Generated Files</a></li>
<li><a href="#orgccbe0c4">2.4. Recommended Workflow</a></li>
<li><a href="#org6d382ef">2.5. Folder Structure Explained</a>
<ul>
<li><a href="#orgd529ae4">2.5.1. ./assets</a></li>
<li><a href="#orgddef677">2.5.2. ./assets/conf</a></li>
<li><a href="#org6688fdb">2.5.3. ./configuration</a></li>
<li><a href="#org24a87d7">2.5.4. ./hardware</a></li>
<li><a href="#orgac9072d">2.5.5. ./home</a></li>
<li><a href="#org0f3a174">2.5.6. ./machines</a></li>
</ul>
</li>
<li><a href="#orgb5eefb8">2.6. Final Principle</a></li>
<li><a href="#orga1875ae">2.7. Base packages</a></li>
<li><a href="#org82f2474">2.8. Additional packages</a></li>
</ul>
</li>
<li><a href="#orgefd7aee">3. Setting up your system manually</a>
<ul>
<li><a href="#orgdc00d23">3.1. Pre-requisites to build this setup</a></li>
<li><a href="#orga93b25c">3.2. Setup when Emacs not (yet) available</a></li>
</ul>
</li>
<li><a href="#orge5f0fc9">4. Testing and generating builds</a></li>
<li><a href="#org81b6186">5. <code>flake.lock</code> for pinning input versions.</a></li>
<li><a href="#org216121a">6. <code>assets/*</code> for non-Nix-managed artifacts such as images and wallpapers.</a>
<ul>
<li><a href="#org0cdc018">6.1. Emacs + Org + Tangle</a></li>
</ul>
</li>
<li><a href="#org3541201">7. [Emacs](https://www.gnu.org/software/emacs/][Emacs) is used as the editor and execution environment for this literate configuration.</a></li>
<li><a href="#orgf943faf">8. [Org](https://orgmode.org/][Org) mode provides the document structure and the source block execution model used here.</a></li>
<li><a href="#orgc88f365">9. Tangling exports source blocks from this Org document into the corresponding configuration files.</a>
<ul>
<li><a href="#org0c43a4d">9.1. Nix &amp; NixOS</a></li>
</ul>
</li>
<li><a href="#org7aaa004">10. [Nix](https://nix.dev/][Nix) is used to define packages, environments, and configuration as pure expressions.</a></li>
<li><a href="#orgf58cbca">11. [NixOS](https://nixos.org/][NixOS) evaluates Nix expressions into a complete system configuration that can be applied by rebuild operations.</a>
<ul>
<li><a href="#orgec40543">11.1. Repository layout and folder conventions</a></li>
<li><a href="#org1a23dee">11.2. Shared domain folders</a></li>
<li><a href="#org45f281a">11.3. Full tree (including unchanged parts)</a></li>
<li><a href="#org8012694">11.4. Notes</a></li>
</ul>
</li>
<li><a href="#org0987aad">12. TLDR App List</a></li>
<li><a href="#org7d926a1">13. Configuration Variables</a></li>
<li><a href="#org3dbdf51">14. Flake Inputs</a></li>
<li><a href="#org301437f">15. Flake Output</a>
<ul>
<li><a href="#orgff5aaff">15.1. Envrc + Direnv</a></li>
</ul>
</li>
<li><a href="#orgd121df2">16. Machines</a>
<ul>
<li>
<ul>
<li><a href="#org02cb6d9">16.0.1. Other Utils</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orgace76ca">17. Hardware</a></li>
<li><a href="#orgdff4c95">18. Configuration</a>
<ul>
<li><a href="#org55190ad">18.1. Apps section</a></li>
<li><a href="#org7834227">18.2. packages.nix</a></li>
<li><a href="#orga969618">18.3. flatpaks.nix</a></li>
<li><a href="#org6385f17">18.4. Nix Settings</a></li>
<li><a href="#org04c35a2">18.5. Boot</a></li>
</ul>
</li>
<li><a href="#org79f56f0">19. Login</a>
<ul>
<li><a href="#org7a11e7d">19.1. Tuigreet</a></li>
<li><a href="#org5e0b4c0">19.2. LightDM</a></li>
<li><a href="#org5a02489">19.3. Terminal (default system)</a></li>
<li><a href="#orge2f5012">19.4. Files</a></li>
<li><a href="#org4f2e8d1">19.5. Locale</a></li>
<li><a href="#org75d1a23">19.6. Networking</a></li>
<li><a href="#org84b7afd">19.7. Hyprland</a></li>
<li><a href="#orga3ea630">19.8. Setting the config</a></li>
<li><a href="#org3dfffbc">19.9. Services</a></li>
<li><a href="#orga6e69cf">19.10. Audio</a></li>
<li><a href="#orgf460ce8">19.11. Fonts</a></li>
<li><a href="#org9eba1c8">19.12. User Config</a></li>
</ul>
</li>
<li><a href="#orgb6a6e52">20. Home</a>
<ul>
<li><a href="#orge23ba3c">20.1. default.nix</a></li>
<li><a href="#org7dd9289">20.2. Ollama</a></li>
<li><a href="#org8f75cff">20.3. Animated Wallpaper</a></li>
<li><a href="#org27d1a3d">20.4. Rotating Wallpaper</a></li>
<li><a href="#org1ad05ef">20.5. Waybar</a></li>
<li><a href="#org408aba2">20.6. Lock Screen</a></li>
<li><a href="#org131a4e3">20.7. Idle Screen</a></li>
<li><a href="#org539aa42">20.8. Hyprshell</a></li>
<li><a href="#org088c3a6">20.9. Hyprland</a></li>
<li><a href="#org6f00546">20.10. Walker</a></li>
<li><a href="#org7d0b036">20.11. Theme</a></li>
<li><a href="#org0cf55cd">20.12. Alacritty</a></li>
<li><a href="#org3d6b48d">20.13. Dev Tools</a></li>
<li><a href="#orgf57a7b0">20.14. Kitty</a></li>
<li><a href="#orge947e83">20.15. Shells</a></li>
<li><a href="#org90feb92">20.16. Zsh</a></li>
<li><a href="#org10ac537">20.17. Starship</a></li>
<li><a href="#orga2bc6d5">20.18. Other Settings</a>
<ul>
<li><a href="#orgfc66029">20.18.1. Home User</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org13b410e">21. Emacs</a>
<ul>
<li><a href="#orgbb6edd4">21.1. Early EMACS Initialization</a></li>
<li><a href="#orgef6058d">21.2. EMACS Initialization</a></li>
</ul>
</li>
<li><a href="#org60a0392">22. Machines</a>
<ul>
<li><a href="#orga19a1eb">22.1. Traveldroid</a>
<ul>
<li><a href="#org56a4595">22.1.1. System Level</a></li>
<li><a href="#org09cb6f5">22.1.2. Hardware</a></li>
<li><a href="#org0b35763">22.1.3. Home</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org7036399">23. README Utils</a>
<ul>
<li>
<ul>
<li><a href="#org50cd08e">23.0.1. Headers</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<p>
f#+OPTIONS: toc:nil broken-links:t
</p>
<div align="center">
<div>
<img src="./.github/images/nixos.svg" width="100px" alt="NixOS" />
<img flake.nisrc="./.github/images/emacs.svg" width="100px" alt="Emacs" />
</div>
<br />
<h1>Henrov's Literate System Configuration</h1>
<div>
<a href="https://orgmode.org/index.html">
<img src="https://img.shields.io/badge/org_mode-9.7-blue.svg?style=for-the-badge&labelColor=1e1e2e&logo=org&logoColor=a6e3a1&color=1e1e2e" alt="Org mode" />
</a>
<a href="https://nixos.org">
<img src="https://img.shields.io/badge/NixOS-unstable-blue.svg?style=for-the-badge&labelColor=1e1e2e&logo=NixOS&logoColor=89b4fa&color=1e1e2e" alt="NixOS" />
</a>
<a href="https://www.gnu.org/software/emacs/">
<img src="https://img.shields.io/badge/emacs-30-blue.svg?style=for-the-badge&labelColor=1e1e2e&logo=gnuemacs&logoColor=cba6f7&color=1e1e2e" alt="Emacs" />
</a>
<a href="https://gitea.data-pro.nu/system/blob/main/LICENSE">
<img src="https://img.shields.io/static/v1.svg?style=for-the-badge&label=License&message=GPL&colorA=1e1e2e&colorB=f38ba8&logo=unlicense&logoColor=f9e2af" alt="License" />
</a>
<a href="https://gitea.data-pro.nu/system/actions/workflows/tangle.yml">
<img src="https://img.shields.io/github/actions/workflow/status/gamedolphin/system/tangle.yml?style=for-the-badge&label=Tangle&colorA=1e1e2e&colorB=a6e3a1&logo=github&logoColor=cdd6f4" alt="Tangle workflow" />
</a>
</div>
</div>
<div id="outline-container-orgba6ad26" class="outline-2">
<h2 id="orgba6ad26"><span class="section-number-2">1.</span> Introduction</h2>
<div class="outline-text-2" id="text-1">
<div align="center"><img src="./.github/images/need to create screenshot.png" width="100%" alt="Screenshot" /></div>
<p>
This repository contains a literate NixOS configuration built using Emacs Org mode. The primary source of truth is <b>this document itself</b>, which embeds configuration blocks that are tangled into individual files. These generated files are evaluated as a NixOS flake, resulting in an immutable, reproducible system configuration.
</p>
<p>
This work is based on the foundational efforts of Sandeep Nambiar (<a href="https://github.com/gamedolphin">https://github.com/gamedolphin</a>).
All credit for the original structure, methodology, and guidance belongs to him. His work provided the architectural basis and practical direction upon which this repository is built. This project would not have been possible without his prior contributions, and much of the instructional approach preserved here originates from his documentation.
The purpose of this repository is to offer a structured, minimal starting point for deploying a functional NixOS system. It is intentionally not a complete desktop environment, nor is it a “batteries-included” distribution. Instead, it provides a clean and extensible foundation that can be adapted and expanded after installation.
Customization is designed to occur primarily through modular .conf files, allowing the system to evolve incrementally while maintaining clarity and separation of concerns. The goal is to enable users to build their own tailored NixOS setup on top of a coherent and reproducible base.
Before proceeding with installation, it is strongly recommended to read this documentation carefully. Understanding the structure and design philosophy will help ensure a smooth setup and provide the necessary context for extending the system effectively.
</p>
</div>
<div id="outline-container-org18b5d41" class="outline-3">
<h3 id="org18b5d41"><span class="section-number-3">1.1.</span> What do you get?</h3>
<div class="outline-text-3" id="text-1-1">
<p>
This repository delivers a reproducible foundation built on NixOS, Home-Manager, and Flakes. It assumes a clean NixOS installation as a starting point, preferably minimal or headless, onto which the configuration is applied.
The system provides a predefined baseline configuration that installs and enables the essential components required for a functional and extensible environment. Rather than prescribing a complete desktop experience, it establishes the structural framework upon which such an environment can be composed.
Core packages are installed as part of the base configuration. Additional software can be incorporated in a controlled and modular manner by extending configuration files.
</p>
</div>
</div>
<div id="outline-container-org8ab3b4f" class="outline-3">
<h3 id="org8ab3b4f"><span class="section-number-3">1.2.</span> What you do not get</h3>
<div class="outline-text-3" id="text-1-2">
<p>
This repository does not provide a fully polished, bug-free desktop system with every default preconfigured and validated across all hardware combinations. It is a structured foundation, not a turnkey end-user distribution.
You should not expect graphical configuration tools, wizard-driven setup screens, or extensive GUI-based system management. Configuration is performed declaratively through Nix modules and supporting configuration files. Familiarity with reading logs, adjusting modules, and rebuilding the system is assumed.
Certain subsystems may require manual tuning depending on hardware, desktop environment, or portal backend selection. For example, XDG desktop portals can exhibit inconsistent behavior across compositors and applications, particularly in Wayland-based environments. File chooser dialogs, screen sharing, or drag-and-drop functionality may require additional configuration or troubleshooting.
This project favors clarity, reproducibility, and modular structure over convenience abstractions. As a result, some integration details are intentionally left explicit rather than hidden behind automated defaults.
In short, this repository provides a coherent and extensible base, not a finished consumer product. It is a work in progress.
</p>
</div>
</div>
</div>
<div id="outline-container-org5e5a0eb" class="outline-2">
<h2 id="org5e5a0eb"><span class="section-number-2">2.</span> What Is a Literate System in the Context of NixOS?</h2>
<div class="outline-text-2" id="text-2">
<p>
A literate system combines documentation and implementation into a single, coherent source.
In this repository, that source is:
</p>
<div class="org-src-container">
<pre class="src src-bash">README.org
</pre>
</div>
<p>
Everything originates from this file:
</p>
<ul class="org-ul">
<li>Architectural explanations</li>
<li>Design decisions</li>
<li>NixOS modules</li>
<li>Home-Manager modules</li>
<li>Generated documentation</li>
</ul>
<p>
There is no separation between “docs” and “code”.
The documentation explains the intent.
The source blocks define the system.
Org-mode turns that narrative into both executable configuration and readable documentation.
</p>
<p>
The README is not describing the system.
The README <b>is</b> the system.
</p>
</div>
<div id="outline-container-org5612042" class="outline-3">
<h3 id="org5612042"><span class="section-number-3">2.1.</span> Two Types of Code Blocks</h3>
<div class="outline-text-3" id="text-2-1">
<p>
This literate system uses two different kinds of source blocks.
</p>
<p>
<b><b>1. Documentation Blocks</b></b>
These blocks exist purely for documentation purposes.
They generate visible code blocks in the exported documentation, but they do not create files.
Example:
</p>
<pre class="example" id="orgcf35f68">
#+begin_src bash :tangle no
&lt;tekst&gt;
#+end_src
</pre>
<p>
These are used to show commands, examples, or explanatory snippets in the generated documentation.
They are never tangled into the filesystem.
</p>
<p>
<b><b>2. File-Generating Blocks</b></b>
These blocks generate real <code>.nix</code> files and insert the same code into the documentation.
Example:
</p>
<pre class="example" id="orgd91a762">
** packages.nix
&lt;tekst&gt;
#+begin_src nix :tangle configuration/apps/packages.nix :noweb tangle :mkdirp yes
&lt;nixos code&gt;
#+end_src
</pre>
<p>
Explanation:
</p>
<ul class="org-ul">
<li>The headline <code>packages.nix</code> becomes a documentation chapter.</li>
<li>The paragraph <code>&lt;tekst&gt;</code> explains what the module does.</li>
<li><code>&lt;nixos code&gt;</code> is exactly what will be written into the .nix module <code>configuration/apps/packages.nix</code></li>
<li>The same source block is rendered as a code block in the documentation.</li>
</ul>
<p>
This means:
</p>
<ul class="org-ul">
<li>The explanation and the implementation live side-by-side.</li>
<li>The documentation cannot drift away from the code.</li>
<li>The generated .nix file is always derived from the canonical explanation.</li>
</ul>
</div>
</div>
<div id="outline-container-org6c129b1" class="outline-3">
<h3 id="org6c129b1"><span class="section-number-3">2.2.</span> The Two Core Commands</h3>
<div class="outline-text-3" id="text-2-2">
<p>
There are exactly two commands that matter.
</p>
<p>
<b><b>1. Generate all .nix files</b></b>
</p>
<div class="org-src-container">
<pre class="src src-bash">emacs README.org --batch -f org-babel-tangle
</pre>
</div>
<p>
This command:
</p>
<ul class="org-ul">
<li>Regenerates ./configuration</li>
<li>Regenerates ./home</li>
<li>Overwrites previously generated modules</li>
<li>Ensures the system matches the README</li>
</ul>
<p>
<b><b>2. Generate documentation</b></b>
</p>
<div class="org-src-container">
<pre class="src src-bash">emacs --batch -l org -l ox-html README.org -f org-html-export-to-html --kill
</pre>
</div>
<p>
This command exports the same README into HTML documentation.
In practice you usually combine them:
</p>
<div class="org-src-container">
<pre class="src src-bash">emacs README.org --batch -f org-babel-tangle &amp;&amp; emacs --batch -l org -l ox-html README.org -f org-html-export-to-html --kill
</pre>
</div>
<p>
First the system is generated.
Then the documentation is generated.
Both come from the same source.
</p>
</div>
</div>
<div id="outline-container-org9cf64ee" class="outline-3">
<h3 id="org9cf64ee"><span class="section-number-3">2.3.</span> Editing Generated Files</h3>
<div class="outline-text-3" id="text-2-3">
<p>
The directories:
</p>
<ul class="org-ul">
<li>./configuration</li>
<li>./home</li>
</ul>
<p>
are fully generated by:
</p>
<div class="org-src-container">
<pre class="src src-bash">emacs README.org --batch -f org-babel-tangle
</pre>
</div>
<p>
Editing these files directly is allowed only temporarily, for experimentation or testing.
Structural or permanent changes must always be implemented in the corresponding section inside README.org.
If you change a file in ./configuration or ./home without updating the README, your changes will disappear on the next tangle.
Generated directories are output, not source.
</p>
</div>
</div>
<div id="outline-container-orgccbe0c4" class="outline-3">
<h3 id="orgccbe0c4"><span class="section-number-3">2.4.</span> Recommended Workflow</h3>
<div class="outline-text-3" id="text-2-4">
<p>
This workflow allows safe experimentation while preserving literate structure.
</p>
<ol class="org-ol">
<li>Change any existing file in ./assets, ./home or ./configuration</li>
<li>Commit your experimental change</li>
<li>Test the configuration</li>
<li>If satisfied, migrate the change into README.org</li>
<li>Regenerate system and documentation</li>
<li>Commit again</li>
<li>Test again</li>
</ol>
<p>
Commands:
</p>
<div class="org-src-container">
<pre class="src src-bash">git add .
git commit -m "experiment: local change"
sudo nixos-rebuild test --flake .#YOUR_HOSTNAME
</pre>
</div>
<p>
After confirming the change:
</p>
<div class="org-src-container">
<pre class="src src-bash">emacs README.org --batch -f org-babel-tangle &amp;&amp; emacs --batch -l org -l ox-html README.org -f org-html-export-to-html --kill
git add .
git commit -m "literate: structural update"
sudo nixos-rebuild test --flake .#YOUR_HOSTNAME
</pre>
</div>
<p>
If you are confident about your changes, you may skip steps 13 and edit README.org directly.
</p>
</div>
</div>
<div id="outline-container-org6d382ef" class="outline-3">
<h3 id="org6d382ef"><span class="section-number-3">2.5.</span> Folder Structure Explained</h3>
<div class="outline-text-3" id="text-2-5">
<p>
The repository separates generated system code from non-generated supporting files.
</p>
</div>
<div id="outline-container-orgd529ae4" class="outline-4">
<h4 id="orgd529ae4"><span class="section-number-4">2.5.1.</span> ./assets</h4>
<div class="outline-text-4" id="text-2-5-1">
<p>
Contains non-generated assisting files such as:
</p>
<ul class="org-ul">
<li>Icons</li>
<li>Themes</li>
<li>Static configuration files</li>
</ul>
<p>
These files are safe to edit directly.
</p>
</div>
</div>
<div id="outline-container-orgddef677" class="outline-4">
<h4 id="orgddef677"><span class="section-number-4">2.5.2.</span> ./assets/conf</h4>
<div class="outline-text-4" id="text-2-5-2">
<p>
Contains non-generated assisting configuration files that influence several aspects of builds.
Users are expected to modify these when needed.
</p>
</div>
</div>
<div id="outline-container-org6688fdb" class="outline-4">
<h4 id="org6688fdb"><span class="section-number-4">2.5.3.</span> ./configuration</h4>
<div class="outline-text-4" id="text-2-5-3">
<p>
Fully (re)generated by README.org.
</p>
<p>
Contains:
</p>
<ul class="org-ul">
<li>All NixOS modules</li>
<li>Service definitions</li>
<li>System-level configuration</li>
</ul>
<p>
This directory is output.
</p>
</div>
</div>
<div id="outline-container-org24a87d7" class="outline-4">
<h4 id="org24a87d7"><span class="section-number-4">2.5.4.</span> ./hardware</h4>
<div class="outline-text-4" id="text-2-5-4">
<p>
Contains non-generated hardware.nix files detailing hardware-specific details.
This directory will likely be deprecated in the future.
</p>
</div>
</div>
<div id="outline-container-orgac9072d" class="outline-4">
<h4 id="orgac9072d"><span class="section-number-4">2.5.5.</span> ./home</h4>
<div class="outline-text-4" id="text-2-5-5">
<p>
Fully (re)generated by README.org.
</p>
<p>
Contains:
</p>
<ul class="org-ul">
<li>All Home-Manager modules</li>
<li>User-level configuration</li>
<li>Shell and desktop configuration</li>
</ul>
</div>
</div>
<div id="outline-container-org0f3a174" class="outline-4">
<h4 id="org0f3a174"><span class="section-number-4">2.5.6.</span> ./machines</h4>
<div class="outline-text-4" id="text-2-5-6">
<p>
Contains one folder per machine you want to configure.
Each machine folder contains non-generated files detailing specifics for that machine:
</p>
<ul class="org-ul">
<li>Host-specific overrides</li>
<li>Hardware references</li>
<li>Host definitions</li>
</ul>
<p>
These determine how shared modules apply to each system.
</p>
</div>
</div>
</div>
<div id="outline-container-orgb5eefb8" class="outline-3">
<h3 id="orgb5eefb8"><span class="section-number-3">2.6.</span> Final Principle</h3>
<div class="outline-text-3" id="text-2-6">
<p>
A literate NixOS system guarantees:
</p>
<ul class="org-ul">
<li>Single source of truth</li>
<li>No divergence between documentation and configuration</li>
<li>Reproducible system builds</li>
<li>Clear architectural reasoning</li>
<li>Controlled experimentation</li>
</ul>
<p>
You are not maintaining configuration files.
You are maintaining a structured narrative that builds an operating system.
</p>
</div>
</div>
<div id="outline-container-orga1875ae" class="outline-3">
<h3 id="orga1875ae"><span class="section-number-3">2.7.</span> Base packages</h3>
<div class="outline-text-3" id="text-2-7">
<p>
The baseline package set is defined explicitly within the repository to ensure reproducibility:
</p>
<div class="org-src-container">
<pre class="src src-bash">- alsa-utils
- avy
- bibata-cursors
- brightnessctl
- cape
- catppuccin-gtk
- catppuccin-theme
- consult
- coreutils
- corfu
- crux
- dash
- diminish
- doom-modeline
- eat
- eldoc
- eldoc-box
- elephant
- emacs-pgtk
- envrc
- exec-path-from-shell
- expreg
- flatpak
- gnugrep
- gnused
- gptel
- hcl-mode
- hypridle
- hyprlandPlugins
- hyprlock
- hyprshell
- librsvg
- linuxPackages_latest
- magit
- magnetic-catppuccin-gtk
- marginalia
- nerd-icons
- nerd-icons-corfu
- nix-mode
- nixpkgs-fmt
- nushell
- ollama-vulkan
- orderless
- papirus-icon-theme
- pulsar
- puni
- rg
- rust-mode
- rustic
- shell-pop
- sideline
- sideline-eglot
- sideline-flymake
- tuigreet
- vertico
- vundo
- walker
- which-key
- wpaperd
- xdg-desktop-portal-gtk
- yasnippet
- yasnippet-snippets
- zsh
</pre>
</div>
</div>
</div>
<div id="outline-container-org82f2474" class="outline-3">
<h3 id="org82f2474"><span class="section-number-3">2.8.</span> Additional packages</h3>
<div class="outline-text-3" id="text-2-8">
<p>
Additional software can be installed by extending the dedicated configuration files that define system and Flatpak packages:
</p>
<div class="org-src-container">
<pre class="src src-bash">├── assets
│   ├── conf
│   │   ├── apps
│   │   │   ├── flatpaks.conf
│   │   │   └── packages.conf
</pre>
</div>
<p>
System packages are declared in <code>packages.conf</code> using their attribute names from Nixpkgs. The correct package names can be located through the official NixOS package search at <a href="https://search.nixos.org/packages">https://search.nixos.org/packages</a>.
</p>
<p>
Available Flatpak identifiers can be discovered using:
</p>
<div class="org-src-container">
<pre class="src src-bash">flatpak search &lt;application-name&gt;
</pre>
</div>
<p>
or by browsing: <a href="https://flathub.org/">https://flathub.org/</a>.
</p>
<p>
The behavior and integration of Flatpak installation within the system are defined in <code>flatpaks.nix</code>, which reads the corresponding configuration files and ensures declarative installation.
</p>
<p>
This separation maintains clarity between system-level packages and user-facing Flatpak applications while preserving reproducibility and modular structure.
</p>
</div>
</div>
</div>
<div id="outline-container-orgefd7aee" class="outline-2">
<h2 id="orgefd7aee"><span class="section-number-2">3.</span> Setting up your system manually</h2>
<div class="outline-text-2" id="text-3">
</div>
<div id="outline-container-orgdc00d23" class="outline-3">
<h3 id="orgdc00d23"><span class="section-number-3">3.1.</span> Pre-requisites to build this setup</h3>
<div class="outline-text-3" id="text-3-1">
<div class="org-src-container">
<pre class="src src-bash">- a NIXOS system installed with a user with sudo rights.
- an internet connection
- the folder henrovnix_ok as you find it here
</pre>
</div>
</div>
</div>
<div id="outline-container-orga93b25c" class="outline-3">
<h3 id="orga93b25c"><span class="section-number-3">3.2.</span> Setup when Emacs not (yet) available</h3>
<div class="outline-text-3" id="text-3-2">
<ol class="org-ol">
<li>Copy the folder <b>henrovnix<sub>ok</sub></b> to your machine</li>
<li><p>
First setup an internet connection
</p>
<div class="org-src-container">
<pre class="src src-bash"># Check if NetworkManager service is running
systemctl status NetworkManager
# If not running, start it temporarily
sudo systemctl start NetworkManager
# Enable Wi-Fi radio (in case it is disabled)
nmcli radio wifi on
# List available Wi-Fi networks
nmcli device wifi list
# Connect to a Wi-Fi network (replace SSID and PASSWORD)
nmcli device wifi connect "SSID_NAME" password "YOUR_PASSWORD"
# Verify that the connection is active
nmcli connection show --active
# Optional: show device status
nmcli device status
</pre>
</div></li>
<li><p>
Replace <b>&lt;defaultUser&gt;</b> in all files with <code>YOUR_USER</code>
</p>
<div class="org-src-container">
<pre class="src src-bash">find ~/Repos/nixos/henrovnix_ok \
-type d -name ".*" -prune -o \
-type f -print0 \
| xargs -0 sed -i 's/=&lt;defaultUser&gt;=/YOUR_USER/g'
</pre>
</div></li>
<li><p>
Replace <b>machine1</b> in all files with <code>YOUR_HOSTNAME</code>
</p>
<div class="org-src-container">
<pre class="src src-bash">find ~/Repos/nixos/henrovnix_ok \
-type d -name ".*" -prune -o \
-type f -print0 \
| xargs -0 sed -i 's/machine1/YOUR_HOSTNAME/g'
</pre>
</div></li>
<li><p>
Rename the folder ./machines/machine1 to your hostname
</p>
<div class="org-src-container">
<pre class="src src-bash">mv ./machines/machine1 ./machines/YOUR_HOSTNAME
</pre>
</div></li>
<li><p>
Create a hardware-configuration.nix and copy it into the folder <code>./machines/YOUR_HOSTNAME</code> overwriting any existing file
</p>
<div class="org-src-container">
<pre class="src src-bash">nixos-generate-config
</pre>
</div></li>
<li><p>
Run the build command to set up the system for the first time
</p>
<div class="org-src-container">
<pre class="src src-bash">sudo nixos-rebuild switch --flake .#YOUR_HOSTNAME
</pre>
</div></li>
</ol>
</div>
</div>
</div>
<div id="outline-container-orge5f0fc9" class="outline-2">
<h2 id="orge5f0fc9"><span class="section-number-2">4.</span> Testing and generating builds</h2>
<div class="outline-text-2" id="text-4">
<p>
At this stage, you should have a functional and reproducible system that can be edited, rebuilt, and extended according to your needs. The foundational structure is now in place, and further customization can occur incrementally through the modular configuration files.
</p>
<p>
From this point onward, development becomes iterative: modify configuration, rebuild the system, verify behavior, and refine. Because the system is declarative, every change remains explicit, reviewable, and reversible.
</p>
<p>
The following sections provide practical guidance for editing and rebuilding, along with an explanation of the repository structure. They describe how the various files relate to one another, how the modular layers are composed, and how the configuration evolved into its current form. Understanding this structure will make future modifications more predictable and easier to maintain.
</p>
<p>
Below are several useful commands for testing configurations, generating builds, and managing system generations. These commands support safe experimentation by allowing you to evaluate changes before switching to them permanently, and to roll back if necessary.
</p>
<p>
To generate the Nix files:
</p>
<div class="org-src-container">
<pre class="src src-bash">emacs README.org --batch -f org-babel-tangle
</pre>
</div>
<p>
To generate this documentation:
</p>
<div class="org-src-container">
<pre class="src src-bash">emacs --batch -l org -l ox-html README.org -f org-html-export-to-html --kill
</pre>
</div>
<p>
Test the build while being able to reboot to previous version
</p>
<div class="org-src-container">
<pre class="src src-bash">sudo nixos-rebuild test --flake .#machine1
</pre>
</div>
<p>
Build and switch to this version on the next reboot
</p>
<div class="org-src-container">
<pre class="src src-bash">sudo nixos-rebuild switch --flake .#machine1
</pre>
</div>
<p>
Build and run in a virtual machine (qemu must be installed)
</p>
<div class="org-src-container">
<pre class="src src-bash">sudo nixos-rebuild build-vm --flake .#machine1
# running the vm:
./result/bin/run-nixos-vm
</pre>
</div>
<p>
Other important files:
</p>
</div>
</div>
<div id="outline-container-org81b6186" class="outline-2">
<h2 id="org81b6186"><span class="section-number-2">5.</span> <code>flake.lock</code> for pinning input versions.</h2>
</div>
<div id="outline-container-org216121a" class="outline-2">
<h2 id="org216121a"><span class="section-number-2">6.</span> <code>assets/*</code> for non-Nix-managed artifacts such as images and wallpapers.</h2>
<div class="outline-text-2" id="text-6">
<p>
Generated outputs should not be edited directly. A CI workflow can tangle and commit generated outputs when they differ.
</p>
</div>
<div id="outline-container-org0cdc018" class="outline-3">
<h3 id="org0cdc018"><span class="section-number-3">6.1.</span> Emacs + Org + Tangle</h3>
</div>
</div>
<div id="outline-container-org3541201" class="outline-2">
<h2 id="org3541201"><span class="section-number-2">7.</span> [<a href="https://www.gnu.org/software/emacs/">Emacs](https://www.gnu.org/software/emacs/][Emacs)</a> is used as the editor and execution environment for this literate configuration.</h2>
</div>
<div id="outline-container-orgf943faf" class="outline-2">
<h2 id="orgf943faf"><span class="section-number-2">8.</span> [<a href="https://orgmode.org/">Org](https://orgmode.org/][Org) mode</a> provides the document structure and the source block execution model used here.</h2>
</div>
<div id="outline-container-orgc88f365" class="outline-2">
<h2 id="orgc88f365"><span class="section-number-2">9.</span> Tangling exports source blocks from this Org document into the corresponding configuration files.</h2>
<div class="outline-text-2" id="text-9">
<ul class="org-ul">
<li>References of the form <code>&lt;&lt;code-id&gt;&gt;</code> are noweb placeholders that are expanded from other blocks during tangling.</li>
</ul>
</div>
<div id="outline-container-org0c43a4d" class="outline-3">
<h3 id="org0c43a4d"><span class="section-number-3">9.1.</span> Nix &amp; NixOS</h3>
</div>
</div>
<div id="outline-container-org7aaa004" class="outline-2">
<h2 id="org7aaa004"><span class="section-number-2">10.</span> [<a href="https://nix.dev/">Nix](https://nix.dev/][Nix)</a> is used to define packages, environments, and configuration as pure expressions.</h2>
</div>
<div id="outline-container-orgf58cbca" class="outline-2">
<h2 id="orgf58cbca"><span class="section-number-2">11.</span> [<a href="https://nixos.org/">NixOS](https://nixos.org/][NixOS)</a> evaluates Nix expressions into a complete system configuration that can be applied by rebuild operations.</h2>
<div class="outline-text-2" id="text-11">
</div>
<div id="outline-container-orgec40543" class="outline-3">
<h3 id="orgec40543"><span class="section-number-3">11.1.</span> Repository layout and folder conventions</h3>
<div class="outline-text-3" id="text-11-1">
<p>
&lt;p&gt;
This repository contains system modules, user modules, and configuration fragments. The following directories are treated as separate layers:
&lt;code&gt;./configuration&lt;/code&gt; (NixOS modules), &lt;code&gt;./home&lt;/code&gt; (Home Manager modules), and &lt;code&gt;./assets/conf&lt;/code&gt; (configuration fragments referenced or deployed by the modules).
&lt;/p&gt;
&lt;p&gt;
To keep navigation consistent, the same internal substructure is used in all three locations. Each layer keeps its role; only the internal grouping is standardized.
&lt;/p&gt;
</p>
</div>
</div>
<div id="outline-container-org1a23dee" class="outline-3">
<h3 id="org1a23dee"><span class="section-number-3">11.2.</span> Shared domain folders</h3>
<div class="outline-text-3" id="text-11-2">
<p>
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;core/&lt;/code&gt; base settings and common infrastructure&lt;/li&gt;
&lt;li&gt;&lt;code&gt;desktop/&lt;/code&gt; graphical session, compositor, UI components, and integration&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apps/&lt;/code&gt; application enablement and application-level configuration&lt;/li&gt;
&lt;li&gt;&lt;code&gt;services/&lt;/code&gt; background services and daemons&lt;/li&gt;
&lt;li&gt;&lt;code&gt;security/&lt;/code&gt; secrets handling and security-related configuration&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dev/&lt;/code&gt; developer tooling and editor configuration&lt;/li&gt;
&lt;/ul&gt;
</p>
</div>
</div>
<div id="outline-container-org45f281a" class="outline-3">
<h3 id="org45f281a"><span class="section-number-3">11.3.</span> Full tree (including unchanged parts)</h3>
<div class="outline-text-3" id="text-11-3">
<p>
The tree below shows the full repository layout, with the standardized internal structure applied only inside
</p>
<div class="org-src-container">
<pre class="src src-bash">├── assets
│   ├── conf
│   │   ├── app.
├── assets
│   ├── conf
│   │   ├── apps
│   │   ├── ollama.nix
│   │   │   ├── flatpaks.conf
│   │   │   └── packages.conf
│   │   ├── core
│   │   │   ├── lightdm.conf
│   │   │   └── lightdm-gtk-greeter.conf
│   │   ├── desktop
│   │   │   ├── hypr
│   │   │   │   ├── bindings.conf
│   │   │   │   ├── hypridle.conf
│   │   │   │   ├── hyprland.conf
│   │   │   │   ├── hyprlock.conf
│   │   │   │   ├── hyprshell
│   │   │   │   │   ├── config.ron
│   │   │   │   │   └── styles.css
│   │   │   │   └── scripts
│   │   │   │   ├── lid-lock.sh
│   │   │   │   ├── lid-restore.sh
│   │   │   │   └── powermenu.sh
│   │   │   ├── wallpaper
│   │   │   │   ├── gif
│   │   │   │   ├── pictures
│   │   │   │   │   ├── 1.jpg
│   │   │   │   │   ├── 2.jpg
│   │   │   │   │   ├── 3.jpg
│   │   │   │   │   ├── 4.png
│   │   │   │   │   ├── 5.jpg
│   │   │   │   │   ├── 6.jpg
│   │   │   │   │   ├── 7.jpg
│   │   │   │   │   ├── 8.jpg
│   │   │   │   │   └── 9.jpg
│   │   │   │   ├── videos
│   │   │   │   │   ├── dark_water_large.mp4
│   │   │   │   │   └── white_blobs_small.mp4
│   │   │   │   └── wallpaper.conf
│   │   │   └── waybar
│   │   │   ├── config.jsonc
│   │   │   └── style.css
│   │   ├── dev
│   │   │   └── terminal
│   │   │   ├── alacritty.toml
│   │   │   ├── aliases.conf
│   │   │   ├── Catppuccin-Mocha.conf
│   │   │   ├── enabled_shells.conf
│   │   │   ├── kitty.conf
│   │   │   ├── starship.toml
│   │   │   └── zsh.conf
│   │   ├── security
│   │   │   └── ssh
│   │   │   └── ssh-client.conf
│   │   └── services
│   ├── lockscreen.png
│   └── scripts
├── configuration
│   ├── apps
│   │   ├── flatpaks.nix
│   │   └── packages.nix
│   ├── core
│   │   ├── boot.nix
│   │   ├── files.nix
│   │   ├── locale.nix
│   │   ├── login-lightdm.nix
│   │   ├── login-tuigreeter.nix
│   │   ├── networking.nix
│   │   └── nix-settings.nix
│   ├── default.nix
│   ├── desktop
│   │   ├── audio.nix
│   │   └── hyprland.nix
│   ├── dev
│   │   └── terminal.nix
│   └── services
│   └── services.nix
├── flake.lock
├── flake.nix
├── hardware
│   └── hardware.nix
├── home
│   ├── apps
│   │   ├── ollama.nix
│   │   ├── defaults-apps.nix
│   │   └── theme.nix
│   ├── default.nix
│   ├── desktop
│   │   ├── animated_wallpaper.nix
│   │   ├── hypridle.nix
│   │   ├── hyprland.nix
│   │   ├── hyprlock.nix
│   │   ├── hyprshell.nix
│   │   ├── powermenu.nix
│   │   ├── rotating_wallpaper.nix
│   │   ├── walker.nix
│   │   └── waybar.nix
│   └── dev
│   ├── alacritty.nix
│   ├── dev.nix
│   ├── emacs
│   │   ├── default.nix
│   │   ├── early-init.el
│   │   └── init.el
│   ├── kitty.nix
│   ├── shells.nix
│   ├── starship.nix
│   └── zsh.nix
├── LICENSE
├── machines
│   └── traveldroid
│   ├── configuration.nix
│   ├── hardware-configuration.nix
│   └── home.nix
├── README.html
├── README.org
└── user.nix
</pre>
</div>
</div>
</div>
<div id="outline-container-org8012694" class="outline-3">
<h3 id="org8012694"><span class="section-number-3">11.4.</span> Notes</h3>
<div class="outline-text-3" id="text-11-4">
<p>
&lt;ul&gt;
&lt;li&gt;Only the internal layout of &lt;code&gt;configuration/&lt;/code&gt;, &lt;code&gt;home/&lt;/code&gt;, and &lt;code&gt;assets/conf/&lt;/code&gt; is standardized; all other paths remain as currently organized.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;services/&lt;/code&gt; and &lt;code&gt;security/&lt;/code&gt; folders are included for completeness even if initially empty in some layers.&lt;/li&gt;
&lt;/ul&gt;
</p>
<p>
<code>YourNixCode(Input) -&gt; System Configuration</code>
</p>
<p>
I use <a href="https://nixos.wiki/wiki/Flakes">nix flakes</a> which means that the entry point for the nix evaluation is a file called <code>flake.nix</code> which has two parts (among other things)
</p>
<div class="org-src-container">
<pre class="src src-nix">{
inputs: # describes the function input, consisting mainly of package sources
outputs: # what the function outputs, a nixos configuration in our case
}
</pre>
</div>
<p>
Nix flakes is still behind an <code>experimental</code> flag, but it is de facto the standard by most of the community.
Flakes allow us to pin the input package versions using a <code>flake.lock</code> file.
This prevents unwanted and surprise updates when rebuilding without changing the configuration.
</p>
</div>
</div>
</div>
<div id="outline-container-org0987aad" class="outline-2">
<h2 id="org0987aad"><span class="section-number-2">12.</span> TLDR App List</h2>
<div class="outline-text-2" id="text-12">
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left">Window Manager</td>
<td class="org-left"><a href="https://hyprland.org/">Hyprland</a></td>
</tr>
<tr>
<td class="org-left">Bar</td>
<td class="org-left"><a href="https://github.com/Alexays/Waybar">Waybar</a></td>
</tr>
<tr>
<td class="org-left">Application Launcher</td>
<td class="org-left"><a href="https://github.com/abenz1267/walker">Walker</a></td>
</tr>
<tr>
<td class="org-left">Terminal Emulator</td>
<td class="org-left"><a href="https://alacritty.org/">Alacritty</a></td>
</tr>
<tr>
<td class="org-left">Shell</td>
<td class="org-left"><a href="https://ohmyz.sh/">Zsh</a> and <a href="https://starship.rs/">Starship</a></td>
</tr>
<tr>
<td class="org-left">Text Editor</td>
<td class="org-left"><a href="https://www.gnu.org/software/emacs/">Emacs</a></td>
</tr>
<tr>
<td class="org-left">File Manager</td>
<td class="org-left"><a href="https://docs.xfce.org/xfce/thunar/start">Thunar</a></td>
</tr>
<tr>
<td class="org-left">Fonts</td>
<td class="org-left"><a href="https://protesilaos.com/codelog/2025-02-12-aporetic-fonts-version-1-1-0/">Aporeti</a></td>
</tr>
<tr>
<td class="org-left">Colors</td>
<td class="org-left"><a href="https://catppuccin.com/">Catppuccin</a></td>
</tr>
<tr>
<td class="org-left">Icons</td>
<td class="org-left"><a href="https://nix.catppuccin.com/">Catppuccin Nix </a></td>
</tr>
<tr>
<td class="org-left">Lock Screen</td>
<td class="org-left"><a href="https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/">Hyprlock</a></td>
</tr>
<tr>
<td class="org-left">Wallpapers</td>
<td class="org-left"><a href="https://github.com/hyprwm/hyprpaper">Hyprpaper</a></td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org7d926a1" class="outline-2">
<h2 id="org7d926a1"><span class="section-number-2">13.</span> Configuration Variables</h2>
<div class="outline-text-2" id="text-13">
<p>
I have a bunch of constant strings that I would rather put in a file. Thats what <code>user.nix</code> is.
The values are imported at the beginning and are available to almost all the functions being called to configure the system.
</p>
<div class="org-src-container">
<pre class="src src-nix">{
system = "x86_64-linux";
username = "henrov";
stateVersion = "25.11";
locale = "nl_NL.UTF-8";
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org3dbdf51" class="outline-2">
<h2 id="org3dbdf51"><span class="section-number-2">14.</span> Flake Inputs</h2>
<div class="outline-text-2" id="text-14">
<p>
The inputs for my system's configuration are very simple
</p>
<ol class="org-ol">
<li><a href="https://search.nixos.org/packages">nixpkgs</a> - the main nix repository of packages. Its huge and growing. Pinned to the unstable release channel.
Sometimes pinned to a specific commit because unstable broke something and the fix hasn't made it into the release yet.</li>
<li><a href="https://nix-community.github.io/home-manager/">home-manager</a> - a nix module that helps keep track of user specific dotfiles and configurations as part of my nix config.</li>
<li><a href="https://github.com/nix-community/emacs-overlay">emacs-overlay</a> - this has more configuration options and generally a newer emacs available provided by the community.</li>
<li><a href="https://nix.catppuccin.com/">catppuccin</a> - nix module that allows everything to be catppuccin themed.</li>
</ol>
<div class="org-src-container">
<pre class="src src-nix">{
description = "Henrov's nixos configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
emacs-overlay = {
url = "github:nix-community/emacs-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
catppuccin = {
url = "github:catppuccin/nix";
inputs.nixpkgs.follows = "nixpkgs";
};
zen-browser = {
url = "github:youwen5/zen-browser-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland.url = "github:hyprwm/Hyprland";
};
&lt;&lt;flake-outputs&gt;&gt;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org301437f" class="outline-2">
<h2 id="org301437f"><span class="section-number-2">15.</span> Flake Output</h2>
<div class="outline-text-2" id="text-15">
<p>
Now that the inputs are ready, the outputs define what the system will actually look like. I also define the machines that this configuration specifies early on. Finally, I iterate over the <code>machines</code> list and pull files from <code>/.machines/${name}</code> subdirectory. This allows me to have configuration that has machine specific configuration limited to those files while also keeping a modular reusable base.
We also add a devshell that makes editing this repository easier in emacs.
</p>
<div class="org-src-container">
<pre class="src src-nix" id="org8c4a196">outputs = inputs@{
nixpkgs,
home-manager,
emacs-overlay,
catppuccin,
hyprland,
...
}:
let
user = import ./user.nix;
lib = nixpkgs.lib;
machines = [
"traveldroid"
];
pkgs = import nixpkgs {
inherit (user) system;
};
in
{
nixosConfigurations = builtins.listToAttrs (
builtins.map (machine: {
name = machine;
value = lib.nixosSystem {
modules = [
# Hyprland configuratie
hyprland.nixosModules.default
({ config, pkgs, inputs, ... }: {
programs.hyprland = {
enable = true;
package = hyprland.packages.${pkgs.system}.hyprland;
};
})
&lt;&lt;flake-emacs-module&gt;&gt;
&lt;&lt;flake-config-module&gt;&gt;
&lt;&lt;flake-home-module&gt;&gt;
catppuccin.nixosModules.catppuccin # theme
];
specialArgs = {
hostname = machine;
inherit user;
inherit inputs;
flakeRoot.outPath= inputs.self;
};
};
}) machines
);
devShells.${user.system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
nil
nixfmt-rfc-style
];
};
};
</pre>
</div>
<p>
Lets look at the individual modules
</p>
<ol class="org-ol">
<li><p>
Emacs
The first is the emacs overlay so that it uses the nix-community emacs overlay from the inputs instead of the nixpkgs one.
Overlays are a special nix way to override existing packages within a repository.
</p>
<div class="org-src-container">
<pre class="src src-nix" id="org34dc677">({ lib, ... }: {
nixpkgs.overlays = [ emacs-overlay.overlays.default ];
})
</pre>
</div></li>
<li><p>
Then the machine specific configuration, in this case, just "traveldroid".
</p>
<div class="org-src-container">
<pre class="src src-nix" id="org1cf7a69">./machines/${machine}/configuration.nix
</pre>
</div></li>
<li><p>
And finally the home-manager module.
This can be initialized and managed on its own but I'd rather use the <code>nixos-rebuild</code> command to build everything instead of managing userland dotfiles separately.
</p>
<div class="org-src-container">
<pre class="src src-nix" id="orgeaa0ac9">home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = {
inherit user inputs;
flakeRoot.outPath= inputs.self;
};
&lt;&lt;flake-home-backup&gt;&gt;
&lt;&lt;flake-home-config&gt;&gt;
}
</pre>
</div>
<ul class="org-ul">
<li><p>
Home-Manager will not overwrite existing configuration files and that is good in most cases, but when everything is declarative like it is here, I'd rather that home-manager create a <code>.backup</code> and replace the file.
</p></li>
</ul>
<div class="org-src-container">
<pre class="src src-nix">home-manager.backupFileExtension = "backup";
</pre>
</div>
<ul class="org-ul">
<li><p>
Finally I pull in the machine specific home configuration. Along with the overrides from catppuccin.
</p></li>
</ul>
<div class="org-src-container">
<pre class="src src-nix">home-manager.users.${user.username} = {
imports = [
./machines/${machine}/home.nix
catppuccin.homeModules.catppuccin
];
};
</pre>
</div></li>
</ol>
</div>
<div id="outline-container-orgff5aaff" class="outline-3">
<h3 id="orgff5aaff"><span class="section-number-3">15.1.</span> Envrc + Direnv</h3>
<div class="outline-text-3" id="text-15-1">
<p>
Editing this file will be much nicer if we have the dev environment configured.
That is done in the devshells section. But to auto load this dev shell, we need a .envrc file.
This tells <a href="https://direnv.net/">direnv</a> to load the devshell in the flake.
#Finally, we also look for a .envrc-private file and try to load that. That contains devshell specific secrets.
</p>
<div class="org-src-container">
<pre class="src src-nix">use flake
watch_file .envrc.private
if [[ -f .envrc.private ]]; then
source_env .envrc.private
fi
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgd121df2" class="outline-2">
<h2 id="orgd121df2"><span class="section-number-2">16.</span> Machines</h2>
<div class="outline-text-2" id="text-16">
<p>
The individual machines subdirectory is configured as follows :-
</p>
<div class="org-src-container">
<pre class="src src-ditaa" id="org9f16d0c">+--machine
| +--configuration.nix
| +--home.nix
| +--hardware-configuration.nix
</pre>
</div>
<ul class="org-ul">
<li>configuration.nix has the system configuration.</li>
<li>home.nix has the user level configuration.</li>
<li>hardware-configuration.nix has the unique hardware configuration.</li>
<li>Note about imports
<code>imports = []</code> in a nix file will pull in the function/object from the list of files provided.
This imported object (or function result) is just trivially merged into a common object.</li>
</ul>
<p>
We can take a look at that the common hardware options I have for all my machines.
</p>
</div>
<div id="outline-container-org02cb6d9" class="outline-4">
<h4 id="org02cb6d9"><span class="section-number-4">16.0.1.</span> Other Utils</h4>
<div class="outline-text-4" id="text-16-0-1">
</div>
<ol class="org-ol">
<li><a id="org624adfb"></a>Updates<br />
<div class="outline-text-5" id="text-16-0-1-1">
<p>
To update the computer, I just need to update the <code>flake.lock</code> file to have references to the latest repository. This is done with :-
</p>
<div class="org-src-container">
<pre class="src src-bash">nix flake update
</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
<div id="outline-container-orgace76ca" class="outline-2">
<h2 id="orgace76ca"><span class="section-number-2">17.</span> Hardware</h2>
<div class="outline-text-2" id="text-17">
<p>
I'll let the code comments explain the file here.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, lib, user, config, ...} :
{
nixpkgs.hostPlatform = lib.mkDefault user.system; # x86_64-linux
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; # enable power saving on the cpu
# update cpu microcode with firmware that allows redistribution
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware = {
# always enable bluetooth
bluetooth.enable = true;
# always enable graphics drivers and enable a bunch of layers for it (including vulkan validation)
graphics = {
enable = true;
extraPackages = with pkgs; [
vulkan-validation-layers # helps catch and debug vulkan crashes
];
};
};
hardware.enableAllFirmware = true; # enable all firmware regardless of license
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgdff4c95" class="outline-2">
<h2 id="orgdff4c95"><span class="section-number-2">18.</span> Configuration</h2>
<div class="outline-text-2" id="text-18">
<p>
This section describes the main system configuration for the computers that I have. Nix will look for a <code>default.nix</code> file if you give it a path to a folder to import. And <code>default.nix</code> looks as follows :-
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, user, ... } :
{
imports = [
./apps/flatpaks.nix
./apps/packages.nix
./core/files.nix
./core/locale.nix
./core/networking.nix
./core/nix-settings.nix
./core/login-tuigreeter.nix
#./core/login-lightdm.nix
./desktop/audio.nix
./desktop/hyprland.nix
./dev/terminal.nix
./core/boot.nix
./services/services.nix
./end_script.nix
];
&lt;&lt;config-system-packages&gt;&gt;
&lt;&lt;config-user&gt;&gt;
&lt;&lt;config-programs&gt;&gt;
&lt;&lt;config-fonts&gt;&gt;
# enable the catppuccin theme for everything with mocha + blue accents
catppuccin.enable = true;
catppuccin.flavor = "mocha";
catppuccin.accent = "blue";
system.stateVersion = user.stateVersion;
}
</pre>
</div>
</div>
<div id="outline-container-org55190ad" class="outline-3">
<h3 id="org55190ad"><span class="section-number-3">18.1.</span> Apps section</h3>
<div class="outline-text-3" id="text-18-1">
<p>
This section describes a way of installing packages, either through nixpkgs or flatpak.
What extra apps to install is decided in the files ./assets/conf/apps/packages.conf and flatpaks.conf.
</p>
</div>
</div>
<div id="outline-container-org7834227" class="outline-3">
<h3 id="org7834227"><span class="section-number-3">18.2.</span> packages.nix</h3>
<div class="outline-text-3" id="text-18-2">
<div class="org-src-container">
<pre class="src src-nix">{ config, lib, pkgs, flakeRoot, inputs, ... }:
let
packagesConfPath = flakeRoot.outPath + "/assets/conf/apps/packages.conf";
raw = builtins.readFile packagesConfPath;
# IMPORTANT: explicit "\n" so we never accidentally split into characters
rawLines = lib.splitString "\n" raw;
# Guard: if we accidentally split into characters, rawLines length ~= stringLength raw
_guard = assert !(
builtins.stringLength raw &gt; 1 &amp;&amp;
builtins.length rawLines == builtins.stringLength raw
); true;
cleanLine = l:
let
noCR = lib.replaceStrings [ "\r" ] [ "" ] l;
noInlineComment = lib.head (lib.splitString "#" noCR);
in
lib.strings.trim noInlineComment;
entries =
builtins.filter (l: l != "")
(map cleanLine rawLines);
resolvePkg = name:
let
parts = lib.splitString "." name;
found = lib.attrByPath parts null pkgs;
in
if found == null then
throw ''
packages.nix: package not found in pkgs
Token : ${builtins.toJSON name}
packages.conf : ${toString packagesConfPath}
Hint : check the attribute name on search.nixos.org/packages
''
else
found;
packages = builtins.seq _guard (map resolvePkg entries);
zenBrowser =
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default;
in
{
environment.systemPackages =
packages
++ [ zenBrowser ];
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orga969618" class="outline-3">
<h3 id="orga969618"><span class="section-number-3">18.3.</span> flatpaks.nix</h3>
<div class="outline-text-3" id="text-18-3">
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, flakeRoot, ... }:
let
moduleName = "install-flatpaks";
flatpakConfPath = flakeRoot.outPath + "/assets/conf/apps/flatpaks.conf";
raw = builtins.readFile flatpakConfPath;
# Explicit "\n" so we never accidentally split into characters
rawLines = lib.splitString "\n" raw;
# Guard: if we accidentally split into characters, rawLines length ~= stringLength raw
_guard = assert !(
builtins.stringLength raw &gt; 1 &amp;&amp;
builtins.length rawLines == builtins.stringLength raw
); true;
cleanLine = l:
let
noCR = lib.replaceStrings [ "\r" ] [ "" ] l;
noInlineComment = lib.head (lib.splitString "#" noCR);
in
lib.strings.trim noInlineComment;
entries =
builtins.filter (l: l != "")
(map cleanLine rawLines);
# Flatpak app IDs are reverse-DNS style like org.example.App (at least 2 dots).
# We'll validate and fail early with a clear message.
dotCount = s: builtins.length (lib.splitString "." s) - 1;
isValidId = s:
(dotCount s) &gt;= 2; # matches the error you're seeing: "at least 2 periods"
_validate =
builtins.seq _guard (
builtins.map (id:
if isValidId id then true else
throw ''
${moduleName}: invalid Flatpak ID in flatpaks.conf (needs reverse-DNS with at least 2 dots)
Token : ${builtins.toJSON id}
flatpaks.conf : ${toString flatpakConfPath}
Fix: remove stray tokens/headers, or comment them out with '#'.
''
) entries
);
# Use validated entries
flatpakApps = builtins.seq _validate entries;
syncFlatpaks = pkgs.writeShellScript "sync-flatpaks" ''
set -euo pipefail
# Use the deployed config path (matches environment.etc below)
CONF="/etc/flatpak/flatpaks.conf"
if [[ -f "$CONF" ]]; then
echo "flatpak-sync: using $CONF"
else
echo "flatpak-sync: WARNING: $CONF not found, using embedded list"
fi
if ! flatpak remotes --system --columns=name | grep -qx flathub; then
flatpak remote-add --system --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
fi
desired_apps=(
${lib.concatStringsSep "\n" (map (a: ''"${a}"'') flatpakApps)}
)
for app in "''${desired_apps[@]}"; do
if ! flatpak info --system "$app" &gt;/dev/null 2&gt;&amp;1; then
flatpak install --system -y --noninteractive flathub "$app"
fi
done
'';
in
{
services.flatpak.enable = true;
xdg.portal = {
enable = true;
};
# Deploy the config file for runtime visibility/debugging
environment.etc."flatpak/flatpaks.conf".source = lib.mkForce flatpakConfPath;
systemd.services.flatpak-sync = {
description = "Install Flatpak apps listed in flatpaks.conf";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = syncFlatpaks;
};
restartTriggers = [ flatpakConfPath ];
path = [ pkgs.flatpak pkgs.coreutils pkgs.gnugrep pkgs.gnused ];
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org6385f17" class="outline-3">
<h3 id="org6385f17"><span class="section-number-3">18.4.</span> Nix Settings</h3>
<div class="outline-text-3" id="text-18-4">
<p>
These are global nix settings that configure the settings for the actual tool.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, user, ... } :
{
nix.settings = {
# enable flakes
experimental-features = ["nix-command" "flakes"];
# add a cache that speed up new applications by downloading binaries
# from the trusted cache instead of compiling from sourcer
substituters = [
"https://nix-community.cachix.org"
];
# trust the cache public key
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
# allow proprietary software on this machine. I'm not a purist.
nixpkgs.config.allowUnfree = true;
# unityhub depends on this... for now
nixpkgs.config.permittedInsecurePackages = [ "libxml2-2.13.8" ];
# this declares how often old configurations are cleared up.
# i cleanup anything older than a week, every week.
nix.gc = {
automatic = true;
options = "--delete-older-than 7d";
dates = "weekly";
};
programs = {
# command line utility that makes applying changes easy and pretty
nh = {
enable = true;
flake = "/home/${user.username}/system";
};
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org04c35a2" class="outline-3">
<h3 id="org04c35a2"><span class="section-number-3">18.5.</span> Boot</h3>
<div class="outline-text-3" id="text-18-5">
<p>
This file has most of the settings the control how the computer boots up.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, ... } :
{
boot = {
initrd = {
verbose = false; # its a lot of logs. dont need it, unless we do.
kernelModules = [ ]; # no kernel modules on boot
};
extraModulePackages = [ ]; # no extra packages on boot either
kernelPackages = pkgs.linuxPackages_latest; # latest greatest linux kernel
kernelParams = [ "silent" ]; # quiet those logs
consoleLogLevel = 0; # quiten more logs
plymouth.enable = true; # graphical boot animation instead
supportedFilesystems = [ "ntfs" ]; # should see the ntfs (windows)
loader = {
systemd-boot.enable = true; # systemd-boot
systemd-boot.configurationLimit = 10;
efi.canTouchEfiVariables = true; # allow editing efi to edit the boot loader
timeout = 5; # grub timeout to make a selection
};
};
}
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org79f56f0" class="outline-2">
<h2 id="org79f56f0"><span class="section-number-2">19.</span> Login</h2>
<div class="outline-text-2" id="text-19">
<p>
Here we control what the login screen would look like. In configuration/default.nix you can choose whether to use tuigreet (very minimalistic) or LightDM (nicer, themeable)
</p>
</div>
<div id="outline-container-org7a11e7d" class="outline-3">
<h3 id="org7a11e7d"><span class="section-number-3">19.1.</span> Tuigreet</h3>
<div class="outline-text-3" id="text-19-1">
<p>
Doesn't match the rest of the aesthetic of the system (with hyprland), but I like its simplicity.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, user, ... } :
{
environment.systemPackages = with pkgs; [
tuigreet
];
services.greetd = {
enable = true;
settings = {
default_session = {
command = pkgs.lib.mkForce "${pkgs.tuigreet}/bin/tuigreet --remember --time --time-format '%I:%M %p | %a • %h | %F'";
};
};
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org5e0b4c0" class="outline-3">
<h3 id="org5e0b4c0"><span class="section-number-3">19.2.</span> LightDM</h3>
<div class="outline-text-3" id="text-19-2">
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, ... }:
let
lightdmConf = builtins.readFile ../../assets/conf/core/lightdm.conf;
lockPng = ../../assets/lockscreen.png;
greeterConfPath = ../../assets/conf/core/lightdm-gtk-greeter.conf;
greeterRaw = builtins.readFile greeterConfPath;
# Extract "key = value" from the greeter conf.
# Returns null if not found.
getIniValue = key:
let
lines = lib.splitString "\n" greeterRaw;
# Captures the value part (group 0) from a single line.
# We match line-by-line because Nix regex does NOT support PCRE flags like (?s).
m =
let
ms = builtins.filter (x: x != null) (map (line:
builtins.match
("^[[:space:]]*" + key + "[[:space:]]*=[[:space:]]*([^#;]+).*$")
line
) lines);
in
if ms == [] then null else builtins.elemAt ms 0;
in
if m == null then null else lib.strings.trim (builtins.elemAt m 0);
# In your greeter.conf these are *package keys*, not theme names.
themePkgKey = getIniValue "theme-name";
iconPkgKey = getIniValue "icon-theme-name";
cursorPkgKey = getIniValue "cursor-theme-name";
cursorSizeStr = getIniValue "cursor-theme-size";
cursorSize =
if cursorSizeStr == null then null
else lib.toInt (lib.strings.trim cursorSizeStr);
# Map package-keys (from greeter.conf) -&gt; { package, name }
#
# IMPORTANT:
# - "name" must be the real theme/icon/cursor NAME as seen under share/themes or share/icons.
# - "package" is the Nixpkgs derivation providing it.
pkgMap = {
catppuccinThemePkg = {
package = pkgs.catppuccin-gtk.override {
accents = [ "blue" ];
variant = "mocha";
size = "standard";
tweaks = [ ];
};
name = "Catppuccin-Mocha-Standard-Blue-Dark";
};
papirus-icon-theme = {
package = pkgs.papirus-icon-theme;
name = "Papirus-Dark";
};
bibata-cursors = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Ice";
};
};
pick = key:
if key == null then
throw "lightdm: missing required key in ${toString greeterConfPath}"
else if !(pkgMap ? "${key}") then
throw "lightdm: unknown package key '${key}' in ${toString greeterConfPath}. Known keys: ${lib.concatStringsSep ", " (builtins.attrNames pkgMap)}"
else
pkgMap."${key}";
themeSel = pick themePkgKey;
iconSel = pick iconPkgKey;
cursorSel = pick cursorPkgKey;
# Rewrite greeter.conf so LightDM sees REAL names, not package keys.
# Also force background to lockPng.
greeterFixed =
''
[greeter]
theme-name = ${themeSel.name}
icon-theme-name = ${iconSel.name}
cursor-theme-name = ${cursorSel.name}
${lib.optionalString (cursorSize != null) "cursor-theme-size = ${toString cursorSize}"}
''
+ "\n"
+ greeterRaw;
in
{
services.greetd.enable = false;
services.xserver = {
enable = true;
desktopManager.xterm.enable = false;
displayManager.lightdm = {
enable = true;
background = lockPng;
greeters.gtk = {
enable = true;
theme = {
name = themeSel.name;
package = themeSel.package;
};
iconTheme = {
name = iconSel.name;
package = iconSel.package;
};
cursorTheme = {
name = cursorSel.name;
package = cursorSel.package;
} // lib.optionalAttrs (cursorSize != null) {
size = cursorSize;
};
# This includes your (rewritten) greeter config.
extraConfig = greeterFixed;
};
extraConfig = lightdmConf;
};
};
programs.hyprland.enable = true;
# Optional: make them available system-wide as well
environment.systemPackages = [
themeSel.package
iconSel.package
cursorSel.package
];
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org5a02489" class="outline-3">
<h3 id="org5a02489"><span class="section-number-3">19.3.</span> Terminal (default system)</h3>
<div class="outline-text-3" id="text-19-3">
<p>
This is the initial system level configuration for the terminal that I use on this machine. Its just <a href="https://ohmyz.sh/">zsh</a>.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, user, ... }:
{
console.useXkbConfig = true;
users.users.${user.username}.shell = pkgs.zsh;
programs.zsh.enable = true;
environment.shells = [ pkgs.zsh ];
environment.pathsToLink = [ "/share/zsh" ];
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orge2f5012" class="outline-3">
<h3 id="orge2f5012"><span class="section-number-3">19.4.</span> Files</h3>
<div class="outline-text-3" id="text-19-4">
<p>
I use Thunar as the file explorer. Also setup a few plugins for <a href="https://docs.xfce.org/xfce/thunar/start">Thunar</a> in this config.
Along with that, a few other utilities like zip and enabling services to automount usb drives.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, user, config, ... }:
{
environment.systemPackages = with pkgs; [
zip
unzip
p7zip
usbutils
udiskie
file-roller
];
programs.thunar = {
enable = true;
plugins = with pkgs; [
thunar-archive-plugin
thunar-media-tags-plugin
thunar-volman
thunar-vcs-plugin
];
};
programs.xfconf.enable = true; # to save thunar settings
services = {
gvfs.enable = true; # Mount, trash, and other functionalities
tumbler.enable = true; # Thumbnail support for images
udisks2.enable = true; # Auto mount usb drives
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org4f2e8d1" class="outline-3">
<h3 id="org4f2e8d1"><span class="section-number-3">19.5.</span> Locale</h3>
<div class="outline-text-3" id="text-19-5">
<p>
I live in Netherlands and would like all my locale and timezone settings to match. Except my default locale.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ user, ... } :
let
locale = user.locale;
defaultLocale = "nl_NL.UTF-8";
in
{
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Select internationalisation properties.
i18n.defaultLocale = defaultLocale;
i18n.extraLocaleSettings = {
LC_ADDRESS = locale;
LC_IDENTIFICATION = locale;
LC_MEASUREMENT = locale;
LC_MONETARY = locale;
LC_NAME = locale;
LC_NUMERIC = locale;
LC_PAPER = locale;
LC_TELEPHONE = locale;
LC_TIME = defaultLocale;
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org75d1a23" class="outline-3">
<h3 id="org75d1a23"><span class="section-number-3">19.6.</span> Networking</h3>
<div class="outline-text-3" id="text-19-6">
<p>
Not much to see here. I want networking to be enabled. I want firewall as well.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, lib, ... }:
{
networking = {
useDHCP = lib.mkDefault true;
networkmanager.enable = true;
networkmanager.wifi.backend = "iwd";
wireless.iwd.enable = true;
wireless.userControlled.enable = true;
firewall = {
enable = true;
# KDE Connect: discovery + encrypted connections
allowedTCPPortRanges = [
{ from = 1714; to = 1764; }
];
allowedUDPPortRanges = [
{ from = 1714; to = 1764; }
];
};
};
environment.systemPackages = with pkgs; [ impala ];
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org84b7afd" class="outline-3">
<h3 id="org84b7afd"><span class="section-number-3">19.7.</span> Hyprland</h3>
<div class="outline-text-3" id="text-19-7">
<p>
This is a big one because the DE needs so much configuration. This section mostly installs <a href="https://hyprland.org/">Hyprland</a>.
The configuration is done in the home manager section.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, ... }:
{
nix.settings = {
substituters = [ "https://hyprland.cachix.org" ];
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
services.dbus.enable = true;
security.polkit.enable = true;
services.flatpak.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
wireplumber.enable = true;
};
services.gvfs.enable = true;
xdg.portal = {
enable = true;
config.common.default = [ "hyprland" "gtk" ];
};
environment.systemPackages = with pkgs; [
walker
uwsm
hyprland-qtutils
hyprpolkitagent
grimblast
];
programs = {
uwsm.enable = true;
uwsm.waylandCompositors.hyprland = {
prettyName = "Hyprland";
comment = "Hyprland compositor managed by UWSM";
binPath = "/run/current-system/sw/bin/Hyprland";
};
hyprland = {
withUWSM = true;
enable = true;
xwayland.enable = true;
};
};
environment.sessionVariables = {
XDG_SESSION_TYPE = "wayland";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
NIXOS_OZONE_WL = "1";
XCURSOR_SIZE = "24";
};
security.pam.services.hyprlock = { };
# Optional; GNOME-specific (keep only if you really use gnome-keyring integration)
security.pam.services.gdm.enableGnomeKeyring = true;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orga3ea630" class="outline-3">
<h3 id="orga3ea630"><span class="section-number-3">19.8.</span> Setting the config</h3>
<div class="outline-text-3" id="text-19-8">
<div class="org-src-container">
<pre class="src src-nix">{ lib, config, pkgs, ... }:
let
scriptPath = "${config.nixpkgs.config}/../assets/scripts/end_script.sh";
scriptExists = builtins.pathExists scriptPath;
in
{
systemd.user.services.endScript = lib.mkIf scriptExists {
description = "Run end script after Home Manager";
wantedBy = [ "multi-user.target" ];
after = [ "home-manager-activate.service" ];
serviceConfig = {
Type = "oneshot";
WorkingDirectory = "${config.nixpkgs.config}/..";
Environment = [
"HOME=${config.users.users.henrov.home}"
];
};
script = ''
${scriptPath}
'';
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org3dfffbc" class="outline-3">
<h3 id="org3dfffbc"><span class="section-number-3">19.9.</span> Services</h3>
<div class="outline-text-3" id="text-19-9">
<p>
These are some of the services that I enable at the system level. Explanation in the comments.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ user, ...} :
{
services = {
blueman.enable = true; # bluetooth manager
fwupd.enable = true; # firmware updating service
fstrim.enable = true; # ssd maintenance service
thermald.enable = true; # thermal regulation service
printing.enable = true; # printing services, cups
gnome.gnome-keyring.enable = true; # keyring
flatpak.enable = true; # allow installing things from flatpaks
#flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# printer discovery
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
};
virtualisation.docker.enable = true; # enable docker
users.users.${user.username}.extraGroups = [ "docker" ]; # add self to docker user group
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orga6e69cf" class="outline-3">
<h3 id="orga6e69cf"><span class="section-number-3">19.10.</span> Audio</h3>
<div class="outline-text-3" id="text-19-10">
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
pipewire
wireplumber
alsa-utils
pulseaudio
pamixer
pavucontrol
];
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
wireplumber.enable = true;
};
security.rtkit.enable = true;
# Helps on many laptops (Intel SOF etc.)
hardware.enableRedistributableFirmware = true;
# Prefer analog over HDMI/DP in a machine-agnostic way
services.pipewire.wireplumber.extraConfig."51-audio-priorities" = {
"monitor.alsa.rules" = [
# De-prioritize HDMI / DisplayPort sinks
{
matches = [
{ "node.name" = "~alsa_output\\..*HDMI.*"; }
{ "node.name" = "~alsa_output\\..*DisplayPort.*"; }
];
actions.update-props = {
"priority.session" = 100;
"priority.driver" = 100;
};
}
# Prefer analog sinks (speakers/headphones)
{
matches = [
{ "node.name" = "~alsa_output\\..*analog.*"; }
{ "node.name" = "~alsa_output\\..*Headphones.*"; }
{ "node.name" = "~alsa_output\\..*Speaker.*"; }
];
actions.update-props = {
"priority.session" = 2000;
"priority.driver" = 2000;
};
}
];
};
# Optional: clear "sticky" user-selected defaults so priority rules win
systemd.user.services.wireplumber-clear-default-nodes = {
description = "Clear WirePlumber saved default nodes (avoid HDMI becoming sticky)";
after = [ "wireplumber.service" ];
partOf = [ "wireplumber.service" ];
wantedBy = [ "default.target" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.coreutils}/bin/rm -f %h/.local/state/wireplumber/default-nodes";
};
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf460ce8" class="outline-3">
<h3 id="orgf460ce8"><span class="section-number-3">19.11.</span> Fonts</h3>
<div class="outline-text-3" id="text-19-11">
<p>
Nothing much to see here. I love <a href="https://protesilaos.com/codelog/2025-02-12-aporetic-fonts-version-1-1-0/">Aporetic</a>, and I use it everywhere.
</p>
<div class="org-src-container">
<pre class="src src-nix" id="orgffa9e6f">fonts.packages = with pkgs; [
aporetic
nerd-fonts.iosevka
];
</pre>
</div>
</div>
</div>
<div id="outline-container-org9eba1c8" class="outline-3">
<h3 id="org9eba1c8"><span class="section-number-3">19.12.</span> User Config</h3>
<div class="outline-text-3" id="text-19-12">
<p>
This creates the user profile that I login with. Initially created during install.
</p>
<div class="org-src-container">
<pre class="src src-nix" id="org10d4ef8">users.users.${user.username} = {
isNormalUser = true;
description = "henrov";
extraGroups = [
"networkmanager" # allow editing network connections
"wheel" # can do sudo
"scanner" # access to the network scanner
"lp" # access to the printer
];
};
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgb6a6e52" class="outline-2">
<h2 id="orgb6a6e52"><span class="section-number-2">20.</span> Home</h2>
<div class="outline-text-2" id="text-20">
<p>
I use home-manager to manage my user level dotfiles and configurations.
Most of the "theme" of the system is decided here.
I also use it to install programs that are okay with being installed at the user level instead of the system.
</p>
</div>
<div id="outline-container-orge23ba3c" class="outline-3">
<h3 id="orge23ba3c"><span class="section-number-3">20.1.</span> default.nix</h3>
<div class="outline-text-3" id="text-20-1">
<p>
This module will import all necessities.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, user, ... } :
{
imports = [
./apps/ollama.nix
./apps/theme.nix
./desktop/hypridle.nix
./desktop/hyprland.nix
./desktop/hyprlock.nix
./desktop/hyprshell.nix
#./desktop/animated_wallpaper.nix
./desktop/rotating_wallpaper.nix
./desktop/waybar.nix
./desktop/walker.nix
./dev/dev.nix
./dev/kitty.nix
./dev/shells.nix
./dev/starship.nix
./dev/zsh.nix
./dev/emacs
];
&lt;&lt;home-user&gt;&gt;
&lt;&lt;home-packages&gt;&gt;
programs.home-manager.enable = true;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org7dd9289" class="outline-3">
<h3 id="org7dd9289"><span class="section-number-3">20.2.</span> Ollama</h3>
<div class="outline-text-3" id="text-20-2">
<p>
This Home Manager Nix module (ai.nix) installs the Ollama package and configures it by reading a simple key-value configuration file (ollama.conf) for settings like the server host and default model. It sets environment variables (OLLAMA<sub>HOST</sub> and OLAMA<sub>DEFAULT</sub><sub>MODEL</sub>) for easy access in your shell or applications, with fallback defaults if the config file is missing or empty. Optionally, it also defines a user-level systemd service to automatically start the Ollama server on NixOS or systems with Home Managers systemd support enabled.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, lib, pkgs, flakeRoot, ... }:
{
services.ollama = {
enable = true;
package = pkgs.ollama;
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org8f75cff" class="outline-3">
<h3 id="org8f75cff"><span class="section-number-3">20.3.</span> Animated Wallpaper</h3>
<div class="outline-text-3" id="text-20-3">
<p>
Sets animated wallpaper ~/nixos<sub>conf</sub>/wallpaperstuff/videos/myWallpaper.mp4
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, flakeRoot, ... }:
let
userVideoPath = ".config/nixos_conf/wallpaperstuff/videos/myWallpaper.mp4";
in
{
home.packages = [
pkgs.mpvpaper
pkgs.mpv
];
systemd.user.services.mpvpaper-wallpaper = {
Unit = {
Description = "Video wallpaper (mpvpaper)";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = ''
${pkgs.mpvpaper}/bin/mpvpaper \
-p \
-o "no-audio --loop-file=inf --no-terminal --really-quiet --panscan=1.0 --keepaspect=yes" \
'*' "${userVideoPath}"
'';
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org27d1a3d" class="outline-3">
<h3 id="org27d1a3d"><span class="section-number-3">20.4.</span> Rotating Wallpaper</h3>
<div class="outline-text-3" id="text-20-4">
<p>
rotating<sub>wallpaper.nix</sub> installs wpaperd and deploys your wallpaper files from the repo (./assets/conf/desktop/wallpaper/pictures/) into ~/conf/desktop/wallpaper/pictures. It also deploys the default wallpaper configuration from assets/conf/desktop/wallpaper/wallpaper.conf into ~/conf/desktop/wallpaper/wallpaper.conf, which is the file you can edit as a user override.
Finally, it creates a systemd user service (wpaperd.service) that automatically starts wpaperd at login and keeps it running, using your override config so wallpapers rotate according to your settings.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, flakeRoot, ... }:
let
userConfPath = "${config.home.homeDirectory}/nixos_conf/wallpaperstuff/wallpaper.conf";
in
{
home.packages = [ pkgs.wpaperd ];
systemd.user.services.wpaperd = {
Unit = {
Description = "wpaperd wallpaper daemon";
After = [ "default.target" ];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}";
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "default.target" ];
};
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org1ad05ef" class="outline-3">
<h3 id="org1ad05ef"><span class="section-number-3">20.5.</span> Waybar</h3>
<div class="outline-text-3" id="text-20-5">
<p>
Mostly styling and enabling modules in the <a href="https://github.com/Alexays/Waybar">top bar</a>.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, lib, pkgs, flakeRoot, ... }:
{
programs.waybar.enable = true;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org408aba2" class="outline-3">
<h3 id="org408aba2"><span class="section-number-3">20.6.</span> Lock Screen</h3>
<div class="outline-text-3" id="text-20-6">
<p>
The lock screen configured using <a href="https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/">hyprlock</a>.
I use <a href="https://wiki.hyprland.org/Hypr-Ecosystem/hypridle/">hypridle</a> to detect idle time and use wlogout to show a logout menu.
They are configured below.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, lib, pkgs, flakeRoot, ... }:
{
home.packages = [ pkgs.hyprlock ];
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org131a4e3" class="outline-3">
<h3 id="org131a4e3"><span class="section-number-3">20.7.</span> Idle Screen</h3>
<div class="outline-text-3" id="text-20-7">
<div class="org-src-container">
<pre class="src src-nix">{ config, lib, pkgs, flakeRoot, ... }:
{
home.packages = [ pkgs.hypridle ];
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org539aa42" class="outline-3">
<h3 id="org539aa42"><span class="section-number-3">20.8.</span> Hyprshell</h3>
<div class="outline-text-3" id="text-20-8">
<p>
For nice task-starting and -switching
</p>
<div class="org-src-container">
<pre class="src src-nix"># home/desktop/hyprshell.nix (Home-Manager module)
{ config, pkgs, lib, flakeRoot, ... }:
{
xdg.enable = true;
home.packages = [ pkgs.hyprshell ];
# Autostart (systemd user service)
systemd.user.services.hyprshell = {
Unit = {
Description = "Hyprshell (window switcher / launcher)";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.hyprshell}/bin/hyprshell";
Restart = "on-failure";
RestartSec = 1;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org088c3a6" class="outline-3">
<h3 id="org088c3a6"><span class="section-number-3">20.9.</span> Hyprland</h3>
<div class="outline-text-3" id="text-20-9">
<p>
This configures the desktop environment along with the peripherals. The comments should explain whats happening.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, lib, pkgs, flakeRoot, ... }:
{
wayland.windowManager.hyprland = {
enable = true;
settings = {
};
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-hyprland
];
config.common.default = [ "gtk" ];
config.hyprland = {
"org.freedesktop.impl.portal.Screencast" = [ "hyprland" ];
"org.freedesktop.impl.portal.RemoteDesktop" = [ "hyprland" ];
};
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org6f00546" class="outline-3">
<h3 id="org6f00546"><span class="section-number-3">20.10.</span> Walker</h3>
<div class="outline-text-3" id="text-20-10">
<p>
<a href="https://github.com/abenz1267/walker">This</a> is how I launch applications. It is bound to Win+Space in the ./asstes/conf/desktop/hypr/bindings.conf.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, flakeRoot, inputs ? null, ... }:
let
walkerPkg =
if inputs != null &amp;&amp; inputs ? walker
then inputs.walker.packages.${pkgs.system}.default
else pkgs.walker;
elephantPkg =
if inputs != null &amp;&amp; inputs ? elephant
then inputs.elephant.packages.${pkgs.system}.default
else pkgs.elephant;
sessionTarget = "graphical-session.target";
in
{
xdg.enable = true;
home.packages = [ walkerPkg elephantPkg ];
systemd.user.services.elephant = { };
systemd.user.services.walker = { };
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org7d0b036" class="outline-3">
<h3 id="org7d0b036"><span class="section-number-3">20.11.</span> Theme</h3>
<div class="outline-text-3" id="text-20-11">
<p>
I use the <a href="https://catppuccin.com/">Catppuccin</a> almost everywhere. The nix module integrates almost automatically everywhere (except gtk).
You'll notice the color values in multiple places outside this as well.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, ...}:
{
gtk = {
enable = true;
colorScheme = "dark";
theme = {
name = "Catppuccin-GTK-Grey-Dark-Compact";
package = (pkgs.magnetic-catppuccin-gtk.override {
accent = [ "grey" ];
shade = "dark";
tweaks = [ "black" ];
size = "compact";
});
};
iconTheme.name = "Papirus-Dark";
};
catppuccin.enable = true;
catppuccin.flavor = "mocha";
catppuccin.accent = "blue";
catppuccin.gtk.icon.enable = true;
catppuccin.cursors.enable = true;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org0cf55cd" class="outline-3">
<h3 id="org0cf55cd"><span class="section-number-3">20.12.</span> Alacritty</h3>
<div class="outline-text-3" id="text-20-12">
<p>
Alacritty gets installed and configured
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, flakeRoot, ... }:
{
xdg.enable = true;
programs.alacritty.enable = true;
catppuccin.alacritty.flavor = "mocha";
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org3d6b48d" class="outline-3">
<h3 id="org3d6b48d"><span class="section-number-3">20.13.</span> Dev Tools</h3>
<div class="outline-text-3" id="text-20-13">
<p>
All the miscellaneous dev tools on this computer.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, ... }:
{
programs = {
vscode.enable = true;
vim.enable = true;
ripgrep.enable = true;
btop.enable = true;
fzf = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
};
zoxide = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
};
eza = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
};
direnv = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
# Zsh-specific config belongs here
zsh = {
# for emacs-eat package
initContent = lib.mkOrder 1200 ''
[ -n "$EAT_SHELL_INTEGRATION_DIR" ] &amp;&amp; \
source "$EAT_SHELL_INTEGRATION_DIR/zsh"
'';
};
git = {
enable = true;
lfs.enable = true;
};
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf57a7b0" class="outline-3">
<h3 id="orgf57a7b0"><span class="section-number-3">20.14.</span> Kitty</h3>
<div class="outline-text-3" id="text-20-14">
<p>
Kitty gets installed and configured
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, flakeRoot, ... }:
{
xdg.enable = true;
programs.kitty = {
enable = true;
extraConfig = ''
# 1) Theme first (stable path)
include themes/Catppuccin-Mocha.conf
# 2) Force transparency last (wins)
#background_opacity 0.60
#dynamic_background_opacity yes
'';
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orge947e83" class="outline-3">
<h3 id="orge947e83"><span class="section-number-3">20.15.</span> Shells</h3>
<div class="outline-text-3" id="text-20-15">
<p>
The aliases mentioned in ./assets/conf/dev/terminal/aliases.conf will be added to enabled shells
</p>
<div class="org-src-container">
<pre class="src src-nix"># shells.nix — Home-Manager module
#
# Reads:
# ${flakeRoot}/assets/conf/shells.nixdev/terminal/enabled_shells.conf
# ${flakeRoot}/assets/conf/dev/terminal/aliases.conf
#
# For each enabled shell in [enabled_shells]:
# - installs/enables shell (where HM has an enable option)
# - if ${flakeRoot}/assets/conf/dev/terminal/&lt;shell&gt;.conf exists, sources it
# - ensures a *user-editable* aliases file exists in the shells default location
# - if a shell is disabled, its aliases file is removed
# .
{ config, pkgs, lib, flakeRoot, ... }:
let
terminalDir = flakeRoot.outPath + "/assets/conf/dev/terminal";
enabledFile = terminalDir + "/enabled_shells.conf";
aliasesFile = terminalDir + "/aliases.conf";
trim = lib.strings.trim;
# ---------- minimal INI-ish parser (sections + raw lines) ----------
readMaybe = p: if builtins.pathExists p then builtins.readFile p else "";
normalizeLine = l: trim (lib.replaceStrings [ "\r" ] [ "" ] l);
parseSections = text:
let
lines = map normalizeLine (lib.splitString "\n" text);
isHeader = l:
let s = l;
in lib.hasPrefix "[" s
&amp;&amp; lib.hasSuffix "]" s
&amp;&amp; builtins.stringLength s &gt;= 3;
nameOf = l: lib.removeSuffix "]" (lib.removePrefix "[" l);
folded =
builtins.foldl'
(st: l:
if l == "" then st else
if isHeader l then st // { current = nameOf l; }
else
let
cur = st.current;
prev = st.sections.${cur} or [];
in
st // { sections = st.sections // { ${cur} = prev ++ [ l ]; }; }
)
{ current = "__root__"; sections = {}; }
lines;
in
folded.sections;
enabledSections = parseSections (readMaybe enabledFile);
aliasSections = parseSections (readMaybe aliasesFile);
# [enabled_shells] lines: key = yes/no
enabledShells =
let
raw = enabledSections.enabled_shells or [];
parseKV = l:
let m = builtins.match ''^([A-Za-z0-9_-]+)[[:space:]]*=[[:space:]]*(.*)$'' l;
in if m == null then null else {
k = trim (builtins.elemAt m 0);
v = lib.toLower (trim (builtins.elemAt m 1));
};
kvs = builtins.filter (x: x != null) (map parseKV raw);
in
map (x: x.k) (builtins.filter (x: x.v == "yes" || x.v == "true" || x.v == "1") kvs);
shellEnabled = shell: builtins.elem shell enabledShells;
# ---------- per-shell repo config file (&lt;shell&gt;.conf) ----------
shellConfPath = shell: terminalDir + "/${shell}.conf";
shellConfExists = shell: builtins.pathExists (shellConfPath shell);
sourceIfExistsSh = p: ''
if [ -f "${toString p}" ]; then
source "${toString p}"
fi
'';
# ---------- aliases section helpers ----------
secLines = name: aliasSections.${name} or [];
secText = name: lib.concatStringsSep "\n" (secLines name);
# Default alias-file locations
bashAliasesPath = "${config.home.homeDirectory}/.bash_aliases";
zshAliasesPath = "${config.home.homeDirectory}/.zsh_aliases";
fishAliasesPath = "${config.xdg.configHome}/fish/conf.d/aliases.fish";
# Seeds (created once; user can edit afterwards)
bashSeed = ''
# Created once from: ${toString aliasesFile}
# Edit freely; Home Manager will not overwrite this file.
#
${secText "bash_zsh"}
${secText "bash_specific"}
'';
zshSeed = ''
# Created once from: ${toString aliasesFile}
# Edit freely; Home Manager will not overwrite this file.
${secText "bash_zsh"}
${secText "zsh_specific"}
'';
# Fish: translate [bash_zsh] POSIX alias lines + append [fish_specific] as-is
parsePosixAlias = l:
let
m = builtins.match ''^[[:space:]]*alias[[:space:]]+([A-Za-z0-9_+-]+)=(.*)$'' l;
in
if m == null then null else
let
name = trim (builtins.elemAt m 0);
rhs0 = trim (builtins.elemAt m 1);
unquote =
if lib.hasPrefix "'" rhs0 &amp;&amp; lib.hasSuffix "'" rhs0 then
lib.removeSuffix "'" (lib.removePrefix "'" rhs0)
else if lib.hasPrefix "\"" rhs0 &amp;&amp; lib.hasSuffix "\"" rhs0 then
lib.removeSuffix "\"" (lib.removePrefix "\"" rhs0)
else
rhs0;
in
{ inherit name; cmd = unquote; };
escapeForFish = s:
lib.replaceStrings
[ "\\" "\"" "$" "`" ]
[ "\\\\" "\\\"" "\\$" "\\`" ]
s;
fishTranslated =
let
parsed = builtins.filter (x: x != null) (map parsePosixAlias (secLines "bash_zsh"));
in
lib.concatStringsSep "\n" (map (a: ''alias ${a.name} "${escapeForFish a.cmd}"'') parsed);
fishSeed = ''
# Created once from: ${toString aliasesFile}
# Edit freely; Home Manager will not overwrite this file.
status is-interactive; or exit
# Translated from [bash_zsh]:
${fishTranslated}
# From [fish_specific]:
${secText "fish_specific"}
'';
in
{
xdg.enable = true;
# Install/enable shells (no login-shell changes)
programs.bash.enable = shellEnabled "bash";
programs.zsh.enable = shellEnabled "zsh";
programs.fish.enable = shellEnabled "fish";
home.packages =
(lib.optionals (shellEnabled "dash") [ pkgs.dash ]) ++
(lib.optionals (shellEnabled "nushell") [ pkgs.nushell ]);
# Source per-shell repo config (if present) AND source the user alias file (if it exists).
# Important: define each option only ONCE.
programs.bash.bashrcExtra = lib.mkIf (shellEnabled "bash") (lib.mkAfter ''
${lib.optionalString (shellConfExists "bash") (sourceIfExistsSh (shellConfPath "bash"))}
if [ -f "${bashAliasesPath}" ]; then
source "${bashAliasesPath}"
fi
'');
programs.zsh.initContent = lib.mkIf (shellEnabled "zsh") (lib.mkAfter ''
${lib.optionalString (shellConfExists "zsh") (sourceIfExistsSh (shellConfPath "zsh"))}
if [ -f "${zshAliasesPath}" ]; then
source "${zshAliasesPath}"
fi
'');
programs.fish.interactiveShellInit = lib.mkIf (shellEnabled "fish") (lib.mkAfter ''
${lib.optionalString (shellConfExists "fish") ''
if test -f "${toString (shellConfPath "fish")}"
source "${toString (shellConfPath "fish")}"
end
''}
if test -f "${fishAliasesPath}"
source "${fishAliasesPath}"
end
'');
# Create/remove alias files based on enabled shells
home.activation.shellAliasesFiles = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
set -euo pipefail
# bash -------------------------------------------------------
if ${if shellEnabled "bash" then "true" else "false"}; then
cat &gt; "${bashAliasesPath}" &lt;&lt;'EOF'
${bashSeed}
EOF
else
rm -f "${bashAliasesPath}"
fi
# zsh -------------------------------------------------------
if ${if shellEnabled "zsh" then "true" else "false"}; then
cat &gt; "${zshAliasesPath}" &lt;&lt;'EOF'
${zshSeed}
EOF
else
rm -f "${zshAliasesPath}"
fi
# fish -------------------------------------------------------
if ${if shellEnabled "fish" then "true" else "false"}; then
mkdir -p "$(dirname "${fishAliasesPath}")"
cat &gt; "${fishAliasesPath}" &lt;&lt;'EOF'
${fishSeed}
EOF
else
rm -f "${fishAliasesPath}"
fi
# fish
if ${if shellEnabled "fish" then "true" else "false"}; then
mkdir -p "$(dirname "${fishAliasesPath}")"
if [ ! -f "${fishAliasesPath}" ]; then
cat &gt; "${fishAliasesPath}" &lt;&lt;'EOF'
${fishSeed}
EOF
fi
else
rm -f "${fishAliasesPath}"
fi
'';
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org90feb92" class="outline-3">
<h3 id="org90feb92"><span class="section-number-3">20.16.</span> Zsh</h3>
<div class="outline-text-3" id="text-20-16">
<p>
Zsh gets installed and configured
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
autocd = true;
dotDir = "${config.xdg.configHome}/zsh";
oh-my-zsh = {
enable = true;
theme = "";
plugins = [
"git"
"sudo"
"extract"
"colored-man-pages"
"command-not-found"
"history"
"docker"
"kubectl"
];
};
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org10ac537" class="outline-3">
<h3 id="org10ac537"><span class="section-number-3">20.17.</span> Starship</h3>
<div class="outline-text-3" id="text-20-17">
<p>
A nice way to make your prompt usefull
</p>
<div class="org-src-container">
<pre class="src src-nix">{ config, pkgs, lib, flakeRoot, ... }:
{
xdg.enable = true;
programs.starship = {
enable = true;
enableZshIntegration = true;
enableBashIntegration = true;
enableFishIntegration = true;
};
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orga2bc6d5" class="outline-3">
<h3 id="orga2bc6d5"><span class="section-number-3">20.18.</span> Other Settings</h3>
<div class="outline-text-3" id="text-20-18">
<p>
Some repeated info from the configuration.
</p>
</div>
<div id="outline-container-orgfc66029" class="outline-4">
<h4 id="orgfc66029"><span class="section-number-4">20.18.1.</span> Home User</h4>
<div class="outline-text-4" id="text-20-18-1">
<div class="org-src-container">
<pre class="src src-nix" id="org79e3d3d">home.username = "${user.username}";
home.homeDirectory = pkgs.lib.mkDefault "/home/${user.username}";
home.stateVersion = user.stateVersion;
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-org13b410e" class="outline-2">
<h2 id="org13b410e"><span class="section-number-2">21.</span> Emacs</h2>
<div class="outline-text-2" id="text-21">
<p>
I practically live inside emacs. The configuration for it is a mix between init.el and the nix configuration.
Nix allows me to install emacs packages as part of the configuration which is most of the following file.
I install the nix community provided emacs overlay that lets me have the latest emacs with pgtk ui (for wayland).
Comments describe the emacs package and what it does.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, ... }:
{
programs.emacs = {
enable = true;
# install with tree sitter enabled
package = (pkgs.emacs-pgtk.override { withTreeSitter = true; });
extraPackages = epkgs: [
# also install all tree sitter grammars
epkgs.manualPackages.treesit-grammars.with-all-grammars
epkgs.nerd-icons # nerd fonts support
epkgs.doom-modeline # model line
epkgs.diminish # hides modes from modeline
epkgs.eldoc # doc support
epkgs.pulsar # pulses the cursor when jumping about
epkgs.which-key # help porcelain
epkgs.expreg # expand region
epkgs.vundo # undo tree
epkgs.puni # structured editing
epkgs.avy # jumping utility
epkgs.consult # emacs right click
epkgs.vertico # minibuffer completion
epkgs.marginalia # annotations for completions
epkgs.crux # utilities
epkgs.magit # git porcelain
epkgs.nerd-icons-corfu # nerd icons for completion
epkgs.corfu # completion
epkgs.cape # completion extensions
epkgs.orderless # search paradigm
epkgs.yasnippet # snippets support
epkgs.yasnippet-snippets # commonly used snippets
epkgs.rg # ripgrep
epkgs.exec-path-from-shell # load env and path
epkgs.eat # better shell
epkgs.rust-mode # rust mode (when rust-ts doesn't cut it)
epkgs.rustic # more rust things
epkgs.nix-mode # nix lang
epkgs.hcl-mode # hashicorp file mode
epkgs.shell-pop # quick shell popup
epkgs.envrc # support for loading .envrc
epkgs.nixpkgs-fmt # format nix files
epkgs.f # string + file utilities
epkgs.gptel # llm chat (mainly claude)
epkgs.catppuccin-theme # catppuccin theme
epkgs.eldoc-box # docs in a box
epkgs.sideline # mainly for flymake errors on the side
epkgs.sideline-flymake # mainly for flymake errors on the side
epkgs.sideline-eglot # mainly for flymake errors on the side
];
};
home.sessionVariables = {
EDITOR = "emacs";
XDG_SCREENSHOTS_DIR = "~/screenshots";
};
home.file = {
emacs-init = {
source = ./early-init.el;
target = ".emacs.d/early-init.el";
};
emacs = {
source = ./init.el;
target = ".emacs.d/init.el";
};
};
services.nextcloud-client = {
enable = true;
};
}
</pre>
</div>
</div>
<div id="outline-container-orgbb6edd4" class="outline-3">
<h3 id="orgbb6edd4"><span class="section-number-3">21.1.</span> Early EMACS Initialization</h3>
<div class="outline-text-3" id="text-21-1">
<p>
There are some emacs settings that can be configured before the gui shows up.
And some of them help increase performance and let the gui show up that much faster.
These are listed here.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp"> ;;; package --- early init -*- lexical-binding: t -*-
;;; Commentary:
;;; Prevents white flash and better Emacs defaults
;;; Code:
(set-language-environment "UTF-8")
(setq-default
default-frame-alist
'((background-color . "#1e1e2e")
(bottom-divider-width . 1) ; Thin horizontal window divider
(foreground-color . "#bac2de") ; Default foreground color
(fullscreen . maximized) ; Maximize the window by default
(horizontal-scroll-bars . nil) ; No horizontal scroll-bars
(left-fringe . 8) ; Thin left fringe
(menu-bar-lines . 0) ; No menu bar
(right-divider-width . 1) ; Thin vertical window divider
(right-fringe . 8) ; Thin right fringe
(tool-bar-lines . 0) ; No tool bar
(undecorated . t) ; Remove extraneous X decorations
(vertical-scroll-bars . nil)) ; No vertical scroll-bars
user-full-name "Henrov henrov" ; ME!
;; memory configuration
;; Higher garbage collection threshold, prevents frequent gc locks, reset later
gc-cons-threshold most-positive-fixnum
;; Ignore warnings for (obsolete) elisp compilations
byte-compile-warnings '(not obsolete)
;; And other log types completely
warning-suppress-log-types '((comp) (bytecomp))
;; Large files are okay in the new millenium.
large-file-warning-threshold 100000000
;; dont show garbage collection messages at startup, will reset later
garbage-collection-messages nil
;; native compilation
package-native-compile t
native-comp-warning-on-missing-source nil
native-comp-async-report-warnings-errors 'silent
;; Read more based on system pipe capacity
read-process-output-max (max (* 10240 10240) read-process-output-max)
;; scroll configuration
scroll-margin 0 ; Lets scroll to the end of the margin
scroll-conservatively 100000 ; Never recenter the window
scroll-preserve-screen-position 1 ; Scrolling back and forth
;; frame config
;; Improve emacs startup time by not resizing to adjust for custom settings
frame-inhibit-implied-resize t
;; Dont resize based on character height / width but to exact pixels
frame-resize-pixelwise t
;; backups &amp; files
backup-directory-alist '(("." . "~/.backups/")) ; Don't clutter
backup-by-copying t ; Don't clobber symlinks
create-lockfiles nil ; Don't have temp files
delete-old-versions t ; Cleanup automatically
kept-new-versions 6 ; Update every few times
kept-old-versions 2 ; And cleanup even more
version-control t ; Version them backups
delete-by-moving-to-trash t ; Dont delete, send to trash instead
;; startup
inhibit-startup-screen t ; I have already done the tutorial. Twice
inhibit-startup-message t ; I know I am ready
inhibit-startup-echo-area-message t ; Yep, still know it
initial-scratch-message nil ; I know it is the scratch buffer!
initial-buffer-choice nil
inhibit-startup-buffer-menu t
inhibit-x-resources t
initial-major-mode 'fundamental-mode
pgtk-wait-for-event-timeout 0.001 ; faster child frames
ad-redefinition-action 'accept ; dont care about legacy things being redefined
inhibit-compacting-font-caches t
;; tabs
tab-width 4 ; Always tab 4 spaces.
indent-tabs-mode nil ; Never use actual tabs.
;; rendering
cursor-in-non-selected-windows nil ; dont render cursors other windows
;; packages
use-package-always-defer t
load-prefer-newer t
default-input-method nil
use-dialog-box nil
use-file-dialog nil
use-package-expand-minimally t
package-enable-at-startup nil
use-package-enable-imenu-support t
auto-mode-case-fold nil ; No second pass of case-insensitive search over auto-mode-alist.
package-archives '(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")
("melpa-stable" . "https://stable.melpa.org/packages/"))
package-archive-priorities '(("gnu" . 99)
("nongnu" . 80)
("melpa" . 70)
("melpa-stable" . 50))
)
;;; early-init.el ends here
</pre>
</div>
</div>
</div>
<div id="outline-container-orgef6058d" class="outline-3">
<h3 id="orgef6058d"><span class="section-number-3">21.2.</span> EMACS Initialization</h3>
<div class="outline-text-3" id="text-21-2">
<p>
Now starts the main emacs configuration.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp">;;; package --- Summary - My minimal Emacs init file -*- lexical-binding: t -*-
;;; Commentary:
;;; Simple Emacs setup I carry everywhere
;;; Code:
(setq custom-file (locate-user-emacs-file "custom.el"))
(load custom-file 'noerror) ;; no error on missing custom file
(require 'package)
(package-initialize)
(defun reset-custom-vars ()
"Resets the custom variables that were set to crazy numbers"
(setopt gc-cons-threshold (* 1024 1024 100))
(setopt garbage-collection-messages t))
(use-package emacs
:custom
(native-comp-async-query-on-exit t)
(read-answer-short t)
(use-short-answers t)
(enable-recursive-minibuffers t)
(which-func-update-delay 1.0)
(visible-bell nil)
(custom-buffer-done-kill t)
(whitespace-line-column nil)
(x-underline-at-descent-line t)
(imenu-auto-rescan t)
(uniquify-buffer-name-style 'forward)
(confirm-nonexistent-file-or-buffer nil)
(create-lockfiles nil)
(make-backup-files nil)
(kill-do-not-save-duplicates t)
(sentence-end-double-space nil)
(treesit-enabled-modes t)
:init
;; base visual
(menu-bar-mode -1) ;; no menu bar
(toggle-scroll-bar -1) ;; no scroll bar
(tool-bar-mode -1) ;; no tool bar either
(blink-cursor-mode -1) ;; stop blinking
;; font of the century
(set-frame-font "Aporetic Sans Mono 12" nil t)
:bind
(("C-&lt;wheel-up&gt;" . pixel-scroll-precision) ; dont zoom in please, just scroll
("C-&lt;wheel-down&gt;" . pixel-scroll-precision) ; dont zoom in either, just scroll
("C-x k" . kill-current-buffer)) ; kill the buffer, dont ask
:hook
(text-mode . delete-trailing-whitespace-mode)
(prog-mode . delete-trailing-whitespace-mode)
(after-init . global-display-line-numbers-mode) ;; always show line numbers
(after-init . column-number-mode) ;; column number in the mode line
(after-init . size-indication-mode) ;; file size in the mode line
(after-init . pixel-scroll-precision-mode) ;; smooth mouse scroll
(after-init . electric-pair-mode) ;; i mean ... parens should auto create
(after-init . reset-custom-vars)
)
(use-package autorevert
:ensure nil
:custom
(auto-revert-interval 3)
(auto-revert-remote-files nil)
(auto-revert-use-notify t)
(auto-revert-avoid-polling nil)
(auto-revert-verbose t)
:hook
(after-init . global-auto-revert-mode))
(use-package recentf
:ensure nil
:commands (recentf-mode recentf-cleanup)
:hook
(after-init . recentf-mode)
:custom
(recentf-auto-cleanup 'never)
(recentf-exclude
(list "\\.tar$" "\\.tbz2$" "\\.tbz$" "\\.tgz$" "\\.bz2$"
"\\.bz$" "\\.gz$" "\\.gzip$" "\\.xz$" "\\.zip$"
"\\.7z$" "\\.rar$"
"COMMIT_EDITMSG\\'"
"\\.\\(?:gz\\|gif\\|svg\\|png\\|jpe?g\\|bmp\\|xpm\\)$"
"-autoloads\\.el$" "autoload\\.el$"))
:config
;; A cleanup depth of -90 ensures that `recentf-cleanup' runs before
;; `recentf-save-list', allowing stale entries to be removed before the list
;; is saved by `recentf-save-list', which is automatically added to
;; `kill-emacs-hook' by `recentf-mode'.
(add-hook 'kill-emacs-hook #'recentf-cleanup -90))
(use-package savehist
:ensure nil
:commands (savehist-mode savehist-save)
:hook
(after-init . savehist-mode)
:custom
(savehist-autosave-interval 600)
(savehist-additional-variables
'(kill-ring ; clipboard
register-alist ; macros
mark-ring global-mark-ring ; marks
search-ring regexp-search-ring)))
(use-package hl-line
:ensure nil
:custom
(hl-line-sticky-flag nil)
(global-hl-line-sticky-flag nil)
:hook
(after-init . global-hl-line-mode))
(use-package saveplace
:ensure nil
:commands (save-place-mode save-place-local-mode)
:hook
(after-init . save-place-mode)
:custom
(save-place-limit 400))
(use-package nerd-icons
:custom
;; disable bright icon colors
(nerd-icons-color-icons nil))hells.nix
(use-package doom-modeline
:custom
(inhibit-compacting-font-caches t) ;; speed
(doom-modeline-buffer-file-name-style 'relative-from-project)
(doom-modeline-major-mode-icon nil) ;; distracting icons, no thank you
(doom-modeline-buffer-encoding nil) ;; everything is utf-8 anyway
(doom-modeline-buffer-state-icon nil) ;; the filename already shows me
(doom-modeline-lsp nil) ;; lsp state is too distracting, too often
:hook (after-init . doom-modeline-mode))
(load-theme 'catppuccin :no-confirm)
(use-package diminish :demand t) ;; declutter the modeline
(use-package eldoc
:diminish eldoc-mode
:custom
(eldoc-echo-area-use-multiline-p nil)) ;; docs for everything
(use-package eldoc-box
:defer t
:config
(set-face-background 'eldoc-box-border (catppuccin-color 'green))
(set-face-background 'eldoc-box-body (catppuccin-color 'base))
:bind
(("M-h" . eldoc-box-help-at-point)))
(use-package pulsar
:commands pulsar-global-mode pulsar-recenter-top pulsar-reveal-entry
:init
(defface pulsar-catppuccin
`((default :extend t)
(((class color) (min-colors 88) (background light))
:background ,(catppuccin-color 'sapphire))
(((class color) (min-colors 88) (background dark))
:background ,(catppuccin-color 'sapphire))
(t :inverse-video t))
"Alternative nord face for `pulsar-face'."
:group 'pulsar-faces)
:custom
(pulsar-face 'pulsar-catppuccin)
:hook
(after-init . pulsar-global-mode))
(use-package which-key
:commands which-key-mode
:diminish which-key-mode
:hook
(after-init . which-key-mode))
(use-package expreg
:bind ("M-m" . expreg-expand))
(use-package vundo) ;; undo tree
;; better structured editing
(use-package puni
:commands puni-global-mode
:hook
(after-init . puni-global-mode))
(use-package avy
:bind
("M-i" . avy-goto-char-2)
:custom
(avy-background t))
(use-package consult
:bind
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("M-y" . consult-yank-pop) ;; orig. yank-pop
("M-g M-g" . consult-goto-line) ;; orig. goto-line
("M-g i" . consult-imenu) ;; consult version is interactive
("M-g r" . consult-ripgrep) ;; find in project also works
:custom
(consult-narrow-key "&lt;"))
(use-package vertico
:commands vertico-mode
:custom
(read-file-name-completion-ignore-case t)
(read-buffer-completion-ignore-case t)
(completion-ignore-case t)
(enable-recursive-minibuffers t)
(minibuffer-prompt-properties '(read-only t cursor-intangible t face minibuffer-prompt))
:init
(vertico-mode)
:hook
(minibuffer-setup-hook . cursor-intangible-mode))
(use-package marginalia
:commands marginalia-mode
:hook (after-init . marginalia-mode))
(use-package crux
:bind
("C-c M-e" . crux-find-user-init-file)
("C-c C-w" . crux-transpose-windows)
("C-c M-d" . crux-find-current-directory-dir-locals-file)
("C-a" . crux-move-beginning-of-line))
(use-package magit
:bind (("C-M-g" . magit-status)))
(use-package nerd-icons-corfu
:commands nerd-icons-corfu-formatter
:defines corfu-margin-formatters)
(use-package corfu
:commands global-corfu-mode
:custom
(corfu-cycle t)
(corfu-auto t)
(corfu-auto-delay 1)
(corfu-auto-prefix 3)
(corfu-separator ?_)
:hook
(after-init . global-corfu-mode)
:config
(add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter))
(use-package cape)
(use-package orderless
:custom
(completion-styles '(orderless partial-completion basic))
(completion-category-defaults nil)
(completion-category-overrides nil))
(use-package yasnippet
:commands yas-global-mode
:diminish yas-minor-mode
:hook
(after-init . yas-global-mode))
(use-package yasnippet-snippets :after yasnippet)
(use-package exec-path-from-shell
:commands exec-path-from-shell-initialize
:custom
(exec-path-from-shell-arguments nil)
:hook
(after-init . exec-path-from-shell-initialize))
(use-package nixpkgs-fmt
:custom
(nixpkgs-fmt-command "nixfmt"))
(use-package eat
:bind
(("C-c e p" . eat-project)
("C-c e t" . eat)))
(use-package f :demand t)
(use-package envrc
:commands envrc-global-mode
:hook
(after-init . envrc-global-mode))
(use-package gptel
:commands gptel-make-anthropic f-read-text
:config
(gptel-make-anthropic "Claude"
:stream t :key (f-read-text "/run/secrets/claude_key")))
(use-package sideline-flymake)
(use-package sideline-eglot)
(use-package sideline
:custom
(sideline-backends-right '(sideline-flymake sideline-eglot))
:hook
(eglot-managed-mode . sideline-mode)
(flymake-mode . sideline-mode))
(use-package eglot
:custom
(eglot-extend-to-xref t)
(eglot-ignored-server-capabilities '(:inlayHintProvider))
(jsonrpc-event-hook nil)
:hook
(eglot-managed-mode . eldoc-box-hover-mode)
(before-save . eldoc-format-buffer)
:bind
(:map eglot-mode-map
("C-c l a" . eglot-code-actions)
("C-c l r" . eglot-rename)
("C-c l h" . eldoc)
("C-c l g" . xref-find-references)
("C-c l w" . eglot-reconnect)))
(use-package proced
:custom
(proced-auto-update-flag t)
(proced-auto-update-interval 3)
(proced-enable-color-flag t)
(proced-show-remote-processes t))
(use-package org
:ensure t
:defer t
:commands (org-mode org-capture org-agenda)
:init
(defvar org-journal-file "~/nextcloud/org/journal.org")
(defvar org-archive-file "~/nextcloud/org/archive.org")
(defvar org-notes-file "~/nextcloud/org/notes.org")
(defvar org-inbox-file "~/nextcloud/org/inbox.org")
(defvar org-work-file "~/nextcloud/org/work.org")
(defun my/org-capture-project-target-heading ()
"Determine Org target headings from the current file's project path.
This function assumes a directory structure like '~/projects/COMPANY/PROJECT/'.
It extracts 'COMPANY' and 'PROJECT' to use as nested headlines
for an Org capture template.
If the current buffer is not visi
ting a file within such a
project structure, it returns nil, causing capture to default to
the top of the file."
(when-let* ((path (buffer-file-name))) ; Ensure we are in a file-visiting buffer
(let ((path-parts (split-string path "/" t " ")))
(when-let* ((projects-pos (cl-position "projects" path-parts :test #'string=))
(company (nth (+ 1 projects-pos) path-parts))
(project (nth (+ 2 projects-pos) path-parts)))
;; Return a list of headlines for Org to find or create.
(list company project)))))
:bind
(("C-c c" . org-capture)
("C-c i" . org-store-link)
("C-c a" . org-agenda)
:map org-mode-map
("C-c t" . org-toggle-inline-images)
("C-c l" . org-toggle-link-display))
:custom
(org-agenda-files (list org-inbox-file org-journal-file))
(org-directory "~/nextcloud/org")
(org-default-notes-file org-inbox-file)
(org-archive-location (concat org-archive-file "::* From %s"))
(org-log-done 'time)
(org-log-into-drawer t)
(org-hide-emphasis-markers t)
(org-src-fontify-natively t)
(org-src-tab-acts-natively t)
(org-capture-templates '(("t" "Todo" entry (file org-inbox-file)
"* TODO %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n%a\n\n)")
("j" "Journal" entry (file+olp+datetree org-journal-file)
"* %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n%a\n\n")
("n" "Note" entry (file org-notes-file)
"* %?\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n%a\n\n")
("p" "Project Task" item
(file+function org-work-file my/org-capture-project-target-heading)
"* TODO %? \n CLOCK: %U"
))
)
:config
;; Enable syntax highlighting in code blocks
(add-hook 'org-mode-hook 'turn-on-font-lock)
(add-hook 'org-mode-hook 'org-indent-mode))
;; extras
(use-package comp-run
:ensure nil
:config
(push "tramp-loaddefs.el.gz" native-comp-jit-compilation-deny-list)
(push "cl-loaddefs.el.gz" native-comp-jit-compilation-deny-list))
(use-package rustic
:custom
(rustic-lsp-client 'eglot))
(provide 'init)
;;; init.el ends here
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org60a0392" class="outline-2">
<h2 id="org60a0392"><span class="section-number-2">22.</span> Machines</h2>
<div class="outline-text-2" id="text-22">
<p>
Only a few more things left. Specifically the machine level extra settings.
</p>
</div>
<div id="outline-container-orga19a1eb" class="outline-3">
<h3 id="orga19a1eb"><span class="section-number-3">22.1.</span> Traveldroid</h3>
<div class="outline-text-3" id="text-22-1">
<p>
The configuration for the laptop does not change much. Most changes are because the hardware is different.
</p>
</div>
<div id="outline-container-org56a4595" class="outline-4">
<h4 id="org56a4595"><span class="section-number-4">22.1.1.</span> System Level</h4>
<div class="outline-text-4" id="text-22-1-1">
<p>
Anything specific for the laptop.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ user, ... } : {
imports =
[
./hardware-configuration.nix
../../configuration
];
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org09cb6f5" class="outline-4">
<h4 id="org09cb6f5"><span class="section-number-4">22.1.2.</span> Hardware</h4>
<div class="outline-text-4" id="text-22-1-2">
<p>
This is the most different. Mostly taken from hardware-configuration.nix setup at first install.
</p>
<div class="org-src-container">
<pre class="src src-nix">{
hostname,
pkgs,
lib,
modulesPath,
user,
config,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
../../hardware/hardware.nix
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_usb_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/69433a14-fbaf-401b-af85-cd1bbf02b4e2";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/811D-0676";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/b6c557c2-7682-460b-a5e7-8f6f2f429a3a"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org0b35763" class="outline-4">
<h4 id="org0b35763"><span class="section-number-4">22.1.3.</span> Home</h4>
<div class="outline-text-4" id="text-22-1-3">
<p>
This is mostly about configuring the monitor. And laptop specific utilities.
</p>
<div class="org-src-container">
<pre class="src src-nix">{ pkgs, ... }:
{
imports = [
../../home
];
home.packages = with pkgs; [
brightnessctl
];
wayland.windowManager.hyprland = {
extraConfig = ''
# Default portable monitor rule
monitor=DP-1,3840x1080@144,1920x0,1
'';
};
}
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-org7036399" class="outline-2">
<h2 id="org7036399"><span class="section-number-2">23.</span> README Utils</h2>
<div class="outline-text-2" id="text-23">
</div>
<div id="outline-container-org50cd08e" class="outline-4">
<h4 id="org50cd08e"><span class="section-number-4">23.0.1.</span> Headers</h4>
<div class="outline-text-4" id="text-23-0-1">
<p>
This script adds a <code>DO NOT MODIFY</code> header to all the generated nix files.
</p>
<div class="org-src-container">
<pre class="src src-emacs-lisp" id="org22e82b3">(progn
(defun add-tangle-headers ()
(message "running in %s" (buffer-file-name))
(when (string= (file-name-extension (buffer-file-name)) "nix")
(goto-char (point-min))
(insert "# WARNING : This file was generated by README.org\n# DO NOT MODIFY THIS FILE!\n# Any changes made here will be overwritten.\n")
(save-buffer))
(save-buffer))
(add-hook 'org-babel-post-tangle-hook 'add-tangle-headers))
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: henrov</p>
<p class="date">Created: 2026-03-04 wo 15:07</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>