Compare commits
114
Commits
721d607a1c
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6163eb0396 | ||
|
|
2261e4b792 | ||
|
|
995bdaa973 | ||
|
|
e93d8a43cf | ||
|
|
b4afb529a8 | ||
|
|
4bc670e1e5 | ||
|
|
c1b44e049c | ||
|
|
1aff05b4f2 | ||
|
|
b62212ad0c | ||
|
|
1b3468185b | ||
|
|
72b9eb053d | ||
|
|
a6afe699fb | ||
|
|
1f3c1a7d18 | ||
|
|
9dfa0f5e58 | ||
|
|
8f6e3a58b3 | ||
|
|
1313d962ad | ||
|
|
731b646def | ||
|
|
92eaa865e4 | ||
|
|
fee4090bf6 | ||
|
|
f1184b28da | ||
|
|
a9aa41ff02 | ||
|
|
f8314da86b | ||
|
|
defc576767 | ||
|
|
8474997bc3 | ||
|
|
c16f62fb2a | ||
|
|
ff6e7d5032 | ||
|
|
8fa8cad28c | ||
|
|
3652fe397a | ||
|
|
2da26a2c0c | ||
|
|
203dc0c159 | ||
|
|
b69701dbc2 | ||
|
|
7c45fbe440 | ||
|
|
4322ae8c39 | ||
|
|
7e87b775d0 | ||
|
|
320b61eb37 | ||
|
|
04fcabfe9d | ||
|
|
3064c2db08 | ||
|
|
20d15ab317 | ||
|
|
1ceeca785f | ||
|
|
df77c3ef6f | ||
|
|
64560b37ae | ||
|
|
664487ab9a | ||
|
|
8bae140a4e | ||
|
|
c57a207f60 | ||
|
|
759c6652ba | ||
|
|
7f69390afd | ||
|
|
1b228bb467 | ||
|
|
2b1f075617 | ||
|
|
8893741d36 | ||
|
|
6b845b68fc | ||
|
|
5ef2025673 | ||
|
|
8f529cb491 | ||
|
|
86ec058ac7 | ||
|
|
b50dfa98b7 | ||
|
|
16433b310d | ||
|
|
f8bb273d65 | ||
|
|
239d47a396 | ||
|
|
78c17b9381 | ||
|
|
ac2441493f | ||
|
|
318dc0ef08 | ||
|
|
f6847f6c2a | ||
|
|
8098fe2daf | ||
|
|
102b485fd2 | ||
|
|
13a299f61f | ||
|
|
04c2900d81 | ||
|
|
c2254cc13d | ||
|
|
1c93929ad1 | ||
|
|
be62be1ae6 | ||
|
|
06ee05cf46 | ||
|
|
6d1af69a54 | ||
|
|
a05e98a94c | ||
|
|
d01eef5861 | ||
|
|
cd4b52cdce | ||
|
|
ff528d07ac | ||
|
|
337d1a9014 | ||
|
|
da8ba03f55 | ||
|
|
8046f88d98 | ||
|
|
18b2a09cd8 | ||
|
|
deb489df45 | ||
|
|
e19bae5c29 | ||
|
|
4c4e64cbe7 | ||
|
|
40b326eceb | ||
|
|
9756ab7d0b | ||
|
|
ecbbbd70e9 | ||
|
|
ece8fd9a3a | ||
|
|
08ae538dff | ||
|
|
4dc97abef9 | ||
|
|
ff5394c7b2 | ||
|
|
fbb36aceef | ||
|
|
dfd09539b2 | ||
|
|
a19ed0aec6 | ||
|
|
aa5708a28d | ||
|
|
259ebf85c4 | ||
|
|
46ad7843ea | ||
|
|
f9342dc8e6 | ||
|
|
c2ab7620b0 | ||
|
|
e789903c53 | ||
|
|
7c5e14c905 | ||
|
|
4d9b5e6034 | ||
|
|
3597e035d3 | ||
|
|
a1b08b151d | ||
|
|
bdeabc05cc | ||
|
|
7a26d6dde4 | ||
|
|
575db4b50c | ||
|
|
3120028147 | ||
|
|
e6d817417a | ||
|
|
7a93e89074 | ||
|
|
7c21ff73d1 | ||
|
|
97dd1e401a | ||
|
|
ea67b8fa65 | ||
|
|
69c2c4c412 | ||
|
|
5e3461fdb2 | ||
|
|
31464c604f | ||
|
|
d82dbff90c |
No files matched your search
@@ -0,0 +1,14 @@
|
||||
---
|
||||
trigger: always_on
|
||||
description: Consult the graphify knowledge graph at graphify-out/ for codebase and architecture questions.
|
||||
---
|
||||
|
||||
## graphify
|
||||
|
||||
This project has a graphify knowledge graph at graphify-out/.
|
||||
|
||||
Rules:
|
||||
- For codebase or architecture questions, when `graphify-out/graph.json` exists, first run `graphify query "<question>"` (CLI) or `query_graph` (MCP). Use `graphify path "<A>" "<B>"` / `shortest_path` for relationships and `graphify explain "<concept>"` / `get_node` for focused concepts. These return a scoped subgraph, usually much smaller than `GRAPH_REPORT.md` or raw grep output.
|
||||
- If graphify-out/wiki/index.md exists, navigate it instead of reading raw files
|
||||
- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context
|
||||
- After modifying code files in this session, run `graphify update .` to keep the graph current (AST-only, no API cost)
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: graphify
|
||||
description: Turn any folder of files into a navigable knowledge graph
|
||||
---
|
||||
|
||||
# Workflow: graphify
|
||||
|
||||
Follow the graphify skill to run the full pipeline.
|
||||
|
||||
If no path argument is given, use `.` (current directory).
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# .githooks/pre-commit - Git pre-commit hook running automated quality checks
|
||||
set -euo pipefail
|
||||
|
||||
# Ensure NixOS user profile binaries are in PATH
|
||||
export PATH="/etc/profiles/per-user/${USER:-kiskaadee}/bin:$HOME/.nix-profile/bin:$PATH"
|
||||
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
echo "🚀 [pre-commit] Running automated verification & static analysis suite..."
|
||||
exec "$REPO_ROOT/scripts/test"
|
||||
@@ -7,3 +7,6 @@ result-*
|
||||
|
||||
|
||||
.ruff_cache/
|
||||
|
||||
# Graphify knowledge graph outputs & caches
|
||||
graphify-out/
|
||||
+8
-4
@@ -1,12 +1,16 @@
|
||||
keys:
|
||||
- &server age18q3lr2z4yeg2f86my42ym4hx0dvcwgjshmchyhdkgwvf4k37dsyq3mcjse
|
||||
- &laptop age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg
|
||||
- &anne age1utkr8d88ezkwwf7aarpgg8ujqa8jmqtrjxvcau7yctjey66sngpqcr8fmx
|
||||
|
||||
creation_rules:
|
||||
- path_regex: hosts/(server|laptop)/secrets\.yaml$
|
||||
- path_regex: anne-secrets\.yaml$
|
||||
key_groups:
|
||||
- pgp: []
|
||||
age:
|
||||
- *laptop
|
||||
- *anne
|
||||
- path_regex: secrets\.yaml$
|
||||
key_groups:
|
||||
- pgp: []
|
||||
age:
|
||||
- *server
|
||||
- *laptop
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## Mission & Purpose
|
||||
|
||||
This repository manages the declarative NixOS and Home Manager configurations for `desktop` and `laptop` hosts.
|
||||
This repository manages the declarative NixOS and Home Manager configuration for the `laptop` mobile workstation host.
|
||||
|
||||
AI agents working in this repository must maintain architectural integrity, avoid configuration sprawl, respect pre-existing work, and adhere strictly to the invariants defined in `architecture.md`.
|
||||
|
||||
@@ -37,10 +37,7 @@ Repository
|
||||
# Validate flake metadata, inputs, and derivations
|
||||
nix flake check
|
||||
|
||||
# Build desktop host dryly (evaluates configuration without switching)
|
||||
nix build .#nixosConfigurations.desktop.config.system.build.toplevel --no-link
|
||||
|
||||
# Build laptop host dryly
|
||||
# Build laptop host dryly (evaluates configuration without switching)
|
||||
nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link
|
||||
```
|
||||
|
||||
@@ -72,16 +69,17 @@ nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link
|
||||
- **Capture Out-of-Scope Ideas in Second Brain**: When the user mentions a new idea, feature request, or architectural concept unrelated to the immediate active task, record a note in `/home/kiskaadee/Brain/` (or suggest logging it) so valuable insights are preserved without disrupting current execution scope.
|
||||
|
||||
### 4. Package Placement Rules
|
||||
- **Shared User Applications**: Place in `modules/user/` (with `apps.nix` as the default central application module).
|
||||
- **Host-Specific User Tools**: Place in `hosts/<host>/home.nix` (e.g., Hyprland screen recording utilities on desktop).
|
||||
- **System-Wide Packages**: Place in `modules/system/base.nix` *only* if required for root maintenance, core networking, or systemd daemons.
|
||||
- **Developer Tools, Compilers, LSPs**: Place in `home/dev.nix`.
|
||||
- **Graphical Applications & Desktop Tools**: Place in `home/desktop.nix`.
|
||||
- **Terminal Utilities & Shell Integration**: Place in `home/shell.nix`.
|
||||
- **System-Wide Daemons & Hardware Support**: Place in `system/core.nix` or `system/hardware.nix` *only* if required for root maintenance, core networking, or systemd daemons.
|
||||
|
||||
### 5. Host Isolation & Desktop Specialisation
|
||||
- Keep machine-specific homelab infrastructure (`homeserver.nix`, `traefik-deployments.nix`, `dynu.nix`) under `hosts/desktop/`. Never import them into `hosts/laptop/`.
|
||||
- Protect the desktop `specialisation.server`. Any changes to graphical or audio stacks must preserve the headless server boot profile.
|
||||
### 5. Homelab Infrastructure Decoupling
|
||||
- Production homelab services, Traefik edge proxying, Docker container deployments, and DDNS automation live exclusively in the `Core` repository (`~/Projects/active/homelab/Core`).
|
||||
- Never import or re-introduce server daemon definitions into this workstation repository.
|
||||
|
||||
### 6. Hardware Configurations
|
||||
- `hardware-configuration.nix` files are generated by `nixos-generate-config`. Do not manually restructure, clean up, or refactor them. Hardware additions (e.g., kernel parameters, disk mounts) require explicit justification.
|
||||
- `system/hardware-configuration.nix` is generated by `nixos-generate-config`. Do not manually restructure, clean up, or refactor it. Hardware additions (e.g., kernel parameters, disk mounts) require explicit justification.
|
||||
|
||||
### 7. Secrets & Key Safety (SOPS)
|
||||
- **Never write or commit plaintext secrets** into `.nix`, `.yaml`, or temporary files.
|
||||
@@ -101,9 +99,9 @@ nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link
|
||||
|
||||
| Tier | Category | Examples | Required Action & Workflow |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **LOW** | User Configuration | User packages in `apps.nix`, shell aliases, Neovim lua config, Tmux settings, docs. | **Autonomous**: Agent plans, edits, and validates via `nix flake check` + affected host build. |
|
||||
| **MEDIUM** | Shared System & Desktop | `modules/system/*`, greetd/display manager, firewall rules, user groups, new flake inputs. | **Autonomous**: Agent plans, edits, and validates via `nix flake check` + builds **both** `desktop` and `laptop`. |
|
||||
| **HIGH** | Core & Infrastructure | Bootloader, filesystems, SOPS keys/secrets setup, `specialisation.server`, Traefik, Docker networking. | **Stop & Wait**: Agent must present the plan and **wait for user approval before editing**. |
|
||||
| **LOW** | User Configuration | User packages in `home/dev.nix`, shell aliases in `home/shell.nix`, Neovim lua config, docs. | **Autonomous**: Agent plans, edits, and validates via `nix flake check` + laptop build. |
|
||||
| **MEDIUM** | System & Desktop Stack | `system/core.nix`, `system/desktop.nix`, greetd/DMS, firewall rules, user groups, new flake inputs. | **Autonomous**: Agent plans, edits, and validates via `nix flake check` + laptop build. |
|
||||
| **HIGH** | Core Hardware & Boot | Bootloader, filesystem mounts, SOPS keys setup, kernel module changes. | **Stop & Wait**: Agent must present the plan and **wait for user approval before editing**. |
|
||||
| **PROHIBITED** | Live System Mutators | `nixos-rebuild switch`, destructive disk ops, editing `/etc` outside Nix, rotating age keys, plaintext secrets. | **Blocked**: Cannot execute unless explicitly commanded by the user in the current prompt. |
|
||||
|
||||
---
|
||||
@@ -117,7 +115,7 @@ REQUEST
|
||||
│
|
||||
▼
|
||||
1. UNDERSTAND
|
||||
├── Identify affected host(s) and trace consumer import chain
|
||||
├── Identify affected components in system/ or home/
|
||||
├── Check `git status` to identify pre-existing uncommitted work
|
||||
└── Read architectural boundaries in architecture.md
|
||||
│
|
||||
@@ -135,7 +133,7 @@ REQUEST
|
||||
▼
|
||||
4. VALIDATE
|
||||
├── Run `nix flake check`
|
||||
└── Build all downstream affected hosts (`--no-link`)
|
||||
└── Build laptop host (`--no-link`): `nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link`
|
||||
│
|
||||
▼
|
||||
5. REVIEW
|
||||
@@ -149,18 +147,13 @@ REQUEST
|
||||
|
||||
---
|
||||
|
||||
## Host-Aware Validation Matrix
|
||||
## Validation Matrix
|
||||
|
||||
> [!NOTE]
|
||||
> The matrix below is a default heuristic. When the import graph indicates additional downstream consumers, validate those configurations as well.
|
||||
|
||||
| Modified Path | Affected Consumers | Required Build Validation |
|
||||
| Modified Path | Affected Consumer | Required Build Validation |
|
||||
| :--- | :--- | :--- |
|
||||
| `modules/system/*` | `desktop`, `laptop` | `nix flake check`<br>`nix build .#nixosConfigurations.desktop.config.system.build.toplevel --no-link`<br>`nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link` |
|
||||
| `modules/user/*` or `home.nix` | `desktop`, `laptop` | `nix flake check`<br>`nix build .#nixosConfigurations.desktop.config.system.build.toplevel --no-link`<br>`nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link` |
|
||||
| `hosts/desktop/*` | `desktop` only | `nix flake check`<br>`nix build .#nixosConfigurations.desktop.config.system.build.toplevel --no-link` |
|
||||
| `hosts/laptop/*` | `laptop` only | `nix flake check`<br>`nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link` |
|
||||
| `flake.nix` / `flake.lock` | `desktop`, `laptop` | `nix flake check` + build both hosts |
|
||||
| `system/*` | `laptop` | `nix flake check`<br>`nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link` |
|
||||
| `home/*` | `laptop` | `nix flake check`<br>`nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link` |
|
||||
| `flake.nix` / `flake.lock` | `laptop` | `nix flake check`<br>`nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link` |
|
||||
|
||||
---
|
||||
|
||||
@@ -170,7 +163,7 @@ Maintain clear ownership of documentation:
|
||||
- **`README.md`**: High-level repository overview and quick start.
|
||||
- **`architecture.md`**: Structural topology, layer boundaries, and architectural invariants.
|
||||
- **`AGENTS.md`**: Agent constitution, change policies, risk matrix, and validation rules.
|
||||
- **`docs/*.md`**: Step-by-step procedural guides for humans (maintenance, secrets, Antigravity, Dynu).
|
||||
- **`docs/*.md`**: Step-by-step procedural guides for humans (maintenance, secrets, Antigravity).
|
||||
|
||||
*Rule: Do not duplicate architectural descriptions into procedural docs or README.*
|
||||
|
||||
|
||||
@@ -1,119 +1,77 @@
|
||||
# ❄️ Declarative NixOS Workstation Configuration
|
||||
# ❄️ Declarative NixOS Laptop Workstation Configuration
|
||||
|
||||
This repository houses a purely declarative, reproducible NixOS configuration using Nix Flakes and Home Manager. It serves as the single source of truth for provisioning and managing high-performance Wayland-native workstation environments across desktop and laptop profiles.
|
||||
This repository houses a purely declarative, reproducible NixOS configuration using Nix Flakes and Home Manager. It serves as the single source of truth for provisioning and managing a high-performance, Wayland-native mobile workstation environment on laptop powered by the Niri scrollable window manager and DankMaterialShell.
|
||||
|
||||
Homelab infrastructure and server services are maintained independently in the [Core](file:///home/kiskaadee/Projects/active/homelab/Core) repository.
|
||||
|
||||
---
|
||||
|
||||
## 🏗️ Repository Architecture
|
||||
|
||||
This configuration maintains a strict separation between global system defaults, shared user configuration modules, and host-specific profiles to avoid redundancy.
|
||||
The repository enforces a clear separation between privileged system declarations (`system/`) and unprivileged user-space dotfiles and toolchains (`home/`), organized by functional domains.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A["flake.nix"] --> B{"Host Targets"}
|
||||
A["flake.nix"] --> B["nixosConfigurations.laptop"]
|
||||
|
||||
subgraph Hosts ["Host Profiles (hosts/)"]
|
||||
S["server<br/><i>(Headless Homelab)</i>"]
|
||||
D["desktop<br/><i>(Hyprland Workstation)</i>"]
|
||||
L["laptop<br/><i>(Niri Workstation)</i>"]
|
||||
subgraph System ["Privileged System Layer (system/)"]
|
||||
S_CORE["core.nix<br/><i>(Base OS, Users, Boot, Nix-LD)</i>"]
|
||||
S_HW["hardware.nix<br/><i>(Power, PipeWire, Bluetooth, Printing)</i>"]
|
||||
S_DESK["desktop.nix<br/><i>(Niri, DMS Daemon, Greeter, Fonts)</i>"]
|
||||
end
|
||||
|
||||
B -->|"server"| S
|
||||
B -->|"desktop"| D
|
||||
B -->|"laptop"| L
|
||||
|
||||
subgraph Shared ["Shared Modules (modules/)"]
|
||||
SYS["modules/system/<br/><i>(Base OS & System Daemons)</i>"]
|
||||
USER["home.nix + modules/user/<br/><i>(User Environment & Apps)</i>"]
|
||||
subgraph User ["Unprivileged User Layer (home/)"]
|
||||
U_DESK["desktop.nix<br/><i>(GUI Apps, Wayland Tools, Alacritty, Zed)</i>"]
|
||||
U_DEV["dev.nix<br/><i>(Neovim, Compilers, LSPs, Antigravity)</i>"]
|
||||
U_SH["shell.nix<br/><i>(Bash, Git, Delta, Tmux, Starship)</i>"]
|
||||
end
|
||||
|
||||
S --> SYS
|
||||
D --> SYS
|
||||
L --> SYS
|
||||
|
||||
S --> USER
|
||||
D --> USER
|
||||
L --> USER
|
||||
B --> System
|
||||
B --> User
|
||||
```
|
||||
|
||||
### Directory Structure
|
||||
|
||||
* [flake.nix](flake.nix) — Main entry point defining dependencies (inputs) and system host targets (`server`, `desktop`, `laptop`).
|
||||
* [home.nix](home.nix) — Global Home Manager declaration defining the user context (`kiskaadee`).
|
||||
* [hosts/](hosts/) — Specific hardware configuration files and profiles.
|
||||
* [hosts/server/](hosts/server/) — Dedicated headless homelab server configuration:
|
||||
* [configuration.nix](hosts/server/configuration.nix) — Headless server NixOS config (power-tuned, no GUI, no greeter).
|
||||
* [home.nix](hosts/server/home.nix) — Pure CLI user environment with server diagnostic tools (`htop`, `iotop`, `ncdu`).
|
||||
* [dynu.nix](hosts/server/dynu.nix) — Service settings triggering Dynu DDNS.
|
||||
* [homeserver.nix](hosts/server/homeserver.nix) — Core services declarative systemd service.
|
||||
* [traefik-deployments.nix](hosts/server/traefik-deployments.nix) — Edge proxy secrets and microservice templates.
|
||||
* [monitor.py](hosts/server/monitor.py) — Python script checking for public WAN IP rotations.
|
||||
* [secrets.yaml](hosts/server/secrets.yaml) — Encrypted server credentials.
|
||||
* [hosts/desktop/](hosts/desktop/) — Legacy dual-mode workstation configuration:
|
||||
* [configuration.nix](hosts/desktop/configuration.nix) — Main desktop NixOS config with specialisation.
|
||||
* [home.nix](hosts/desktop/home.nix) — Hyprland desktop environment settings.
|
||||
* [hosts/laptop/](hosts/laptop/) — Configuration for the mobile workstation:
|
||||
* [configuration.nix](hosts/laptop/configuration.nix) — Main laptop NixOS config.
|
||||
* [home.nix](hosts/laptop/home.nix) — Niri-based workspace environment settings.
|
||||
* [modules/](modules/) — Reusable, modular system and user configuration files:
|
||||
* [modules/system/](modules/system/) — Global hardware settings, Docker, greetd, and audio:
|
||||
* [base.nix](modules/system/base.nix) — System-wide terminal base.
|
||||
* [graphical.nix](modules/system/graphical.nix) — System display and desktop styling modules.
|
||||
* [modules/user/](modules/user/) — User environment settings:
|
||||
* [base.nix](modules/user/base.nix) — Core CLI utilities, alias definitions, and fastfetch.
|
||||
* [apps.nix](modules/user/apps.nix) — Packages including Zen Browser, Neovim, and Cloud SDKs.
|
||||
* [terminal.nix](modules/user/terminal.nix) — Alacritty terminal emulator, Tmux configurations, and Starship.
|
||||
* [shell/](modules/user/shell/) — Modular, domain-specific shell scripts natively compiled into the shell configuration:
|
||||
* [git.sh](modules/user/shell/git.sh) — Automation helpers for Git staging, committing, and repositories.
|
||||
* [jump.sh](modules/user/shell/jump.sh) — Interactive navigation helper scripts powered by `fzf` and `yazi`.
|
||||
* [pdf.sh](modules/user/shell/pdf.sh) — Quick decryption of password-protected PDF files.
|
||||
* [quicklinks.sh](modules/user/shell/quicklinks.sh) — Quick menu launcher for saved bookmarks and workflows.
|
||||
* [todo.sh](modules/user/shell/todo.sh) — Productivity shortcuts and syntax highlighter for `todo.txt` and `tuxedo`.
|
||||
* [wayland.sh](modules/user/shell/wayland.sh) — Utility to automatically pipe program stdout/stderr to the Wayland clipboard.
|
||||
* [flake.nix](flake.nix) — Main entry point defining dependencies (inputs) and system host target (`laptop`).
|
||||
* [system/](system/) — Privileged NixOS system-level configuration modules:
|
||||
* [default.nix](system/default.nix) — System composition entrypoint.
|
||||
* [hardware-configuration.nix](system/hardware-configuration.nix) — Generated hardware scan (disks, CPU microcode, kernel modules).
|
||||
* [core.nix](system/core.nix) — Base operating system, bootloader, networking, user account, and `nix-ld`.
|
||||
* [hardware.nix](system/hardware.nix) — Power management (`power-profiles-daemon`, `upower`), audio (`pipewire`), printing/scanning, and Docker.
|
||||
* [desktop.nix](system/desktop.nix) — Niri compositor enablement, DankMaterialShell daemon, greetd login, and fonts.
|
||||
* [home/](home/) — Home Manager user-space configuration modules (`kiskaadee`):
|
||||
* [default.nix](home/default.nix) — User environment entrypoint, state version, and session search paths.
|
||||
* [desktop.nix](home/desktop.nix) — Graphical applications (Zen Browser, Zed, media), Wayland capture tools, Alacritty, and Niri/Zed dotfiles.
|
||||
* [dev.nix](home/dev.nix) — Neovim editor setup, developer toolchains (Rust, Python, Node, LSPs), Antigravity CLI, and dev utilities.
|
||||
* [shell.nix](home/shell.nix) — Interactive Bash shell, Git/Delta configuration, SSH client profiles, Tmux, Starship, and Fastfetch.
|
||||
* [config/](home/config/) — Static dotfile source trees (Alacritty, Fastfetch, Niri, Neovim, Zed, Starship, Tmux).
|
||||
* [scripts/](home/scripts/) — Compiled standalone user scripts (`bundle_project.py`, `record.sh`).
|
||||
* [shell/](home/shell/) — Modular Bash helper scripts sourced into `.bashrc`.
|
||||
* [docs/](docs/) — Maintenance runbooks and operational workflows.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Specialized Shell & Script Automation
|
||||
|
||||
### 1. Smart Dynamic DNS Monitor
|
||||
The [monitor.py](hosts/desktop/monitor.py) daemon prevents redundant DNS updates by running a local-first check before contacting the provider API:
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
A[Timer triggers monitor script] --> B[Fetch public IP from seq. providers]
|
||||
B --> C{Is public IPv4 valid?}
|
||||
C -->|No| D[Log error & try next provider]
|
||||
C -->|Yes| E[Retrieve last successful IP from local logs]
|
||||
E --> F{Has IP changed?}
|
||||
F -->|No| G[Exit cleanly]
|
||||
F -->|Yes| H[Trigger ddclient.service via systemctl]
|
||||
H --> I{Update successful?}
|
||||
I -->|Yes| J[Write success status to ip_history.jsonl]
|
||||
I -->|No| K[Write failed_update status & alert user]
|
||||
```
|
||||
|
||||
* **Script Location:** [hosts/desktop/monitor.py](hosts/desktop/monitor.py)
|
||||
* **Systemd Integration:** Managed via [hosts/desktop/dynu.nix](hosts/desktop/dynu.nix) which triggers the monitor service every 30 minutes.
|
||||
|
||||
### 2. GPU-Accelerated Video Recording (`record`)
|
||||
* **Script Location:** [modules/user/scripts/record.sh](modules/user/scripts/record.sh)
|
||||
* **Functionality:** Uses `wf-recorder` to record Wayland outputs across both Niri and Hyprland sessions.
|
||||
### 1. GPU-Accelerated Video Recording (`record`)
|
||||
* **Script Location:** [home/scripts/record.sh](home/scripts/record.sh)
|
||||
* **Functionality:** Uses `wf-recorder` to record Wayland outputs in Niri sessions.
|
||||
* **Modes:**
|
||||
* `area` — Manually drag and draw a target bounding box using `slurp`.
|
||||
* `window` — Target active window or interactively select via `slurp`.
|
||||
* `output` — Matches coordinates of the currently active focused monitor (`niri msg` / `hyprctl`).
|
||||
* `output` — Matches coordinates of the currently active focused monitor (`niri msg`).
|
||||
* `screen` — Full layout capture.
|
||||
* `audio` flag — Parses `wpctl` to dynamically resolve output system loopback paths from PipeWire/WirePlumber to include sound.
|
||||
|
||||
### 3. Git Automation Shorthand (`git.sh`)
|
||||
* **Script Location:** [modules/user/shell/git.sh](modules/user/shell/git.sh)
|
||||
### 2. Git Automation Shorthand (`git.sh`)
|
||||
* **Script Location:** [home/shell/git.sh](home/shell/git.sh)
|
||||
* **Features:**
|
||||
* `gitignore <pattern>` — Appends pattern to project-root `.gitignore`, commits the change, and pushes to remote.
|
||||
* `gacp <message>` — Shorthand to stage all edits, commit with a message, and push directly to the current branch.
|
||||
* `new-repo <name>` — Scaffolds local files, runs git init, and pushes the project to GitHub using the `gh` CLI.
|
||||
|
||||
### 4. Todo.txt & Tuxedo Productivity Helper (`todo.sh`)
|
||||
* **Script Location:** [modules/user/shell/todo.sh](modules/user/shell/todo.sh)
|
||||
### 3. Todo.txt & Tuxedo Productivity Helper (`todo.sh`)
|
||||
* **Script Location:** [home/shell/todo.sh](home/shell/todo.sh)
|
||||
* **Features:**
|
||||
* `todo` — Launches the interactive `tuxedo` TUI for the local `./todo.txt`.
|
||||
* `todo n` / `todo next` — Displays only the highest-priority focus task.
|
||||
@@ -121,8 +79,8 @@ flowchart TD
|
||||
* `todo dn` / `todo do-next` — Auto-completes the top priority task.
|
||||
* `_todo_color` — Built-in awk parser adding ANSI color formatting for priorities, `@contexts`, `+projects`, dates, and `key:value` tags without broken-pipe errors.
|
||||
|
||||
### 5. Repository Bundler Utility (`bundle-project`)
|
||||
* **Script Location:** [modules/user/scripts/bundle_project.py](modules/user/scripts/bundle_project.py)
|
||||
### 4. Repository Bundler Utility (`bundle-project`)
|
||||
* **Script Location:** [home/scripts/bundle_project.py](home/scripts/bundle_project.py)
|
||||
* **Features:**
|
||||
* `bundle-project [target_dir] [-o output_file]` — Compresses the structure and contents of a target directory (defaults to `.`) into a single output file (defaults to `output.txt`).
|
||||
* Natively skips binary files and `.git` repositories to prevent pollution.
|
||||
@@ -132,59 +90,50 @@ flowchart TD
|
||||
|
||||
## 🔒 Secrets Management (SOPS + age)
|
||||
|
||||
No plain text passwords, tokens, or private keys are committed to the public history. Secrets are stored inside encrypted `.yaml` assets decrypted dynamically on-demand at boot time using **`sops-nix`** and SSH host keys.
|
||||
Sensitive credentials (tokens, private keys) are managed using `sops` and `age`. Plaintext secrets are never committed to version control.
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
A[Encrypted secrets.yaml in Git] --> B(sops-nix on system boot)
|
||||
C[Host SSH Private Key /etc/ssh/...] --> B
|
||||
B --> D[Decrypted RAM filesystem /run/secrets/]
|
||||
D --> E[Services read secrets securely]
|
||||
```
|
||||
|
||||
### Adding and Modifying Secrets
|
||||
1. Decrypt and open the host secrets file:
|
||||
```bash
|
||||
nix-shell -p sops --run "sops hosts/desktop/secrets.yaml"
|
||||
```
|
||||
2. Save changes and exit. `sops` will automatically re-encrypt the file with the public keys defined in the root [.sops.yaml](.sops.yaml) configuration file.
|
||||
|
||||
For detailed steps on bootstrapping, key generation, and service decryption, see the [Secrets Management Guide](docs/secrets-management.md).
|
||||
For bootstrapping, key generation, and decryption workflows, consult the [Secrets Management Guide](docs/secrets.md).
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start / Deployment
|
||||
|
||||
### 1. Installation
|
||||
Clone the configuration workspace directly into your home folder:
|
||||
### 1. Installation & Bare-Metal Recovery
|
||||
For fresh machine setup and disaster recovery, follow the [Getting Started: Fresh Installation & Recovery Runbook](docs/getting-started.md).
|
||||
|
||||
```bash
|
||||
git clone https://github.com/kiskaadee/nixos-config.git ~/Config
|
||||
cd ~/Config
|
||||
```
|
||||
|
||||
### 2. Deploy System Configurations
|
||||
Rebuild and switch to the profile matching your active target host machine:
|
||||
### 2. Validate & Test Build
|
||||
Verify flake evaluation and dry-build the derivation without switching:
|
||||
```bash
|
||||
nix flake check
|
||||
nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link
|
||||
```
|
||||
|
||||
* **Desktop Workstation:**
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake ~/Config#desktop
|
||||
```
|
||||
* **Laptop Workstation:**
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake ~/Config#laptop
|
||||
```
|
||||
|
||||
*Note: The user environment configures `nix-switch` as an alias to automatically build and switch using the current hostname.*
|
||||
### 3. Apply Configuration
|
||||
Switch to the new generation on the laptop:
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake ~/Config#laptop
|
||||
```
|
||||
*Tip: The shell environment includes the `nix-switch` alias to automatically rebuild using the local hostname.*
|
||||
|
||||
---
|
||||
|
||||
## 📚 Reference Documentation
|
||||
## 📚 Workstation Operations Manual
|
||||
|
||||
* [Package & Secrets Workflow Guide](docs/package-and-secrets.md) — Steps for adding custom applications and managing secrets.
|
||||
* [System Maintenance Guide](docs/system-maintenance.md) — Instructions for safe system updates, health checking, and garbage collection.
|
||||
* [Declarative Development Environments](docs/development-environments.md) — How to use nix-shell, devShells, direnv, and uv for project isolation.
|
||||
* [Secrets Management Details](docs/secrets-management.md) — Secure storage bootstrapping using `sops-nix` and `age`.
|
||||
* [Smart DDNS Updater](docs/dynu-ip-monitor.md) — Under-the-hood details of the smart IP change detector and updater.
|
||||
* [Tmux Terminal Multiplexer](docs/tmux.md) — Fast navigation bindings, layouts, and pane splits guide.
|
||||
* [Google Antigravity Setup](docs/antigravity.md) — Technical instructions for packaging and using the Antigravity agent CLI on NixOS.
|
||||
* [Getting Started: Fresh Installation & Recovery](docs/getting-started.md) — Bare-metal install, reference partitioning, hardware config, and desktop bootstrap.
|
||||
* [Adding Software](docs/adding-software.md) — Decision tree for package placement, `home.packages` vs `programs.foo`, and unfree packages.
|
||||
* [Configuration Workflow](docs/configuration.md) — Day-to-day editing, dry-build validation, testing, and dotfiles management.
|
||||
* [System Lifecycle & Rebuilds](docs/system-lifecycle.md) — Nix rebuild pipeline, generations, bootloader rollback, and garbage collection.
|
||||
* [Desktop Environment (Niri + DMS)](docs/desktop.md) — Compositor stack, declarative vs runtime state boundary, and master shortcut reference.
|
||||
* [Secrets Management & Homelab GitOps](docs/secrets.md) — Operator authoring tooling on laptop vs runtime decryption on Core.
|
||||
* [Networking & Remote Access](docs/networking.md) — NetworkManager, OpenSSH client profiles, and LAN remote access.
|
||||
|
||||
### Reference Manuals
|
||||
* [Interactive Shell Environment](docs/reference/shell.md) — Bash configuration, Starship prompt, and modular shell scripts.
|
||||
* [Tmux Terminal Multiplexer](docs/reference/tmux.md) — Session workflows, layouts, and navigation keybindings.
|
||||
* [Neovim Editor Architecture](docs/reference/neovim.md) — Neovim Lua configuration, LSPs, treesitter, and formatting.
|
||||
* [Antigravity AI Agent Setup](docs/reference/antigravity.md) — Constitution, change protocols, and tooling integration.
|
||||
@@ -0,0 +1,28 @@
|
||||
gitea:
|
||||
token: ENC[AES256_GCM,data:aufTXSQAmAcwrTOnHauRnK0eEZSa1/2w6JwMn/yrL6BGCFyzRIeQ/Q==,iv:Q+d2efdCyyOb1fE1RV8QY4/QTMPlsbeWT43arb8VQlg=,tag:AlxJy4G+4v9O3T+fAZeizA==,type:str]
|
||||
github:
|
||||
token: ENC[AES256_GCM,data:z5XgwnOBEe7XNKhENNxUkkaToOfWotruLrZU5G8VQtJLP9/OHP3psA==,iv:cg2T0CfeoiVb7z7wm2uqKohKmwoiIGqHjnoLbeGg9/w=,tag:7sSSsVhbsl/pFMIhIjX0SA==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB1bjZDTDY5SXV2VEg4MVVp
|
||||
U3Y0SFBtZ1hPbDFOdTZMWjZ0QklUOUlJOFg4CktncVJEYjVreEU0Vk0xbzJsMXkx
|
||||
Q29CR083NkVBdkxINTJNS3NITzdxWkUKLS0tIGY3ajlVaUxzanVUZFJRSGhrZGNv
|
||||
TWNQK2F1enpVNXoxcmFWL2tXTWJRRzAK9HVRRGz8MAfNMbZg4M/J61+ahRFm25Mw
|
||||
+27VMOWX2XMQmMsGbR9Et3/8dmWK256yKW+LS/+W/mdK5+wkTmGyKg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBrSU1uRnNNYWF4SW5aM3pz
|
||||
emkxbzBwZ05XeG1PTk1saVNyeHlCUUROazFNCmlJZEhDaUtITjVYM1N0UU02QzJH
|
||||
M1ZjYUxmNVN3OEUzb1VuVlhJWFd2cm8KLS0tIEc3TVBJUXpqdkk3SVFHL1V1REN3
|
||||
ZGsvZGc5STljOGZOQks4ZFpJV1dqZ2sK6md/OW6F19AEbYdRp44h1ZWAaH3njBNP
|
||||
XFdWOofCIJUoH6oYEHBe7Xc6g9n4R7fGK12bLDTgnhzOEypiYDlfGQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1utkr8d88ezkwwf7aarpgg8ujqa8jmqtrjxvcau7yctjey66sngpqcr8fmx
|
||||
lastmodified: "2026-10-21T20:28:26Z"
|
||||
mac: ENC[AES256_GCM,data:Fgr08qaqWx40iT6uprqsFoMcWTibGSvQMVdDbTcaW775F1poZULS1He5/V0HlW0Yu3zJiZgG/4HtoITtyXrF9bW6CtSoRvhZDZ1p7YmF3q+v6WdSR+AoyQui+g8C51C0m6YqQmfbINV/qEUNW0TFsJXJid0dgszV6Z8uO/lKmU8=,iv:QBEV0lvCDgEWsvEQXfQqgVzFKiPRyApT7rbN48zR0/8=,tag:pzc3W6MpvCqC9YRT0iihxA==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
+76
-132
@@ -1,12 +1,16 @@
|
||||
# System Architecture
|
||||
# System Architecture: Standalone Workstation
|
||||
|
||||
## Core Principles
|
||||
|
||||
This repository manages a declarative NixOS configuration for multiple host targets (`server`, `desktop`, `laptop`) and shared user environments via Home Manager.
|
||||
This repository manages a purely declarative NixOS and Home Manager configuration for a standalone mobile workstation host (`laptop`).
|
||||
|
||||
1. **Git is the Source of Truth**: Every persistent system configuration must be declaratively defined within this repository.
|
||||
2. **Runtime State Separation**: Runtime state (Docker volumes, dynamic IP caches, `/run/secrets/`, mutable state) must not become configuration state.
|
||||
3. **Layered Isolation**: System modules provide reusable machine infrastructure; user modules configure user environments; host directories bind hardware, secrets, and machine-specific services together.
|
||||
1. **Declarative System State vs. Mutable Runtime State**: Reproducibility in this repository means **reproducible declared system state**, not necessarily byte-for-byte reproducible runtime/user state. The workstation is **declaratively reproducible, with an explicitly documented desktop bootstrap state**. Dynamic runtime state (SSH host private keys, machine-id, DMS runtime settings and monitor layouts, browser profiles, caches, and Docker volumes) lives outside the declarative boundary. A runtime-mutated file must never be converted into a Home Manager-managed file merely because it is important or because tracking it in Git would appear to improve reproducibility.
|
||||
2. **Domain-Driven Cohesion**: Configuration is organized by functional domain (`core`, `hardware`, `desktop`, `dev`, `shell`) rather than artificial multi-machine abstractions.
|
||||
3. **Privilege Boundary Separation**:
|
||||
- **`system/` (Root/NixOS)**: Governs hardware, kernel, bootloader, base OS daemons, and system-level compositor enablement.
|
||||
- **`home/` (User/Home Manager)**: Governs user dotfiles, application settings, toolchains, and desktop keybindings inside `/home/kiskaadee`.
|
||||
4. **Decoupled Homelab Infrastructure**: Production server daemons, Docker stacks, Traefik edge routing, and DDNS automation are maintained independently in the [Core](file:///home/kiskaadee/Projects/active/homelab/Core) repository.
|
||||
5. **Workstation Remote Access ≠ Server Infrastructure**: Local system daemons (such as the OpenSSH server) are legitimate workstation facilities for LAN access, remote editor attachments, and file transfers. They do not constitute "server infrastructure," which refers to independently operated application workloads and edge proxies.
|
||||
|
||||
---
|
||||
|
||||
@@ -14,129 +18,73 @@ This repository manages a declarative NixOS configuration for multiple host targ
|
||||
|
||||
```text
|
||||
Config/
|
||||
├── flake.nix # Flake inputs and nixosConfigurations public entrypoint
|
||||
├── flake.lock # Pinned dependencies
|
||||
├── home.nix # Root Home Manager shared entrypoint (Pure CLI: base, neovim, terminal)
|
||||
├── .sops.yaml # SOPS encryption keys and path rules
|
||||
├── flake.nix # Flake inputs and composition root for nixosConfigurations.laptop
|
||||
├── flake.lock # Pinned dependency revisions
|
||||
│
|
||||
├── hosts/ # Machine-specific configurations
|
||||
│ ├── server/
|
||||
│ │ ├── configuration.nix # Server NixOS configuration (headless homelab node)
|
||||
│ │ ├── hardware-configuration.nix # Generated hardware configuration
|
||||
│ │ ├── home.nix # Server-specific Home Manager profile (diagnostics CLI)
|
||||
│ │ ├── secrets.yaml # Encrypted server secrets (SOPS)
|
||||
│ │ ├── dynu.nix # Dynu DDNS update service
|
||||
│ │ ├── homeserver.nix # Core homelab runtime services (Docker)
|
||||
│ │ └── traefik-deployments.nix # Traefik edge reverse proxy
|
||||
│ │
|
||||
│ ├── desktop/
|
||||
│ │ ├── configuration.nix # Desktop NixOS configuration & server specialization
|
||||
│ │ ├── hardware-configuration.nix # Generated hardware configuration
|
||||
│ │ ├── home.nix # Desktop-specific Home Manager profile (Hyprland dotfiles)
|
||||
│ │ ├── secrets.yaml # Encrypted desktop secrets (SOPS)
|
||||
│ │ ├── dynu.nix # Dynu DDNS update service
|
||||
│ │ ├── homeserver.nix # Core homelab runtime services
|
||||
│ │ └── traefik-deployments.nix # Traefik edge reverse proxy
|
||||
│ │
|
||||
│ └── laptop/
|
||||
│ ├── configuration.nix # Laptop NixOS configuration (Niri compositor)
|
||||
│ ├── hardware-configuration.nix # Generated hardware configuration
|
||||
│ ├── home.nix # Laptop-specific Home Manager profile (Niri dotfiles)
|
||||
│ └── secrets.yaml # Encrypted laptop secrets (SOPS)
|
||||
├── system/ # NixOS system-level configuration (root / privileged)
|
||||
│ ├── default.nix # System composition entrypoint
|
||||
│ ├── hardware-configuration.nix # Generated hardware scan (disks, CPU, kernel modules)
|
||||
│ ├── core.nix # Base OS: networking, users, locale, openssh, nix-ld
|
||||
│ ├── hardware.nix # Machine services & peripherals: power, PipeWire, bluetooth, printing, docker
|
||||
│ └── desktop.nix # Desktop stack: Niri compositor, DMS daemon, greetd, fonts
|
||||
│
|
||||
├── modules/
|
||||
│ ├── system/ # Reusable system-level NixOS modules (shared across hosts)
|
||||
│ │ ├── base.nix # Core OS settings, networking, audio, docker, bluetooth
|
||||
│ │ └── graphical.nix # Shared display manager (greetd / DMS) & graphical daemons
|
||||
│ │
|
||||
│ └── user/ # Reusable Home Manager modules (tiered split)
|
||||
│ ├── base.nix # Tier 1: Pure CLI shell, utilities, Git, common environment
|
||||
│ ├── terminal.nix # Tier 1: Pure CLI multiplexer (tmux) & prompt (starship)
|
||||
│ ├── neovim.nix # Tier 1: Modular Neovim editor configuration
|
||||
│ ├── apps.nix # Tier 2: Developer & user applications (Tea, Antigravity, SDKs)
|
||||
│ ├── graphical.nix # Tier 3: Graphical user tools, Alacritty, Wayland stack, LSPs
|
||||
│ ├── shell/ # Modular shell scripts, aliases, and functions
|
||||
│ ├── scripts/ # Standalone helper scripts
|
||||
│ └── config/ # Managed application dotfiles
|
||||
├── home/ # Home Manager user-level configuration (kiskaadee)
|
||||
│ ├── default.nix # User session entrypoint (paths, state version)
|
||||
│ ├── desktop.nix # Graphical apps (Zen, Zed, media), Wayland tools, DankSearch, Niri/Zed dotfiles
|
||||
│ ├── dev.nix # Developer toolchains (Rust, Python, Node, LSPs), Antigravity, Neovim, SOPS/age CLI
|
||||
│ ├── shell.nix # Interactive shell (Bash, aliases, modular scripts), Git, Delta, Tmux, Starship
|
||||
│ ├── config/ # Managed application dotfiles (alacritty, niri, nvim, zed, fastfetch, tmux)
|
||||
│ ├── scripts/ # Standalone helper scripts (bundle-project, record)
|
||||
│ └── shell/ # Modular bash source scripts (git, jump, pdf, quicklinks, todo, wayland)
|
||||
│
|
||||
└── docs/ # Procedural and operational documentation
|
||||
└── docs/ # Operational workflows and maintenance runbooks
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Layer Responsibilities
|
||||
## Layer Responsibilities & Composition Roots
|
||||
|
||||
The repository utilizes a dual-composition model anchored by `flake.nix`:
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[flake.nix] --> B[nixosConfigurations.server]
|
||||
A --> C[nixosConfigurations.desktop]
|
||||
A --> D[nixosConfigurations.laptop]
|
||||
FLAKE["flake.nix<br/><i>(Composition Root)</i>"] --> CFG["nixosConfigurations.laptop"]
|
||||
|
||||
subgraph Server Host ["hosts/server/"]
|
||||
B --> S_CONF[configuration.nix]
|
||||
S_CONF --> S_HW[hardware-configuration.nix]
|
||||
S_CONF --> S_DY[dynu.nix]
|
||||
S_CONF --> S_TR[traefik-deployments.nix]
|
||||
S_CONF --> S_HS[homeserver.nix]
|
||||
subgraph System Layer ["system/ (Privileged Root / NixOS)"]
|
||||
CFG --> S_DEF["system/default.nix"]
|
||||
S_DEF --> S_HW["hardware-configuration.nix"]
|
||||
S_DEF --> S_CORE["core.nix<br/><i>(Host, Users, Boot, OpenSSH, Nix-LD)</i>"]
|
||||
S_DEF --> S_DEV["hardware.nix<br/><i>(Power, PipeWire, Bluetooth, Printing, Docker)</i>"]
|
||||
S_DEF --> S_DESK["desktop.nix<br/><i>(Niri, DMS Daemon, Greeter, Fonts)</i>"]
|
||||
end
|
||||
|
||||
subgraph Desktop Host ["hosts/desktop/"]
|
||||
C --> D_CONF[configuration.nix]
|
||||
D_CONF --> D_HW[hardware-configuration.nix]
|
||||
D_CONF --> D_DY[dynu.nix]
|
||||
D_CONF --> D_TR[traefik-deployments.nix]
|
||||
D_CONF --> D_HS[homeserver.nix]
|
||||
D_CONF --> D_SP["specialisation.server"]
|
||||
end
|
||||
|
||||
subgraph Laptop Host ["hosts/laptop/"]
|
||||
D --> L_CONF[configuration.nix]
|
||||
L_CONF --> L_HW[hardware-configuration.nix]
|
||||
end
|
||||
|
||||
subgraph Tier1 Shared CLI HM ["home.nix (All Hosts)"]
|
||||
B --> H[home.nix]
|
||||
C --> H
|
||||
D --> H
|
||||
H --> U1[base.nix]
|
||||
H --> U2[neovim.nix]
|
||||
H --> U3[terminal.nix]
|
||||
end
|
||||
|
||||
subgraph Tier23 Workstation HM ["Workstation Extensions (Desktop & Laptop)"]
|
||||
C --> DH[desktop/home.nix]
|
||||
D --> LH[laptop/home.nix]
|
||||
DH --> UA[apps.nix]
|
||||
DH --> UG[graphical.nix]
|
||||
LH --> UA
|
||||
LH --> UG
|
||||
subgraph User Layer ["home/ (Unprivileged User / Home Manager)"]
|
||||
CFG --> H_DEF["home/default.nix"]
|
||||
H_DEF --> H_DESK["desktop.nix<br/><i>(GUI Apps, Wayland Tools, Alacritty, Zed, Niri Config)</i>"]
|
||||
H_DEF --> H_DEV["dev.nix<br/><i>(Neovim, Compilers, LSPs, Antigravity, SOPS/age CLI)</i>"]
|
||||
H_DEF --> H_SH["shell.nix<br/><i>(Bash, Git, Delta, Tmux, Starship, Fastfetch)</i>"]
|
||||
end
|
||||
```
|
||||
|
||||
### 1. `flake.nix`
|
||||
- **Role**: Public entry point for package set pinning, external flake inputs, and host output wiring (`nixosConfigurations`).
|
||||
- **Contains**: `inputs` definitions (`nixpkgs`, `home-manager`, `dms`, `sops-nix`, `antigravity`, etc.) and system module composition via `specialArgs`.
|
||||
- **Must Not Contain**: Package lists, user configurations, shell scripts, or host-specific options.
|
||||
- **Role**: Sole public composition root declaring external flake inputs (`nixpkgs`, `home-manager`, `dms`, `zen-browser`, `antigravity`, etc.) and wiring `system/` and `home/` into the `laptop` target.
|
||||
- **Rule**: Contains only inputs and host output definitions. No inline packages, scripts, or machine-specific options.
|
||||
|
||||
### 2. `hosts/<host>/`
|
||||
- **Role**: Contains everything specific to an individual physical machine.
|
||||
- **Includes**:
|
||||
- `hardware-configuration.nix`: Generated hardware and kernel parameters (managed by `nixos-generate-config`).
|
||||
- `configuration.nix`: Hostname, bootloader, host-specific users, GPU/display drivers, and specialisations.
|
||||
- `home.nix`: User packages and dotfiles tied to the host's desktop environment or headless role.
|
||||
- `secrets.yaml`: SOPS-encrypted secrets for that machine.
|
||||
- Host infrastructure services (e.g., `homeserver.nix`, `dynu.nix`, `traefik-deployments.nix` on `server`/`desktop`).
|
||||
### 2. `system/` (Machine Privileged Layer)
|
||||
- **Role**: Contains all machine-level declarations requiring root privileges.
|
||||
- **Components**:
|
||||
- `hardware-configuration.nix`: Generated hardware parameters (managed by `nixos-generate-config`).
|
||||
- `core.nix`: Bootloader (`systemd-boot`), network identity, time zone, locale, main user account (`kiskaadee`), dynamic binary support (`nix-ld`), and workstation remote access (`openssh`).
|
||||
- `hardware.nix`: Machine services & peripherals (`power-profiles-daemon`, `upower`, `brightnessctl`), PipeWire audio, Bluetooth, printing/scanning drivers, and Docker runtime.
|
||||
- `desktop.nix`: Niri window manager enablement, DMS background daemon & greeter, greetd login manager, typography/fonts, and Wayland session environment variables.
|
||||
|
||||
### 3. `modules/system/`
|
||||
- **Role**: Reusable system configuration shared by multiple hosts.
|
||||
- **Rule**: A module must only be placed here when its assumptions are valid for every host importing it. If a configuration is meaningful only for one host, keep it under `hosts/<host>/`.
|
||||
|
||||
### 4. `modules/user/`
|
||||
- **Role**: Reusable Home Manager modules organized into clean, predictable layers:
|
||||
- **Tier 1: Pure CLI Base** (`base.nix`, `terminal.nix`, `neovim.nix` via `home.nix`): Imported on all hosts (headless server, laptop, desktop). Provides pure terminal tools (`tmux`, `starship`), editor, Git, and essential CLI diagnostics.
|
||||
- **Tier 2: Developer & User Apps** (`apps.nix`): Imported by workstation profiles. Provides developer toolchains, cloud SDKs, Git forge clients (`tea`, `gh`), and media tools.
|
||||
- **Tier 3: Graphical Desktop Environment** (`graphical.nix`): Imported by workstation profiles. Provides Alacritty, Firefox, Zen Browser, Zed, DankSearch, Wayland capture/clipboard utilities (`wl-clipboard`, `grim`, `slurp`, `swappy`, `wf-recorder`, `obs-studio`), and Language Servers.
|
||||
- `shell/`, `scripts/`, `config/`: Shell utility files and structured dotfiles.
|
||||
### 3. `home/` (User-Space Interactive Layer)
|
||||
- **Role**: Contains all user-space declarations and dotfiles managed by Home Manager.
|
||||
- **Components**:
|
||||
- `default.nix`: Root user environment declaration (username, home directory, state version, session search paths).
|
||||
- `desktop.nix`: Graphical productivity tools, Wayland screen capture/clipboard utilities, Alacritty terminal emulator, Firefox profile, DankSearch indexer, and declarative symlinks for Niri (`config.kdl`, `custom.kdl`) and Zed (`settings.json`, themes).
|
||||
- `dev.nix`: Neovim editor configuration (Lua init, Tree-sitter, LSP plugins, DAP), toolchains (Rust, Python, Node), language servers, API testing tools, Antigravity CLI, and operator secrets tooling (`sops`, `age`, `rbw`).
|
||||
- `shell.nix`: Bash shell aliases, prompt (`starship`), multiplexer (`tmux`), Git/Delta configuration, SSH client profiles, and modular shell helpers.
|
||||
|
||||
---
|
||||
|
||||
@@ -145,31 +93,27 @@ graph TD
|
||||
| Concern | Target Location | Placement Rule |
|
||||
| :--- | :--- | :--- |
|
||||
| **External Dependencies** | `flake.nix` | Flake inputs only; lock `inputs.nixpkgs.follows` where applicable. |
|
||||
| **Shared System Services** | `modules/system/` | Systemd services, system packages, or OS features valid for all importing hosts. |
|
||||
| **Host System Settings** | `hosts/<host>/configuration.nix` | Hostname, bootloader, user groups, machine-specific daemons. |
|
||||
| **Hardware / Disks** | `hosts/<host>/hardware-configuration.nix` | Generated configuration. Do not manually restructure or refactor. |
|
||||
| **Shared CLI Foundations** | `modules/user/base.nix`, `terminal.nix` | Tier 1 pure CLI tools (Git, tmux, starship, core utilities) shared across all hosts. |
|
||||
| **Workstation Dev Tools** | `modules/user/apps.nix` | Tier 2 developer CLI & cloud tools (`tea`, `antigravity`, compilers, SDKs). |
|
||||
| **Workstation Graphical Stack** | `modules/user/graphical.nix` | Tier 3 GUI applications, terminal emulator (`alacritty`), Wayland tools, LSPs. |
|
||||
| **Host-Specific User Apps** | `hosts/<host>/home.nix` | Tools relevant only to that host (e.g., Hyprland `grimblast` on desktop). |
|
||||
| **Shared Shell Tools** | `modules/user/shell/` | Modular bash/zsh helpers, aliases, and functions. |
|
||||
| **Standalone Scripts** | `modules/user/scripts/` | Executable user shell scripts. |
|
||||
| **Application Dotfiles** | `modules/user/config/` | Managed static configuration files linked into `$HOME/.config/`. |
|
||||
| **Encrypted Secrets** | `hosts/<host>/secrets.yaml` | Encrypted with SOPS/age; referenced via `config.sops.secrets.*.path`. |
|
||||
| **Homelab Services / DDNS** | `hosts/server/` or `hosts/desktop/` | Machine-specific homelab infrastructure, reverse proxy, and DDNS monitor. |
|
||||
| **How-To Guides** | `docs/` | Operational procedures and maintenance workflows. |
|
||||
| **Kernel / Disks / Firmware** | `system/hardware-configuration.nix` | Generated hardware scan. Do not manually restructure. |
|
||||
| **Root OS / User Groups / Boot** | `system/core.nix` | Bootloader, users, host name, locale, nix-ld, workstation SSH daemon. |
|
||||
| **Machine Services & Peripherals**| `system/hardware.nix` | Audio, power profiles, battery, bluetooth, printing, docker. |
|
||||
| **System Compositor & Greeter** | `system/desktop.nix` | Niri enablement, greetd, DMS shell daemon, system fonts. |
|
||||
| **GUI Apps & Wayland Utilities** | `home/desktop.nix` | Browser, Zed, Alacritty, clipboard, screen capture tools. |
|
||||
| **Compilers, LSPs & Editors** | `home/dev.nix` | Neovim, toolchains, language servers, developer utilities. |
|
||||
| **Shell, Aliases & Multiplexer** | `home/shell.nix` | Bash, Tmux, Starship, Fastfetch, Git, Direnv, SSH client config. |
|
||||
| **Static Application Dotfiles** | `home/config/` | Application configs linked into `$HOME/.config/`. |
|
||||
| **Standalone Scripts** | `home/scripts/` | Executable user utility scripts. |
|
||||
| **Modular Shell Helpers** | `home/shell/` | Discrete `.sh` files sourced by `.bashrc`. |
|
||||
| **Operator Secrets Tooling** | `home/dev.nix` | `sops`, `age`, and `rbw` CLI tools for authoring Core homelab secrets. |
|
||||
| **Homelab Services & Secrets** | `~/Projects/active/homelab/Core` | Managed independently in the Core repository. |
|
||||
|
||||
---
|
||||
|
||||
## Architectural Invariants
|
||||
|
||||
These rules define the repository boundaries and must not be violated:
|
||||
|
||||
1. **Flake Public Entrypoint Invariant**: `flake.nix` is the sole public entrypoint for building the repository's NixOS host configurations.
|
||||
2. **Package Ownership Invariant**: Shared user applications belong under `modules/user/` categorized by tier (`base.nix` / `terminal.nix` for pure CLI, `apps.nix` for developer tools, `graphical.nix` for GUI/Wayland). Do not introduce arbitrary package lists in `modules/system/` unless strictly required for system-wide root maintenance or core OS services.
|
||||
3. **Host Isolation Invariant**: Machine-specific homelab infrastructure (`homeserver.nix`, `traefik-deployments.nix`, `dynu.nix`) must remain isolated under their respective host directories and must never be imported into `hosts/laptop/`.
|
||||
4. **Desktop Server Specialisation Invariant**: `hosts/desktop/configuration.nix` defines `specialisation.server.configuration`. The server specialization must remain valid, bootable, and strictly headless (disabling display managers, PipeWire, Bluetooth, and desktop sleep targets).
|
||||
5. **Secrets Security Invariant**: Secrets must stay encrypted in Git via SOPS. Plaintext secrets must never be committed. Configurations must refer to secrets at runtime via `/run/secrets/` or `config.sops.secrets.<name>.path`. Never decrypt secrets into tracked or persistent working-tree files. Never add, modify, or rotate SOPS/age keys unless explicitly requested.
|
||||
6. **Hardware Configuration Invariant**: `hardware-configuration.nix` is generated configuration. Do not manually restructure, clean up, or refactor it. Hardware-specific changes should normally be produced by `nixos-generate-config`; deliberate manual additions require explicit justification.
|
||||
7. **Consumer Validation Invariant**: Changes to shared modules (`modules/system/` or `modules/user/`) or composed host configurations must be evaluated against all downstream consumers in the import graph (`server`, `desktop`, and `laptop`).
|
||||
8. **State Compatibility Invariant**: `system.stateVersion` and `home.stateVersion` (`26.05`) are compatibility declarations for stateful data and must not be bumped casually as part of routine maintenance or package updates.
|
||||
1. **Single Entrypoint Invariant**: `flake.nix` is the sole entrypoint for building the workstation system (`laptop`). Neither `system/` nor `home/` are deployed independently.
|
||||
2. **Context-Driven Package Ownership**:
|
||||
- Packages in `system/` are reserved for tools required by NixOS modules, system services, hardware integration, login/session infrastructure, or privileged administration.
|
||||
- Packages in `home/` are dedicated to the user's interactive environment, developer toolchains, and desktop applications.
|
||||
3. **Decoupled Homelab Invariant**: Server infrastructure, Traefik edge proxying, and Docker container stacks belong exclusively in the `Core` repository and must never be merged back into this workstation configuration.
|
||||
4. **Hardware Configuration Invariant**: `system/hardware-configuration.nix` is generated by `nixos-generate-config`. Do not manually alter hardware disk UUIDs or module lists without explicit verification.
|
||||
5. **State Compatibility Invariant**: `system.stateVersion` and `home.stateVersion` (`26.05`) are compatibility declarations for stateful data and must not be bumped casually.
|
||||
@@ -0,0 +1,98 @@
|
||||
# 📦 Adding Software: Placement & Packaging Guide
|
||||
|
||||
This guide defines the architectural decision tree for introducing new software, packages, or services into the workstation configuration.
|
||||
|
||||
---
|
||||
|
||||
## 1. Package Placement Decision Tree
|
||||
|
||||
When adding a tool or application, follow this priority hierarchy:
|
||||
|
||||
```text
|
||||
Is it a kernel module, hardware driver, or root systemd daemon?
|
||||
├── YES ──> system/core.nix or system/hardware.nix
|
||||
└── NO
|
||||
│
|
||||
Is it a GUI application or desktop utility?
|
||||
├── YES ──> home/desktop.nix
|
||||
└── NO
|
||||
│
|
||||
Is it a compiler, LSP, language runtime, or dev tool?
|
||||
├── YES ──> home/dev.nix
|
||||
└── NO ──> home/shell.nix (CLI tools, shell integration)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. Directory Placement Reference
|
||||
|
||||
| File | Scope | Examples |
|
||||
| :--- | :--- | :--- |
|
||||
| **`system/core.nix`** | Root OS fundamentals | Kernel params, OpenSSH daemon, locale, user definitions, Nix-LD |
|
||||
| **`system/hardware.nix`** | Hardware daemons & root services | PipeWire, Docker, Bluetooth (`bluez`), Power management (`tlp`), CUPS printing |
|
||||
| **`system/desktop.nix`** | Display server & greeter | Niri compositor enablement, DMS greeter, greetd, system typography/fonts |
|
||||
| **`home/desktop.nix`** | User graphical applications | Zen Browser, Zed, Obsidian, LibreOffice, GIMP, MPV, grim/slurp, DankSearch |
|
||||
| **`home/dev.nix`** | Toolchains & development | Rust, uv, Node, Go, language servers (nil, rust-analyzer), Antigravity, sops/age CLI |
|
||||
| **`home/shell.nix`** | Interactive shell & CLI tools | Bash, Tmux, Git, Starship, Delta, Fastfetch, ripgrep, fzf, bat, jq, eza |
|
||||
|
||||
---
|
||||
|
||||
## 3. Package Syntax Styles: When to Use What
|
||||
|
||||
### Pattern A: Simple Package List (`home.packages`)
|
||||
Use when the tool requires no specialized shell wrappers or generated dotfiles:
|
||||
|
||||
```nix
|
||||
# Example in home/desktop.nix or home/shell.nix
|
||||
home.packages = with pkgs; [
|
||||
ripgrep
|
||||
htop
|
||||
jq
|
||||
];
|
||||
```
|
||||
|
||||
### Pattern B: Home Manager Program Module (`programs.<name>`)
|
||||
Use when Home Manager provides an upstream module that configures shell completions, systemd user services, or dotfiles:
|
||||
|
||||
```nix
|
||||
# Example in home/shell.nix
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
shortcut = "a";
|
||||
terminal = "tmux-256color";
|
||||
};
|
||||
```
|
||||
|
||||
*Advantage*: Modules handle initialization scripts, environment variables, and shell aliases automatically.
|
||||
|
||||
### Pattern C: Custom Compiled Scripts (`pkgs.writeScriptBin`)
|
||||
Use when distributing a bespoke script or python tool into the user's `$PATH`:
|
||||
|
||||
```nix
|
||||
# Example in home/desktop.nix
|
||||
let
|
||||
recordScript = pkgs.writeScriptBin "record" (builtins.readFile ./scripts/record.sh);
|
||||
in
|
||||
{
|
||||
home.packages = [ recordScript ];
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Handling Unfree Software
|
||||
|
||||
Unfree packages are permitted globally in `system/core.nix` and `home/default.nix`:
|
||||
|
||||
```nix
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
```
|
||||
|
||||
You do not need to configure per-package unfree predicate overrides unless isolating builds.
|
||||
|
||||
---
|
||||
|
||||
## 5. What NOT to Add to this Repository
|
||||
|
||||
1. **Homelab Server Daemons**: Production services (Traefik, DDNS monitors, public web services, databases) belong exclusively in the [`Core`](file:///home/kiskaadee/Projects/active/homelab/Core) repository.
|
||||
2. **Ephemeral Project Dependencies**: Rather than polluting `home/dev.nix` with temporary project dependencies, create a dedicated `flake.nix` or `shell.nix` in that project's directory and use `direnv`.
|
||||
@@ -1,219 +0,0 @@
|
||||
# ❄️ NixOS Installation Guide: Google Antigravity & Antigravity-v2 Apps
|
||||
|
||||
Google Antigravity is a next-generation agentic coding companion and IDE helper. While installation on standard Linux distributions is straightforward, NixOS's unique, purely functional model requires a different approach. Because Antigravity is distributed as a **closed-source pre-compiled binary**, running it directly on NixOS causes immediate failures due to the absence of the Filesystem Hierarchy Standard (FHS).
|
||||
|
||||
This guide explains the underlying problem, technical challenges, packaging strategies, and step-by-step configuration details for integrating Antigravity into a modular NixOS setup.
|
||||
|
||||
---
|
||||
|
||||
## 🛑 1. Problem Statement
|
||||
|
||||
On standard Linux distributions (e.g., Ubuntu, Arch), binaries rely on hardcoded paths to load dynamic linkers and shared libraries:
|
||||
- Dynamic linker/interpreter path (e.g., `/lib64/ld-linux-x86-64.so.2`)
|
||||
- System libraries (e.g., `/lib`, `/usr/lib`, `/usr/lib64`)
|
||||
|
||||
NixOS breaks away from the FHS. It features a read-only store located at `/nix/store/` where every package is isolated under a unique cryptographic hash. As a result:
|
||||
1. **Dynamic Linker Failure**: The operating system will immediately refuse to run an unpatched binary because the path to the interpreter `/lib64/ld-linux-x86-64.so.2` does not exist. This results in the cryptic error:
|
||||
```bash
|
||||
bash: ./antigravity: No such file or directory
|
||||
```
|
||||
2. **Library Resolution Failure**: Even if the dynamic linker is patched, the binary will fail at runtime when trying to locate dynamic dependencies (`.so` files) that are not present in standard system directories.
|
||||
|
||||
---
|
||||
|
||||
## ⚡ 2. The Technical Challenges
|
||||
|
||||
Packaging Antigravity on NixOS introduces three main challenges:
|
||||
|
||||
### A. Closed-Source Binary Delivery
|
||||
Because Google Antigravity is proprietary, we cannot compile it from source code. Nix cannot automatically resolve compile-time configurations or inject dependency paths during a compilation phase. Instead, we must patch the pre-compiled binary directly or wrap it in a containerized environment.
|
||||
|
||||
### B. The FHS Sandbox vs. `sudo` Permissions
|
||||
Historically, Electron applications on NixOS have been packaged using `buildFHSEnv` which sets up a virtual FHS directory layout using `bubblewrap`.
|
||||
While this is effective for running the app, it sets the kernel's **`no new privileges`** flag.
|
||||
> [!WARNING]
|
||||
> If you run Antigravity inside an FHS environment, the integrated terminal **will not support `sudo`**. Running any command requiring elevated privileges (like `sudo nixos-rebuild switch`) will fail immediately because of the bubblewrap restrictions.
|
||||
|
||||
### C. Chromium Runtime Dependency
|
||||
Antigravity depends on an external browser engine (Google Chrome or Chromium) to render certain previews and dashboards. It expects standard executables like `google-chrome-stable` or `chromium` to be available in the path, and requires proper environment hooks (`CHROME_BIN` and `CHROME_PATH`) to connect to them.
|
||||
|
||||
### D. Hardcoded Electron Scripts
|
||||
Inside the packaged Electron archive (`asar`), scripts like `@vscode/sudo-prompt` contain hardcoded paths to system executables (e.g., `/usr/bin/pkexec` or `/bin/bash`), which do not exist on NixOS.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ 3. Packaging Strategy & Implementation
|
||||
|
||||
The community-maintained repository `jacopone/antigravity-nix` implements a dual-mode package design. A Mermaid diagram below illustrates how dependencies and runtime paths are resolved:
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Upstream Tarball/Binary] --> B{Package Target}
|
||||
|
||||
B -->|google-antigravity-cli| C[autoPatchelfHook]
|
||||
C -->|Patch ELF Interpreter & RPATH| D[Exec: agy]
|
||||
|
||||
B -->|google-antigravity| E{useFHS?}
|
||||
|
||||
E -->|true: Default FHS| F[buildFHSEnv Sandbox]
|
||||
F -->|Virtual /lib & /usr/lib| G[Runs Unpatched Binary]
|
||||
G -->|Limitation| H[sudo fails in Integrated Terminal]
|
||||
|
||||
E -->|false: Non-FHS| I[autoPatchelfHook + makeWrapper]
|
||||
I -->|Patch dynamic links & set LD_LIBRARY_PATH| J[Runs Native Nix Package]
|
||||
J -->|Benefit| K[sudo works in Integrated Terminal]
|
||||
```
|
||||
|
||||
### Strategy Details:
|
||||
|
||||
| Component / Mode | Strategy Used | Technical Implementation | Rationale |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **CLI (`google-antigravity-cli`)** | Binary Patching | Uses `autoPatchelfHook` to overwrite ELF interpreter and inject dependencies into `RPATH`. Renames package binary to `agy`. | High performance, low footprint, integrates natively with any shell configuration without overhead. |
|
||||
| **GUI App (`google-antigravity`)** | `buildFHSEnv` (FHS) | Creates a virtual FHS root using bubblewrap. Mounts critical system configuration mounts (`/etc/nixos`, `/etc/xdg`) and wraps standard runtime libs. | High compatibility. Guaranteed to run on all setups because the binary acts as if it is on a standard Ubuntu system. |
|
||||
| **GUI App (`google-antigravity-no-fhs`)** | Native Wrapping | Patches system libraries via `autoPatchelfHook` and uses `makeWrapper` to propagate environment variables (`LD_LIBRARY_PATH`, `CHROME_BIN`). | **Recommended for developers.** Avoids sandbox privilege restrictions, allowing `sudo` commands inside the integrated terminal. |
|
||||
|
||||
#### Automated File Patching
|
||||
To fix the hardcoded script paths within the Electron components, the flake unpacks the application archives during the build phase:
|
||||
1. It extracts `resources/app/node_modules.asar` using `asar`.
|
||||
2. It patches `@vscode/sudo-prompt/index.js` to redirect `/usr/bin/pkexec` -> `/run/wrappers/bin/pkexec` and `/bin/bash` -> Nix store's native `bash` interpreter.
|
||||
3. It packages it back into the `.asar` file structure.
|
||||
|
||||
---
|
||||
|
||||
## 📋 4. Step-by-Step Installation Guide
|
||||
|
||||
Follow these steps to integrate the Antigravity package suite declaratively into your NixOS configuration using inputs and Home Manager.
|
||||
|
||||
### Step 1: Declare the Input in `flake.nix`
|
||||
|
||||
Add `antigravity-nix` to your flake inputs in `flake.nix`. Ensure that you lock its inputs to follow your system's `nixpkgs` channel for consistency:
|
||||
|
||||
```nix
|
||||
# flake.nix
|
||||
{
|
||||
description = "My NixOS Configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# Community Flake for Google Antigravity
|
||||
antigravity = {
|
||||
url = "github:jacopone/antigravity-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs"; # Keeps dependencies in sync
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, antigravity, ... }@inputs: {
|
||||
# System outputs (e.g. nixosConfigurations.desktop)
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Step 2: Configure System Packages or Home Manager
|
||||
|
||||
You can inject the packages using standard package inputs in your configurations:
|
||||
|
||||
#### Option A: Home Manager Integration (Recommended)
|
||||
This matches your system's user setup. Add the required package to your user packages module (e.g., `modules/user/apps.nix`).
|
||||
|
||||
> [!NOTE]
|
||||
> In this repository's default configuration, only the CLI helper (`google-antigravity-cli`) is installed. The GUI apps (`google-antigravity` and `google-antigravity-no-fhs`) are optional and omitted by default.
|
||||
|
||||
```nix
|
||||
# modules/user/apps.nix
|
||||
{ inputs, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
# 1. Install the CLI tool (accessible via 'agy')
|
||||
inputs.antigravity.packages.${pkgs.stdenv.hostPlatform.system}.google-antigravity-cli
|
||||
|
||||
# 2. (Optional) Install the GUI application (uncomment to enable)
|
||||
# Choose google-antigravity-no-fhs to support sudo in terminal, or google-antigravity for standard FHS.
|
||||
# inputs.antigravity.packages.${pkgs.stdenv.hostPlatform.system}.google-antigravity-no-fhs
|
||||
|
||||
# 3. (Optional) Install the legacy IDE component (uncomment to enable)
|
||||
# inputs.antigravity.packages.${pkgs.stdenv.hostPlatform.system}.google-antigravity-ide-no-fhs
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
#### Option B: Global System Packages (`configuration.nix`)
|
||||
To make the application available to all users on the host machine:
|
||||
|
||||
```nix
|
||||
# configuration.nix
|
||||
{ inputs, pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = [
|
||||
# System-wide installation
|
||||
inputs.antigravity.packages.x86_64-linux.google-antigravity-cli
|
||||
inputs.antigravity.packages.x86_64-linux.google-antigravity-no-fhs
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Step 3: Enable Unfree Packages
|
||||
Since Google Antigravity and Chrome are proprietary, NixOS will refuse to build the configuration unless unfree packages are explicitly allowed. Ensure this is configured:
|
||||
|
||||
```nix
|
||||
# configuration.nix or base.nix
|
||||
{
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Step 4: Rebuild and Apply
|
||||
Run the rebuild switch script or alias for your machine target:
|
||||
|
||||
```bash
|
||||
# Rebuild the system
|
||||
sudo nixos-rebuild switch --flake ~/Config#desktop
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚡ 5. Verification & Alternate Runs
|
||||
|
||||
### Run Without Installing
|
||||
If you want to run any of the components without modifying your configuration permanently, you can use the `nix run` command directly:
|
||||
|
||||
* **Launch the main CLI tool (`agy`):**
|
||||
```bash
|
||||
nix run github:jacopone/antigravity-nix#google-antigravity-cli -- --help
|
||||
```
|
||||
* **Launch the GUI application (FHS):**
|
||||
```bash
|
||||
nix run github:jacopone/antigravity-nix#google-antigravity
|
||||
```
|
||||
* **Launch the GUI application (Non-FHS):**
|
||||
```bash
|
||||
nix run github:jacopone/antigravity-nix#google-antigravity-no-fhs
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 6. Automatic Updates
|
||||
|
||||
The `jacopone/antigravity-nix` repository is updated automatically approximately three times a week via GitHub Actions to track new releases of the Antigravity binary.
|
||||
|
||||
To update your local installation to the latest available package version:
|
||||
1. Navigate to your configuration repository:
|
||||
```bash
|
||||
cd ~/Config
|
||||
```
|
||||
2. Update the lockfile entry for the input:
|
||||
```bash
|
||||
nix flake lock --update-input antigravity
|
||||
```
|
||||
3. Reapply your configuration:
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake .#desktop
|
||||
```
|
||||
@@ -0,0 +1,100 @@
|
||||
# ⚙️ Configuration & Dotfiles Workflow
|
||||
|
||||
This guide details the day-to-day workflow for modifying system declarations, managing user dotfiles, and safely testing changes without destabilizing the workstation.
|
||||
|
||||
---
|
||||
|
||||
## 1. The Standard Modification Protocol
|
||||
|
||||
To preserve system reliability and adhere to the architectural invariants:
|
||||
|
||||
```text
|
||||
Identify Concern
|
||||
↓
|
||||
Find Owning Module (system/ or home/)
|
||||
↓
|
||||
Edit Declaration
|
||||
↓
|
||||
Run Flake Check: nix flake check
|
||||
↓
|
||||
Run Dry Build: nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link
|
||||
↓
|
||||
Test Activation: sudo nixos-rebuild test --flake .#laptop
|
||||
↓
|
||||
Permanent Switch: sudo nixos-rebuild switch --flake .#laptop
|
||||
↓
|
||||
Commit Changes: git commit -am "feat: ..."
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. The Golden Rule: Build, Never Switch
|
||||
|
||||
> [!CAUTION]
|
||||
> Autonomous agents and automated scripts must **never** execute `nixos-rebuild switch` autonomously. Only human operators may execute switch or boot operations.
|
||||
|
||||
### Verification Commands (Safe)
|
||||
```bash
|
||||
# Check flake schema, lock consistency, and syntax
|
||||
nix flake check
|
||||
|
||||
# Dry build laptop system closure without creating links or modifying root
|
||||
nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link
|
||||
```
|
||||
|
||||
### Activation Commands (Privileged)
|
||||
```bash
|
||||
# Test configuration in the active session without updating the bootloader menu
|
||||
sudo nixos-rebuild test --flake .#laptop
|
||||
|
||||
# Permanently activate and add a new generation to systemd-boot menu
|
||||
sudo nixos-rebuild switch --flake .#laptop
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Dotfiles Management Strategy
|
||||
|
||||
Dotfiles in this repository are managed through two distinct patterns:
|
||||
|
||||
### Pattern A: Immutable Store Symlinks (`home.file` / `xdg.configFile`)
|
||||
Used for applications whose configuration is purely declarative and must never be mutated at runtime by the application:
|
||||
|
||||
```nix
|
||||
# Example in home/desktop.nix
|
||||
home.file.".config/niri/config.kdl".source = ./config/niri/config.kdl;
|
||||
home.file.".config/niri/custom.kdl".source = ./config/niri/custom.kdl;
|
||||
home.file.".config/zed/settings.json".source = ./config/zed/settings.json;
|
||||
```
|
||||
|
||||
- Target location in `$HOME` is a symlink pointing into `/nix/store/...`.
|
||||
- If you edit the file in `home/config/`, rebuild the system to update the symlink target.
|
||||
|
||||
### Pattern B: Runtime Mutable Configurations (DMS & Browser State)
|
||||
Used for tools that provide their own GUI settings editor or dynamic state:
|
||||
|
||||
- `~/.config/DankMaterialShell/settings.json`
|
||||
- `~/.config/niri/dms/*.kdl`
|
||||
- Firefox / Zen profiles, history, and extensions
|
||||
|
||||
These directories are **deliberately unmanaged by Home Manager**. They are modified interactively through their respective applications without interference from `nixos-rebuild switch`.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Repository Principle: Declared Reproducibility vs. Runtime State**
|
||||
> Reproducibility in this repository means **reproducible declared system state**, not necessarily byte-for-byte reproducible runtime user state. The workstation is **declaratively reproducible, with an explicitly documented desktop bootstrap state**.
|
||||
>
|
||||
> A runtime-mutated file must never be converted into a Home Manager-managed store symlink merely because it is important or because tracking it in Git would appear to improve reproducibility. Doing so fights the application's runtime mutation model and causes permission errors or broken symlinks.
|
||||
|
||||
---
|
||||
|
||||
## 4. Git Hygiene & Pre-Commit Checks
|
||||
|
||||
1. Verify status before committing:
|
||||
```bash
|
||||
git status
|
||||
```
|
||||
2. Ensure no decrypted credentials, age private keys, or `.env` files are tracked:
|
||||
```bash
|
||||
git diff
|
||||
```
|
||||
3. Commit with Conventional Commits (`feat:`, `fix:`, `refactor:`, `docs:`).
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
# 🎨 Desktop Environment: Niri & DankMaterialShell (DMS)
|
||||
|
||||
This document describes the architecture of the workstation's graphical desktop environment, the boundary between declarative configuration and runtime state, and the master shortcut reference.
|
||||
|
||||
---
|
||||
|
||||
## 1. Desktop Architecture & Components
|
||||
|
||||
The graphical workstation stack is built from modern Wayland components:
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
GREETD["greetd + dank-greeter<br/><i>(Display Manager Login)</i>"] -->|Launches Session| NIRI["niri<br/><i>(Scrollable-Tiling Wayland Compositor)</i>"]
|
||||
|
||||
subgraph "Compositor Configuration (Home Manager)"
|
||||
NIRI --> CFG["~/.config/niri/config.kdl<br/><i>(Layout, gestures, input, includes)</i>"]
|
||||
NIRI --> CUST["~/.config/niri/custom.kdl<br/><i>(Operator custom keybindings)</i>"]
|
||||
end
|
||||
|
||||
subgraph "Desktop Shell (DMS Daemon)"
|
||||
DMS["dms run (systemd --user)<br/><i>(Quickshell panel, widgets, launcher)</i>"]
|
||||
DMS --> SPOTLIGHT["Spotlight App Launcher (Alt+Space / Mod+Space)"]
|
||||
DMS --> CLIPBOARD["Clipboard Manager (Mod+V)"]
|
||||
DMS --> TASKMGR["Task Manager (Mod+M)"]
|
||||
DMS --> POWERMENU["Power Menu (Super+X)"]
|
||||
end
|
||||
|
||||
subgraph "DMS Runtime State (Mutable)"
|
||||
DMS --> BINDS["~/.config/niri/dms/binds.kdl<br/><i>(DMS-managed Niri IPC bindings)</i>"]
|
||||
DMS --> SETTINGS["~/.config/DankMaterialShell/settings.json<br/><i>(Panels, widgets, themes)</i>"]
|
||||
DMS --> DYN["~/.config/niri/dms/outputs.kdl & colors.kdl<br/><i>(Monitors, Matugen theme)</i>"]
|
||||
end
|
||||
|
||||
CFG -.->|include optional=true| BINDS
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. The Ownership & Mutability Boundary
|
||||
|
||||
A critical architectural invariant is respecting the distinction between **declarative specification** and **runtime-mutable state**:
|
||||
|
||||
| Layer | Files | Managed By Git? | Mutability | Rationale |
|
||||
| :--- | :--- | :--- | :--- | :--- |
|
||||
| **Declarative Core** | `home/config/niri/config.kdl`<br/>`home/config/niri/custom.kdl` | **Yes** | Immutable store symlinks | Governs compositor rules, gesture bindings, and personal shortcuts. |
|
||||
| **System Daemon** | `system/desktop.nix` | **Yes** | Immutable NixOS module | Enables Niri, DMS package, Greetd greeter, fonts. |
|
||||
| **DMS Niri IPC Bindings** | `~/.config/niri/dms/binds.kdl` | **No** (Bootstrap-owned) | Mutable (`0644`) | Initialized via `dms setup binds`. Bridges Niri to DMS runtime controls; editable via GUI/CLI. |
|
||||
| **DMS UI Preferences** | `~/.config/DankMaterialShell/settings.json` | **No** | Mutable | Stores user's bar widget selections, padding, and corner radius. |
|
||||
| **Display Outputs** | `~/.config/niri/dms/outputs.kdl` | **No** | Dynamic runtime | Generated by DMS when external displays are connected/repositioned. |
|
||||
| **Color Schemes** | `~/.config/niri/dms/colors.kdl` | **No** | Dynamic runtime | Extracted by Matugen from the active wallpaper. |
|
||||
|
||||
> [!IMPORTANT]
|
||||
> `binds.kdl` is not part of the declarative workstation configuration. It is a bootstrap-owned artifact whose initial contents are established by `dms setup binds`. It serves as the bridge between Niri and DMS's runtime controls (the DMS-managed Niri IPC integration bindings). An empty or missing file disconnects a substantial portion of the desktop's control surface.
|
||||
|
||||
> [!CAUTION]
|
||||
> Do not attempt to manage `~/.config/niri/dms/` or `~/.config/DankMaterialShell/settings.json` via Home Manager store symlinks. Doing so breaks DMS's runtime ability to persist display changes, theme updates, and interactive settings.
|
||||
|
||||
---
|
||||
|
||||
## 3. Desktop Initialization (Fresh User Profile)
|
||||
|
||||
On a fresh user profile (or after recreating `$HOME`), initialize the mutable baseline keybindings with:
|
||||
|
||||
```bash
|
||||
dms setup binds
|
||||
```
|
||||
|
||||
This ensures `~/.config/niri/dms/binds.kdl` is created with proper user write permissions (`0644`) before Niri loads.
|
||||
|
||||
---
|
||||
|
||||
## 4. Master Shortcut Reference
|
||||
|
||||
> [!NOTE]
|
||||
> **Precedence Rule**: In `config.kdl`, `include "custom.kdl"` is evaluated *after* `include optional=true "dms/binds.kdl"`. Where key definitions collide, `custom.kdl` overrides DMS defaults. Specifically:
|
||||
> - `Mod+O` launches Obsidian (overriding DMS's secondary overview shortcut; toggle overview via `Mod+Tab`).
|
||||
> - `Mod+W` triggers area screen recording (overriding DMS's column tabbed display toggle).
|
||||
|
||||
### Core Applications & Session
|
||||
| Shortcut | Action | Source | Precedence Note |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `Mod+Return` | Open Alacritty Terminal | Custom (`custom.kdl`) | Primary workstation terminal. |
|
||||
| `Mod+T` | Open Terminal | DMS IPC (`binds.kdl`) | Alternative terminal launcher. |
|
||||
| `Mod+B` | Launch Firefox Browser | Custom (`custom.kdl`) | Browser shortcut. |
|
||||
| `Mod+O` | Launch Obsidian Notes | Custom (`custom.kdl`) | Overrides DMS `Mod+O` overview. |
|
||||
| `Mod+Tab` | Toggle Niri Column Overview | DMS IPC (`binds.kdl`) | Primary overview trigger. |
|
||||
| `Mod+Space` / `Alt+Space` | Toggle Spotlight Application Launcher | DMS IPC (`binds.kdl`) | DMS app launcher modal. |
|
||||
| `Mod+V` | Toggle Clipboard Manager | DMS IPC (`binds.kdl`) | DMS clipboard history modal. |
|
||||
| `Mod+M` | Toggle Task Manager / Process List | DMS IPC (`binds.kdl`) | DMS process manager. |
|
||||
| `Super+X` | Toggle Power Menu (Lock / Suspend / Shutdown) | DMS IPC (`binds.kdl`) | DMS session menu. |
|
||||
| `Mod+Comma` | Open DMS Settings Modal | DMS IPC (`binds.kdl`) | Interactive desktop settings. |
|
||||
| `Mod+Shift+E` | Quit Niri Session | Niri Native (`binds.kdl`) | Exits Wayland compositor. |
|
||||
|
||||
### Window Management & Resizing
|
||||
| Shortcut | Action | Source |
|
||||
| :--- | :--- | :--- |
|
||||
| `Mod+Q` | Close Active Window | DMS IPC (`binds.kdl`) |
|
||||
| `Mod+Shift+Q` | Force Kill Focused Window Process (`kill -9`) | Custom (`custom.kdl`) |
|
||||
| `Mod+F` | Maximize Focused Column | DMS IPC (`binds.kdl`) |
|
||||
| `Mod+Shift+F` | Fullscreen Window | DMS IPC (`binds.kdl`) |
|
||||
| `Mod+Shift+T` | Toggle Window Floating | DMS IPC (`binds.kdl`) |
|
||||
| `Mod+Shift+W` | Create DMS Window Rule | DMS IPC (`binds.kdl`) |
|
||||
| `Mod+Alt+Right / Left` | Expand / Shrink Column Width (+/- 100px) | Custom (`custom.kdl`) |
|
||||
| `Mod+Alt+Down / Up` | Expand / Shrink Window Height (+/- 100px) | Custom (`custom.kdl`) |
|
||||
|
||||
### Monitor & Workspace Navigation
|
||||
| Shortcut | Action | Source | Precedence Note |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `Mod+\`` | Focus Next Monitor | Custom (`custom.kdl`) | Orientation-agnostic toggle between displays. |
|
||||
| `Mod+Shift+\`` | Move Focused Column to Next Monitor | Custom (`custom.kdl`) | Orientation-agnostic window transfer across displays. |
|
||||
| `Mod+Ctrl+Left / Right` | Focus Monitor Left / Right | DMS IPC (`binds.kdl`) | Directional monitor switching. |
|
||||
| `Mod+Ctrl+Down / Up` | Focus Monitor Down / Up | Custom (`custom.kdl`) | Overrides DMS workspace move to allow vertical monitor switching. |
|
||||
| `Mod+Shift+Ctrl+Arrow / HJKL` | Move Column to Monitor (Directional) | DMS IPC (`binds.kdl`) | Directional window transfer across displays. |
|
||||
| `Mod+Ctrl+Page_Down / Page_Up` | Move Column to Workspace Down / Up | Custom (`custom.kdl`) | Relocated from `Mod+Ctrl+Down/Up` for arrow/page users. |
|
||||
| `Mod+Ctrl+U / Mod+Ctrl+I` | Move Column to Workspace Down / Up | DMS IPC (`binds.kdl`) | Directional workspace column transfer. |
|
||||
|
||||
### Screenshots, Screen Recording & Utilities
|
||||
| Shortcut | Action | Source |
|
||||
| :--- | :--- | :--- |
|
||||
| `Mod+S` | Interactive Area Screenshot | Custom (`custom.kdl`) |
|
||||
| `Mod+Shift+S` | Screenshot Active Window | Custom (`custom.kdl`) |
|
||||
| `Mod+Alt+S` | Screenshot Full Screen | Custom (`custom.kdl`) |
|
||||
| `Mod+W` | Record Selected Screen Area (wf-recorder) | Custom (`custom.kdl`, overrides tabbed column) |
|
||||
| `Mod+Shift+W` | Record Focused Monitor | Custom (`custom.kdl`) |
|
||||
| `Mod+Ctrl+W` | Record Selected Area + Audio | Custom (`custom.kdl`) |
|
||||
| `Mod+Ctrl+Shift+W` | Record Focused Monitor + Audio | Custom (`custom.kdl`) |
|
||||
| `Mod+Shift+C` | Eyedropper Color Picker (copies HEX to clipboard) | Custom (`custom.kdl`) |
|
||||
| `Mod+Ctrl+Shift+R` | Hot-Reload Niri Configuration | Custom (`custom.kdl`) |
|
||||
@@ -1,110 +0,0 @@
|
||||
# 💻 Declarative Development Environments
|
||||
|
||||
This guide shows how to run isolated project environments using `nix-shell` or `devShells` alongside `direnv` and `uv` to keep the global system environment clean.
|
||||
|
||||
---
|
||||
|
||||
## ⚡ DevShells and nix-shell
|
||||
|
||||
Instead of installing packages globally in [apps.nix](file:///home/kiskaadee/Config/modules/user/apps.nix) for one-off projects, define them per-project.
|
||||
|
||||
### 1. Classic `shell.nix` (Nix Channels)
|
||||
For standard Nix projects, place a `shell.nix` in your project root:
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
nodejs_20
|
||||
yarn
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "Welcome to the Node.js environment!"
|
||||
'';
|
||||
}
|
||||
```
|
||||
Run `nix-shell` to drop into this isolated shell with `node` and `yarn` pre-loaded.
|
||||
|
||||
### 2. Flake-based `devShell`
|
||||
For modern Flake projects, declare your `devShell` inside your `flake.nix`:
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
go
|
||||
golangci-lint
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
Run `nix develop` to enter this environment.
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Automated Shell Loading with `direnv`
|
||||
|
||||
`direnv` automatically activates your project-specific environment when you `cd` into its directory.
|
||||
|
||||
### Configuration
|
||||
1. In your project root, create a file named `.envrc`.
|
||||
2. Add one of the following lines based on your setup:
|
||||
* **For classic projects (`shell.nix`):**
|
||||
```bash
|
||||
use nix
|
||||
```
|
||||
* **For Flake-based projects (`flake.nix`):**
|
||||
```bash
|
||||
use flake
|
||||
```
|
||||
3. Allow the environment to load:
|
||||
```bash
|
||||
direnv allow
|
||||
```
|
||||
|
||||
As soon as you step into the directory, `direnv` populates `$PATH` and other variables with your Nix-defined tools. Leaving the folder unloads them automatically.
|
||||
|
||||
---
|
||||
|
||||
## 🐍 Python Projects: Nix + `uv` Workflow
|
||||
|
||||
To prevent library conflicts and keep the host system clean, combine Nix (for system-level packages/binaries like C libraries, python compilers) with `uv` (for project-level Python packages).
|
||||
|
||||
### Recommended Workflow:
|
||||
1. **Use Nix (`devShells` or `nix-shell`)** to make Python and system dependencies (like OpenSSL or PostgreSQL drivers) available:
|
||||
```nix
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
python311
|
||||
uv
|
||||
openssl
|
||||
];
|
||||
}
|
||||
```
|
||||
2. **Use `uv`** inside that environment to manage the virtual environment and install Python-specific libraries cleanly:
|
||||
```bash
|
||||
# Create the virtualenv
|
||||
uv venv
|
||||
|
||||
# Activate the environment
|
||||
source .venv/bin/activate
|
||||
|
||||
# Install dependencies lightning-fast without polluting system packages
|
||||
uv pip install fastapi uvicorn
|
||||
```
|
||||
3. **Ensure `.envrc`** loads both the Nix shell and the virtual environment automatically:
|
||||
```bash
|
||||
use flake
|
||||
layout python
|
||||
```
|
||||
This triggers standard Nix tools and sources `.venv/bin/activate` simultaneously upon changing directories.
|
||||
@@ -1,92 +0,0 @@
|
||||
# 🌐 Dynu IP Monitor Service (dynu-ip-monitor)
|
||||
|
||||
This service manages the Dynamic DNS (DDNS) lifecycle for your host. Instead of continuously polling public APIs (which can lead to blocks or rate-limits), it implements a smart, local-first change detector that updates Dynu via `ddclient` **only when an actual WAN IP rotation is detected**.
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Architecture and Logic Flow
|
||||
|
||||
The synchronization process runs in the background as a system service completely decoupled from the graphical user session.
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Timer triggers dynu-monitor.service] --> B[Fetch public IP via HTTP]
|
||||
B --> C{Verify public IPv4?}
|
||||
C -- No/Timeout --> D[Log warning to journald & Fallback to next provider]
|
||||
C -- Yes --> E[Read history database log]
|
||||
E --> F{Did IP change?}
|
||||
F -- No --> G[Exit cleanly]
|
||||
F -- Yes --> H[Log rotation in history log]
|
||||
H --> I[Trigger systemctl start ddclient.service]
|
||||
I --> J{ddclient success?}
|
||||
J -- Yes --> K[Record success in ip_history.jsonl]
|
||||
J -- No --> L[Record failed_update in ip_history.jsonl & exit 1]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔍 Public IP Discovery & Validation
|
||||
|
||||
### 1. HTTP Resolvers with Fallback
|
||||
The script queries multiple independent IP reflection endpoints sequentially to handle offline states or service outages:
|
||||
1. `https://api.ipify.org`
|
||||
2. `https://ifconfig.me/ip`
|
||||
3. `https://icanhazip.com`
|
||||
4. `https://wtfismyip.com/text`
|
||||
|
||||
If a provider fails or times out, the script logs the warning to `stderr` and falls back to the next provider. If all providers fail, it exits with a non-zero code to flag a connectivity issue.
|
||||
|
||||
### 2. IP Address Validation
|
||||
Every returned IP must pass a verification check to ensure it is a valid public IPv4 address. The check rejects:
|
||||
* Loopback ranges (`127.0.0.0/8`)
|
||||
* Private networks / RFC 1918 (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`)
|
||||
* Link-local addresses (`169.254.0.0/16`)
|
||||
* Carrier-Grade NAT / CGNAT (`100.64.0.0/10`)
|
||||
|
||||
---
|
||||
|
||||
## 📊 Persistent History Registry
|
||||
|
||||
The monitor maintains a historical log of all your public IP assignments in a JSONLines format at `/var/lib/dynu/ip_history.jsonl`.
|
||||
|
||||
Each entry records the timestamp, IP address, and status:
|
||||
```json
|
||||
{"timestamp": "2026-06-24T02:00:00Z", "ip": "186.116.231.181", "status": "success"}
|
||||
{"timestamp": "2026-06-24T02:30:00Z", "ip": "186.116.231.181", "status": "success"}
|
||||
{"timestamp": "2026-06-24T03:00:00Z", "ip": "186.116.232.40", "status": "success"}
|
||||
```
|
||||
|
||||
At each check, the monitor compares the current public IP with the **last recorded successful IP** in the history file. If they match, the monitor exits cleanly without invoking the DNS provider APIs.
|
||||
|
||||
---
|
||||
|
||||
## 🔑 secrets-management & sops-nix Integration
|
||||
|
||||
### Dynamic User Credentials Access
|
||||
The `ddclient` service in NixOS runs with systemd `DynamicUser=true` for security. Because the dynamic user doesn't exist statically, standard file ownership can prevent access.
|
||||
|
||||
We resolve this by using systemd **`LoadCredential`**:
|
||||
1. `sops-nix` decrypts the credentials file owned by `root:root` into `/run/secrets/`.
|
||||
2. The systemd service for `ddclient` is injected with:
|
||||
```nix
|
||||
LoadCredential = [ "ddclient.conf:${config.sops.templates."ddclient.conf".path}" ];
|
||||
```
|
||||
3. Systemd copies the file securely, adjusts permissions, and exposes it inside the service boundaries at:
|
||||
`/run/credentials/ddclient.service/ddclient.conf`
|
||||
4. `ddclient` reads the configuration from the credentials directory.
|
||||
|
||||
---
|
||||
|
||||
## ⏱️ Systemd Timers & Services Configuration
|
||||
|
||||
The updater is divided into two systemd units defined in [dynu.nix](file:///home/kiskaadee/Config/hosts/desktop/dynu.nix):
|
||||
|
||||
### 1. `dynu-monitor.timer`
|
||||
Runs every 30 minutes. It triggers the `dynu-monitor.service` which executes the Python script.
|
||||
|
||||
### 2. `ddclient.service` (On-Demand)
|
||||
The automatic `ddclient.timer` is disabled. The service is only triggered by the Python script using:
|
||||
```bash
|
||||
systemctl start ddclient.service
|
||||
```
|
||||
This ensures your host only makes outbound API calls to Dynu when a rotation actually occurs, maintaining zero overhead.
|
||||
@@ -0,0 +1,134 @@
|
||||
# 🚀 Getting Started: Fresh Installation & Recovery
|
||||
|
||||
This document is the operational procedure for bootstrapping the workstation host (`laptop`) from bare metal or recovering after a drive replacement.
|
||||
|
||||
---
|
||||
|
||||
## 1. Prerequisites & Installation Media
|
||||
|
||||
1. Download the latest official NixOS Minimal ISO from [nixos.org](https://nixos.org/download.html).
|
||||
2. Flash the ISO to a USB flash drive:
|
||||
```bash
|
||||
sudo dd if=nixos-minimal-*.iso of=/dev/sdX bs=4M status=progress conv=fsync
|
||||
```
|
||||
3. Boot the laptop from the USB drive in UEFI mode.
|
||||
|
||||
---
|
||||
|
||||
## 2. Disk Partitioning & Mounting
|
||||
|
||||
> [!NOTE]
|
||||
> **Example Reference Partitioning Layout**
|
||||
> The following partitioning recipe is a standard reference layout for a clean NVMe drive. If recovering an existing drive, or using Btrfs, ZFS, or LUKS encryption, adjust partition identifiers and mount existing subvolumes/filesystems accordingly. The actual filesystem UUIDs and mount options will be captured into `system/hardware-configuration.nix` in the next step.
|
||||
|
||||
Assuming NVMe target drive `/dev/nvme0n1`:
|
||||
|
||||
```bash
|
||||
# 1. Create GPT partition table
|
||||
parted /dev/nvme0n1 -- mklabel gpt
|
||||
|
||||
# 2. EFI System Partition (1GB, FAT32)
|
||||
parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 1024MiB
|
||||
parted /dev/nvme0n1 -- set 1 esp on
|
||||
|
||||
# 3. Root Partition (remaining space, Ext4 or Btrfs)
|
||||
parted /dev/nvme0n1 -- mkpart primary ext4 1024MiB 100%
|
||||
|
||||
# 4. Format filesystems
|
||||
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
|
||||
mkfs.ext4 -L nixos /dev/nvme0n1p2
|
||||
|
||||
# 5. Mount targets for installation
|
||||
mount /dev/disk/by-label/nixos /mnt
|
||||
mkdir -p /mnt/boot
|
||||
mount /dev/disk/by-label/BOOT /mnt/boot
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Clone Repository & Hardware Detection
|
||||
|
||||
```bash
|
||||
# Generate hardware configuration scan into a temporary directory
|
||||
nixos-generate-config --root /mnt
|
||||
|
||||
# Clone the declarative workstation configuration
|
||||
git clone https://github.com/kiskaadee/Config.git /mnt/etc/nixos
|
||||
|
||||
# Replace the repository hardware configuration with the generated one
|
||||
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/system/hardware-configuration.nix
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Verify that the filesystem UUIDs in `system/hardware-configuration.nix` match the output of `blkid /dev/nvme0n1p*`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Install & Initial System Build
|
||||
|
||||
```bash
|
||||
# Enable flakes on the installer shell
|
||||
export NIX_CONFIG="experimental-features = nix-command flakes"
|
||||
|
||||
# Perform initial system installation using the laptop target
|
||||
nixos-install --flake /mnt/etc/nixos#laptop
|
||||
|
||||
# Set root and user passwords when prompted, then reboot:
|
||||
reboot
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 5. First Graphical Login & Desktop Bootstrap
|
||||
|
||||
1. Remove the USB flash drive and boot into the installed system.
|
||||
2. At the `dank-greeter` display manager screen, log in as `kiskaadee`.
|
||||
3. Open a terminal (`Mod+Return`).
|
||||
|
||||
### Desktop Initialization Phase
|
||||
On a fresh user profile (or after recreating `$HOME`), initialize DMS's mutable baseline keybindings with:
|
||||
|
||||
```bash
|
||||
dms setup binds
|
||||
```
|
||||
|
||||
This generates `~/.config/niri/dms/binds.kdl` with standard user write permissions (`0644`).
|
||||
|
||||
> [!IMPORTANT]
|
||||
> `binds.kdl` is not part of the declarative workstation configuration. It is a bootstrap-owned artifact whose initial contents are established by `dms setup binds`, establishing the DMS-managed Niri IPC integration bindings. Subsequent edits via the DMS Settings GUI or CLI mutate this file directly.
|
||||
>
|
||||
> From this point forward:
|
||||
> - Niri loads all standard DMS IPC shortcuts (`Mod+Space` for spotlight launcher, `Mod+V` for clipboard, `Mod+M` for task manager, `Super+X` for power menu, volume and brightness controls).
|
||||
> - DMS owns, updates, and mutates `~/.config/niri/dms/` and `~/.config/DankMaterialShell/settings.json` without conflicting with the declarative Nix store.
|
||||
|
||||
---
|
||||
|
||||
## 6. Operator Secrets Bootstrap (Access to Core)
|
||||
|
||||
The workstation acts as the administrative cockpit for the homelab. To enable editing and rotating secrets in `Core`:
|
||||
|
||||
1. Restore your personal `age` secret key from a secure backup (e.g. Bitwarden or offline medium) into:
|
||||
```bash
|
||||
mkdir -p ~/.config/sops/age
|
||||
chmod 700 ~/.config/sops/age
|
||||
# Place your private key in:
|
||||
# ~/.config/sops/age/keys.txt
|
||||
chmod 600 ~/.config/sops/age/keys.txt
|
||||
```
|
||||
2. Verify operator decryption capability:
|
||||
```bash
|
||||
cd ~/Projects/active/homelab/Core/nixos
|
||||
sops secrets.yaml
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Verification Checklist
|
||||
|
||||
| Check | Command | Expected Outcome |
|
||||
| :--- | :--- | :--- |
|
||||
| Flake Validation | `nix flake check` | Evaluates with zero errors. |
|
||||
| Dry Build | `nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link` | Builds cleanly. |
|
||||
| Compositor Status | `niri msg version` | Reports running Niri version. |
|
||||
| DMS Shell Daemon | `systemctl --user status dms.service` | Active (running). |
|
||||
| Desktop Search | `systemctl --user status dsearch.service` | Active (running) on port 43654. |
|
||||
@@ -0,0 +1,90 @@
|
||||
# 🌐 Workstation Networking & Remote Access
|
||||
|
||||
This document details network management, OpenSSH client infrastructure, and remote workstation accessibility.
|
||||
|
||||
---
|
||||
|
||||
## 1. Local Network Stack: NetworkManager
|
||||
|
||||
The workstation manages network interfaces, Wi-Fi connections, and DNS via **NetworkManager** declared in `system/core.nix`:
|
||||
|
||||
```nix
|
||||
networking = {
|
||||
hostName = "laptop";
|
||||
networkmanager.enable = true;
|
||||
};
|
||||
```
|
||||
|
||||
### Essential CLI Operations
|
||||
```bash
|
||||
# Scan available Wi-Fi networks
|
||||
nmcli dev wifi list
|
||||
|
||||
# Connect to a Wi-Fi network
|
||||
nmcli dev wifi connect "SSID_NAME" password "PASSPHRASE"
|
||||
|
||||
# Check active connections
|
||||
nmcli con show --active
|
||||
|
||||
# Monitor network device status
|
||||
nmcli device status
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. Workstation Remote Access: OpenSSH Daemon
|
||||
|
||||
Local SSH access is enabled in `system/core.nix` with strict security defaults:
|
||||
|
||||
```nix
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PermitRootLogin = "no";
|
||||
PasswordAuthentication = false;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
> [!NOTE]
|
||||
> The local OpenSSH daemon is an interactive workstation tool (for remote terminal sessions, LAN editor attachments, and file transfers). It is **not** server infrastructure.
|
||||
|
||||
---
|
||||
|
||||
## 3. SSH Client Profiles & Homelab Ingress
|
||||
|
||||
SSH client connections are declaratively managed by Home Manager in `home/shell.nix`.
|
||||
|
||||
### Defined Host Blocks
|
||||
| Host Alias | Destination | Port | Use Case |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **`server-local`** | `192.168.1.200` | 22 | High-speed LAN access to the 24/7 homelab host. |
|
||||
| **`server-remote`** | `server.roadtotech.me` | 2222 | Remote WAN access through the external edge firewall. |
|
||||
| **`gitea.roadtotech.me`** | `server.roadtotech.me` | 2223 | Git SSH operations for self-hosted repositories. |
|
||||
|
||||
### Connecting to the Homelab Host
|
||||
```bash
|
||||
# On home Wi-Fi (direct LAN connection):
|
||||
ssh server-local
|
||||
|
||||
# Outside home (remote connection):
|
||||
ssh server-remote
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Bluetooth & Peripheral Networking
|
||||
|
||||
Bluetooth hardware support and audio integration are managed in `system/hardware.nix`:
|
||||
|
||||
```bash
|
||||
# Open interactive Bluetooth controller
|
||||
bluetoothctl
|
||||
|
||||
# Common pairing sequence:
|
||||
# power on
|
||||
# scan on
|
||||
# pair <MAC>
|
||||
# connect <MAC>
|
||||
# trust <MAC>
|
||||
```
|
||||
@@ -1,82 +0,0 @@
|
||||
# 📦 Package & Secrets Workflow Guide
|
||||
|
||||
This guide covers the day-to-day workflow for managing user-space packages and sensitive information (secrets) within this NixOS configuration.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Adding a New Package
|
||||
|
||||
User-space applications are managed declaratively using Home Manager in [modules/user/apps.nix](file:///home/kiskaadee/Config/modules/user/apps.nix).
|
||||
|
||||
### Step 1: Find the Package Name
|
||||
Before adding a package, look up its exact attribute name:
|
||||
* **Search Engine:** Go to the official [NixOS Package Search](https://search.nixos.org/packages).
|
||||
* **CLI Search:**
|
||||
```bash
|
||||
nix-env -qaP '<package-name>'
|
||||
# Or using modern flake-native search:
|
||||
nix search nixpkgs <query>
|
||||
```
|
||||
|
||||
### Step 2: Update `apps.nix`
|
||||
Open [modules/user/apps.nix](file:///home/kiskaadee/Config/modules/user/apps.nix) and append the package name directly into the list inside `home.packages`:
|
||||
|
||||
```nix
|
||||
home.packages = with pkgs; [
|
||||
# ... existing packages
|
||||
|
||||
# Text Editors / Development
|
||||
neovim
|
||||
|
||||
# New Package Example
|
||||
ripgrep # Modern grep alternative for fast directory search
|
||||
];
|
||||
```
|
||||
|
||||
### Step 3: Test and Switch
|
||||
Verify the package builds correctly before switching system-wide:
|
||||
```bash
|
||||
# Test build without applying
|
||||
nix build .#nixosConfigurations.desktop.config.system.build.toplevel --no-link
|
||||
|
||||
# Apply configuration
|
||||
sudo nixos-rebuild switch --flake .#desktop
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔒 Adding a New Secret (SOPS Workflow)
|
||||
|
||||
Sensitive credentials (like passwords, API keys, and environment variables) are managed using `sops-nix`.
|
||||
|
||||
### Step 1: Edit the Secrets File
|
||||
Launch `sops` inside `nix-shell` to decrypt and edit the target secrets file (e.g., [secrets.yaml](file:///home/kiskaadee/Config/hosts/desktop/secrets.yaml)):
|
||||
```bash
|
||||
nix-shell -p sops --run "sops hosts/desktop/secrets.yaml"
|
||||
```
|
||||
Add your key-value pair under the YAML structure:
|
||||
```yaml
|
||||
my_new_api_key: "secure_token_goes_here"
|
||||
```
|
||||
*When you save and close your editor, SOPS automatically encrypts the file before saving it back to disk.*
|
||||
|
||||
### Step 2: Declare the Secret in Nix
|
||||
To make the decrypted secret available to services or applications at runtime, register it in your Nix configuration (e.g., in [hosts/desktop/dynu.nix](file:///home/kiskaadee/Config/hosts/desktop/dynu.nix)):
|
||||
|
||||
```nix
|
||||
sops.secrets.my_new_api_key = {
|
||||
# (Optional) Restrict file access to specific users/groups
|
||||
owner = "root";
|
||||
group = "root";
|
||||
mode = "0400";
|
||||
};
|
||||
```
|
||||
|
||||
### Step 3: Reference the Decrypted Path
|
||||
Once declared, `sops-nix` exposes the decrypted value under `/run/secrets/` at boot time. You can reference the file path dynamically in your Nix configuration using:
|
||||
|
||||
```nix
|
||||
# This resolves to "/run/secrets/my_new_api_key"
|
||||
config.sops.secrets.my_new_api_key.path
|
||||
```
|
||||
Avoid hardcoding raw paths; instead, pass this dynamic path directly to service configurations (e.g., via `EnvironmentFile` or command-line flags).
|
||||
@@ -0,0 +1,48 @@
|
||||
# 🤖 Antigravity AI Agent Reference
|
||||
|
||||
This document outlines the Antigravity AI pair programming agent integration, operating boundaries, and tool conventions for this workstation.
|
||||
|
||||
---
|
||||
|
||||
## 1. Operating Rules & Boundaries
|
||||
|
||||
AI agents operating in this repository are governed by the constitution defined in [`AGENTS.md`](file:///home/kiskaadee/Config/AGENTS.md).
|
||||
|
||||
### The Golden Rule: Build, Never Switch
|
||||
Autonomous agents must **never** execute `nixos-rebuild switch`, `boot`, `test`, or mutate the running host state. Agents:
|
||||
1. May **read** repository files.
|
||||
2. May **modify** declarations in `system/` and `home/`.
|
||||
3. Must **validate** via dry builds (`nix flake check` and `nix build ... --no-link`).
|
||||
|
||||
---
|
||||
|
||||
## 2. Second Brain Inbox Capture Rule
|
||||
|
||||
Whenever an agent produces an artifact (`UserFacing: true`) or substantial analysis, a copy must be preserved in the Second Brain staging inbox:
|
||||
|
||||
```text
|
||||
/home/kiskaadee/Brain/00-inbox/<descriptive-name>.md
|
||||
```
|
||||
|
||||
With frontmatter:
|
||||
```yaml
|
||||
---
|
||||
type: inbox
|
||||
created: YYYY-MM-DD
|
||||
---
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Toolchains & Local Binaries
|
||||
|
||||
The workstation uses the community-maintained `github:jacopone/antigravity-nix` flake input, which tracks and bundles the three Antigravity surfaces with regular upstream updates:
|
||||
- `agy` CLI binary (`google-antigravity-cli`) declared in [`home/dev.nix`](file:///home/kiskaadee/Config/home/dev.nix).
|
||||
- Antigravity 2.0 Desktop GUI (`google-antigravity`) declared in [`home/desktop.nix`](file:///home/kiskaadee/Config/home/desktop.nix).
|
||||
- Antigravity IDE (`google-antigravity-ide`) declared in [`home/desktop.nix`](file:///home/kiskaadee/Config/home/desktop.nix).
|
||||
|
||||
Antigravity operates in an interactive development environment with access to:
|
||||
- Installed Antigravity tools and editors.
|
||||
- Python runtime, Ruff, and Pyright.
|
||||
- Git, ripgrep (`rg`), and fd (`find_by_name`).
|
||||
- Nix CLI (`nix flake check`, `nix build`, `nix eval`).
|
||||
@@ -0,0 +1,57 @@
|
||||
# 📝 Neovim Architecture & Keymaps
|
||||
|
||||
This document outlines the Neovim editor setup declared in `home/dev.nix` and `home/config/nvim/`.
|
||||
|
||||
---
|
||||
|
||||
## 1. Neovim Configuration Architecture
|
||||
|
||||
Neovim is configured through a hybrid Nix / Lua model:
|
||||
- **Nix Layer (`home/dev.nix`)**: Packages, tree-sitter grammars, and language server packages (LSPs) installed into `$PATH`.
|
||||
- **Lua Layer (`home/config/nvim/`)**: Modular Lua configuration symlinked to `~/.config/nvim/`:
|
||||
- `init.lua`: Editor options, leader key (`Space`), and module loader.
|
||||
- `lua/plugins.lua`: Lazy/Packer plugin definitions.
|
||||
- `lua/keymaps.lua`: Core keybindings and normal/visual mode ergonomics.
|
||||
- `lua/lsp.lua`: Language Server Protocol client handlers and completions.
|
||||
|
||||
---
|
||||
|
||||
## 2. Integrated Toolchains & LSPs
|
||||
|
||||
The following language servers are installed globally via `home/dev.nix` and attached automatically:
|
||||
|
||||
| Language | Language Server / Tool | Formatter / Linter |
|
||||
| :--- | :--- | :--- |
|
||||
| **Nix** | `nil` | `nixfmt-rfc-style` |
|
||||
| **Rust** | `rust-analyzer` | `rustfmt` |
|
||||
| **Python** | `pyright` *(devshell / venv)* | `ruff` *(devshell / venv)* |
|
||||
| **JavaScript / TypeScript** | `typescript-language-server` | `prettier` |
|
||||
| **Go** | `gopls` | `gofmt` |
|
||||
| **Markdown / Documentation** | `marksman` | `prettier` |
|
||||
|
||||
> [!NOTE]
|
||||
> Python language tooling (`pyright`, `ruff`) is resolved dynamically via `direnv` from individual project devshells or virtualenvs rather than global system packages.
|
||||
|
||||
---
|
||||
|
||||
## 3. Essential Keybindings
|
||||
|
||||
- **Leader Key**: `Space`
|
||||
|
||||
### Navigation & Files
|
||||
| Shortcut | Action |
|
||||
| :--- | :--- |
|
||||
| `<leader>ff` | Find files (Telescope). |
|
||||
| `<leader>fg` | Live grep across project. |
|
||||
| `<leader>fb` | Switch active buffer. |
|
||||
| `<leader>e` | Toggle file explorer tree. |
|
||||
|
||||
### LSP & Diagnostics
|
||||
| Shortcut | Action |
|
||||
| :--- | :--- |
|
||||
| `gd` | Go to definition. |
|
||||
| `gr` | Go to references. |
|
||||
| `K` | Hover documentation. |
|
||||
| `<leader>rn` | Rename symbol. |
|
||||
| `<leader>ca` | Code action. |
|
||||
| `[d` / `]d` | Jump to previous / next diagnostic error. |
|
||||
@@ -0,0 +1,81 @@
|
||||
# 🐚 Shell & CLI Environment Reference
|
||||
|
||||
This document catalogs the interactive Bash shell configuration, Starship prompt integration, and custom helper scripts managed in `home/shell.nix` and `home/shell/`.
|
||||
|
||||
---
|
||||
|
||||
## 1. Shell Configuration Architecture
|
||||
|
||||
The shell environment is modularized:
|
||||
- **`home/shell.nix`**: Core Home Manager bash module, aliases, environment exports, and tool integrations (Direnv, Starship, Fastfetch).
|
||||
- **`home/shell/`**: Domain-specific sourced shell scripts:
|
||||
- `git.sh`: Git helper functions and branch utilities.
|
||||
- `jump.sh`: Directory navigation and quick jumping.
|
||||
- `pdf.sh`: PDF compilation, viewing, and OCR helpers.
|
||||
- `quicklinks.sh`: Shortcuts to primary project directories.
|
||||
- `secrets.sh`: SOPS secret retrieval (`gh-token` clipboard utility, transparent `flarectl` and `hostinger` process wrappers).
|
||||
- `todo.sh`: Lightweight terminal task tracking.
|
||||
- `wayland.sh`: Wayland session environment variables and clipboard helpers.
|
||||
|
||||
---
|
||||
|
||||
## 2. Shell Aliases & Shortcuts
|
||||
|
||||
### System & Navigation
|
||||
| Alias | Target Command | Purpose |
|
||||
| :--- | :--- | :--- |
|
||||
| `c` | `clear` | Clear terminal scrollback. |
|
||||
| `q` | `exit` | Close shell session. |
|
||||
| `ls` | `eza --icons` | Modern directory listing. |
|
||||
| `ll` | `eza -la --icons` | Detailed directory listing. |
|
||||
| `tree` | `eza --tree --icons` | Directory tree visualization. |
|
||||
| `cat` | `bat --paging=never` | Syntax-highlighted file viewing. |
|
||||
|
||||
### Git & Workflows
|
||||
| Alias | Target Command | Purpose |
|
||||
| :--- | :--- | :--- |
|
||||
| `gs` | `git status` | Quick working tree status. |
|
||||
| `gd` | `git diff` | Syntax-highlighted git diff via Delta. |
|
||||
| `gl` | `git log --oneline --graph --decorate` | Compact visual commit graph. |
|
||||
| `ght` | `gh-token` | Copy GitHub repo token from SOPS into Wayland clipboard. |
|
||||
|
||||
### Operator CLI Secret Wrappers (`home/shell/secrets.sh`)
|
||||
| Command / Function | Injected Environment Variables | Source Secret Key (`~/Config/secrets.yaml`) |
|
||||
| :--- | :--- | :--- |
|
||||
| `flarectl` | `CF_API_TOKEN`, `CF_ACCOUNT_ID` | `["cloudflare"]["api_token"]`, `["cloudflare"]["account_id"]` |
|
||||
| `hostinger` | `HOSTINGER_API_TOKEN` | `["hostinger"]["api_token"]` |
|
||||
| `gh-token` (`ght`) | *(Copies directly to Wayland clipboard)* | `["system"]["gh_repo_token"]` (from Homelab `Core`) |
|
||||
|
||||
*Note: Environment variables are set exclusively for the child process lifecycle and do not persist in your interactive shell.*
|
||||
|
||||
### Directory Navigation Jumps (`home/shell/jump.sh`)
|
||||
| 2-Letter | Word Alias | Target Directory | Description |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `br` | `brain` | `~/Brain` | Second brain knowledge base. |
|
||||
| `cf` | `conf` / `cfg` | `~/Config` | Declarative NixOS configuration. |
|
||||
| `dc` | `doc` / `docs` | `~/Documents` | Personal documents. |
|
||||
| `dl` | `dl` | `~/Downloads` | Downloads folder. |
|
||||
| `pi` | `pic` / `pict` | `~/Pictures` | Wallpapers, images, screenshots. |
|
||||
| `pj` | `pj` / `prj` | `~/Projects` | Local workspace for project repositories. |
|
||||
| `hl` | `hl` / `homelab` | `~/Homelab` | Local workspace for homelab repositories. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Modular Shell Scripts (`home/shell/`)
|
||||
|
||||
All files in `home/shell/*.sh` are automatically sourced during interactive bash startup:
|
||||
|
||||
```bash
|
||||
for script in ~/.config/bash/*.sh; do
|
||||
[ -r "$script" ] && source "$script"
|
||||
done
|
||||
```
|
||||
|
||||
### Adding a New Shell Extension
|
||||
To add new bash functions or aliases:
|
||||
1. Create a new `.sh` file under `home/shell/<topic>.sh`.
|
||||
2. Add the source link in `home/shell.nix`:
|
||||
```nix
|
||||
home.file.".config/bash/<topic>.sh".source = ./shell/<topic>.sh;
|
||||
```
|
||||
3. Rebuild and restart the shell.
|
||||
@@ -0,0 +1,130 @@
|
||||
# 🪟 Terminal Workspaces & Tmux Reference
|
||||
|
||||
This reference covers the operational controls, keybindings, and workflows for persistent workspaces and terminal multiplexing on the `laptop` workstation.
|
||||
|
||||
---
|
||||
|
||||
## 1. Terminal Workflows
|
||||
|
||||
| Shortcut | Action | Semantics |
|
||||
| :--- | :--- | :--- |
|
||||
| `Mod+Return` | **Alacritty Shell** | Opens a standard shell immediately. Ephemeral, isolated, non-persistent. |
|
||||
| `Mod+T` | **Workspace Selector** | Opens Alacritty running the interactive sessionizer (`ts`). Exiting `fzf` with `Esc` closes the window cleanly. |
|
||||
|
||||
---
|
||||
|
||||
## 2. Sessionizer CLI (`ts`)
|
||||
|
||||
The `ts` utility (`tmux-sessionizer`) connects directly to persistent tmux workspaces:
|
||||
|
||||
```bash
|
||||
# Interactive fuzzy selector (shows session name and path)
|
||||
ts
|
||||
|
||||
# Open a workspace by name (exact or normalized)
|
||||
ts config
|
||||
ts brain
|
||||
ts core
|
||||
ts bitetrack-api
|
||||
|
||||
# Open a workspace by unique substring
|
||||
ts magnet # Resolves to MagNetFlix
|
||||
|
||||
# Open a workspace by direct filesystem path
|
||||
ts ~/Config
|
||||
ts ~/Projects/active/nekoweb
|
||||
```
|
||||
|
||||
### Argument Resolution Order
|
||||
When an argument is provided (`ts <arg>`), it resolves in this exact order:
|
||||
1. **Existing directory**: Canonicalizes path via `realpath`.
|
||||
2. **Exact session name**: Matches normalized session name.
|
||||
3. **Exact directory basename**: Matches directory name.
|
||||
4. **Unique substring**: Matches against names and paths.
|
||||
|
||||
*Ambiguous matches fail safely with an error and candidate list rather than guessing.*
|
||||
|
||||
---
|
||||
|
||||
## 3. Workspace Discovery
|
||||
|
||||
The sessionizer automatically indexes workspaces from:
|
||||
|
||||
- **Explicit Workspaces**:
|
||||
- `~/Config`
|
||||
- `~/Brain`
|
||||
- `~/Homelab/Core`
|
||||
- **Git Repositories**:
|
||||
- Discovered beneath `~/Projects` and `~/Homelab` (depth 4).
|
||||
|
||||
*Any directory passed directly as a path (`ts <path>`) works immediately without needing to be under discovery roots.*
|
||||
|
||||
---
|
||||
|
||||
## 4. Tmux Behavior & Persistence
|
||||
|
||||
- **Outside Tmux**: Running `ts` creates or attaches to the session.
|
||||
- **Inside Tmux**: Running `ts` switches the active client (`switch-client`) without nesting sessions.
|
||||
- **Session State**: New sessions start in the workspace folder. Reconnecting to an existing session preserves your current working directory, open files, and terminal buffers.
|
||||
- **Persistence**: Closing an Alacritty window leaves background jobs and tmux sessions running. Reconnect at any time by pressing `Mod+T` or running `ts <name>`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Tmux Controls & Keybindings
|
||||
|
||||
- **Prefix Key**: `Ctrl+Space` (`C-Space`)
|
||||
- **Terminal Capabilities**: TrueColor (`tmux-256color`) with RGB support and extended keys enabled.
|
||||
- **Mouse Support**: Enabled for scrolling, pane selection, and resizing.
|
||||
|
||||
### Smart Neovim / Tmux Navigation (No Prefix Required)
|
||||
Navigate between Neovim splits and Tmux panes seamlessly using `Ctrl+h/j/k/l`:
|
||||
|
||||
| Shortcut | Action |
|
||||
| :--- | :--- |
|
||||
| `Ctrl+h` | Move to left pane / Neovim split. |
|
||||
| `Ctrl+j` | Move to down pane / Neovim split. |
|
||||
| `Ctrl+k` | Move to up pane / Neovim split. |
|
||||
| `Ctrl+l` | Move to right pane / Neovim split. |
|
||||
|
||||
*(Fallback navigation using prefix: `Ctrl+Space h/j/k/l`)*
|
||||
|
||||
### Pane Management (Prefix: `Ctrl+Space`)
|
||||
| Shortcut | Action |
|
||||
| :--- | :--- |
|
||||
| `Ctrl+Space \|` | Split window horizontally (opens in current working directory). |
|
||||
| `Ctrl+Space -` | Split window vertically (opens in current working directory). |
|
||||
| `Ctrl+Space H / J / K / L` | Resize pane left, down, up, right by 5 cells. |
|
||||
| `Ctrl+Space z` | Toggle full-screen zoom on active pane. |
|
||||
| `Ctrl+Space x` | Kill active pane. |
|
||||
|
||||
### Window Management (Prefix: `Ctrl+Space`)
|
||||
| Shortcut | Action |
|
||||
| :--- | :--- |
|
||||
| `Ctrl+Space c` | Create new window. |
|
||||
| `Ctrl+Space n` | Next window. |
|
||||
| `Ctrl+Space p` | Previous window. |
|
||||
| `Ctrl+Space 1..9` | Switch directly to window index `1..9`. |
|
||||
| `Ctrl+Space ,` | Rename current window. |
|
||||
| `Ctrl+Space r` | Reload `~/.config/tmux/tmux.conf`. |
|
||||
|
||||
### Copy Mode (Vi-Style)
|
||||
| Shortcut | Action |
|
||||
| :--- | :--- |
|
||||
| `Ctrl+Space Escape` | Enter copy mode. |
|
||||
| `v` | Begin text selection (in copy mode). |
|
||||
| `Ctrl+v` | Toggle rectangle / block selection. |
|
||||
| `y` | Copy selection to system clipboard (via OSC 52) and exit copy mode. |
|
||||
|
||||
---
|
||||
|
||||
## 6. Verification Commands
|
||||
|
||||
```bash
|
||||
# Validate flake metadata & checks
|
||||
nix flake check
|
||||
|
||||
# Build laptop configuration without switching
|
||||
nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link
|
||||
```
|
||||
|
||||
*(For architectural background, boundary models, and design principles, see `Brain/records/decisions/terminal-workspace-architecture.md`)*.
|
||||
@@ -1,82 +0,0 @@
|
||||
# 🔒 Secrets Management via sops-nix
|
||||
|
||||
This repository utilizes **`sops-nix`** (integrated with Mozilla SOPS and `age`) to manage all sensitive information (passwords, tokens, API keys) declaratively and securely.
|
||||
|
||||
Secrets are stored encrypted directly in the Git repository, and decrypted dynamically at boot into memory (`/run/secrets/`), ensuring no credentials leak into the public-readable Nix store.
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ Bootstrapping Secrets on a Recreated Server
|
||||
|
||||
If you are setting up a new host or rebuilding the system from scratch, follow these steps to configure your secrets key structure.
|
||||
|
||||
### Step 1: Generate a User age Key Pair
|
||||
To encrypt and decrypt files on your local machine, generate a native `age` key pair:
|
||||
```bash
|
||||
# Create the standard config directory
|
||||
mkdir -p ~/.config/sops/age
|
||||
|
||||
# Generate the age key pair
|
||||
nix-shell -p age --run "age-keygen -o ~/.config/sops/age/keys.txt"
|
||||
|
||||
# Lock down key permissions
|
||||
chmod 600 ~/.config/sops/age/keys.txt
|
||||
```
|
||||
To print your public key for configuration, run:
|
||||
```bash
|
||||
grep "public key" ~/.config/sops/age/keys.txt
|
||||
```
|
||||
|
||||
### Step 2: Convert the Host SSH Public Key to age
|
||||
To allow systemd to decrypt secrets automatically at boot time, obtain the host's SSH public key converted to `age` format:
|
||||
```bash
|
||||
nix run nixpkgs#ssh-to-age -- -i /etc/ssh/ssh_host_ed25519_key.pub
|
||||
```
|
||||
*Note: The private key counterpart `/etc/ssh/ssh_host_ed25519_key` is automatically read by `sops-nix` at boot with root privileges.*
|
||||
|
||||
### Step 3: Configure Public Keys in `.sops.yaml`
|
||||
Add both the user `age` public key and the host `age` public key to the [.sops.yaml](file:///home/kiskaadee/Config/.sops.yaml) configuration file at the root of the repository:
|
||||
|
||||
```yaml
|
||||
keys:
|
||||
- &kiskaadee age1...your_user_age_key...
|
||||
- &desktop age1...your_host_age_key...
|
||||
|
||||
creation_rules:
|
||||
- path_regex: hosts/desktop/secrets\.yaml$
|
||||
key_groups:
|
||||
- pgp: []
|
||||
age:
|
||||
- *kiskaadee
|
||||
- *desktop
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✏️ Editing and Managing Secrets
|
||||
|
||||
Because `sops` automatically reads from your local `~/.config/sops/age/keys.txt` keyfile, you can manage secrets using simple commands:
|
||||
|
||||
### Create/Edit an Encrypted File
|
||||
```bash
|
||||
nix-shell -p sops --run "sops hosts/desktop/secrets.yaml"
|
||||
```
|
||||
This decrypts the file, opens it in your editor defined by `$EDITOR`, and automatically re-encrypts the values when you save and exit.
|
||||
|
||||
### Structure of `secrets.yaml`
|
||||
Provide your keys and values as standard YAML:
|
||||
```yaml
|
||||
dynu_user: your-username
|
||||
dynu_domain: your-domain.dynu.net
|
||||
dynu_password: your-secret-password-or-hash
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Runtime Decryption
|
||||
|
||||
At boot time, `sops-nix` performs the following steps:
|
||||
1. Systemd runs the `sops-install-secrets` activation script.
|
||||
2. The script reads `/etc/ssh/ssh_host_ed25519_key` to decrypt `hosts/desktop/secrets.yaml`.
|
||||
3. The values are exposed under `/run/secrets/` as individual files (or templates) with strict user/group ownership (typically restricted to `root`).
|
||||
4. Services read these paths at startup, keeping secrets secure and decoupled from the world-readable `/nix/store`.
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
# 🔐 Secrets Management & Homelab GitOps Workflow
|
||||
|
||||
This document explains the secrets architecture for the workstation (`laptop`) and provides step-by-step operator workflows for managing homelab secrets in [`Core`](file:///home/kiskaadee/Projects/active/homelab/Core).
|
||||
|
||||
---
|
||||
|
||||
## 1. Secrets Architecture: Author vs. Consumer
|
||||
|
||||
A core architectural principle of this infrastructure is the separation between **Secret Authoring** and **Secret Consumption**:
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
subgraph "Workstation (Operator / Author)"
|
||||
LAPTOP_KEY["~/.config/sops/age/keys.txt<br/>(&laptop private key)"]
|
||||
SOPS_CLI["sops CLI<br/>(home/dev.nix)"]
|
||||
CORE_LOCAL["Core/nixos/secrets.yaml<br/>(Git clone on laptop)"]
|
||||
|
||||
LAPTOP_KEY --> SOPS_CLI
|
||||
SOPS_CLI -->|Author & Encrypt| CORE_LOCAL
|
||||
end
|
||||
|
||||
CORE_LOCAL -->|"git push / pull"| CORE_REMOTE["~/Core/nixos/secrets.yaml<br/>(Server clone)"]
|
||||
|
||||
subgraph "Server (Consumer / Runtime)"
|
||||
HOST_SSH["/etc/ssh/ssh_host_ed25519_key<br/>(&server private key)"]
|
||||
SOPS_NIX["sops-nix systemd service<br/>(Runs as root at boot)"]
|
||||
RAM_FS["/run/secrets/*<br/>(Decrypted into RAM only)"]
|
||||
|
||||
CORE_REMOTE --> SOPS_NIX
|
||||
HOST_SSH --> SOPS_NIX
|
||||
SOPS_NIX --> RAM_FS
|
||||
end
|
||||
```
|
||||
|
||||
### Two-Tier Secrets Architecture
|
||||
|
||||
The infrastructure enforces a strict separation between **Operator Secrets** (workstation) and **Runtime Workload Secrets** (server):
|
||||
|
||||
| Attribute | Workstation Operator Secrets (`Config`) | Server Runtime Secrets (`Core`) |
|
||||
| :--- | :--- | :--- |
|
||||
| **Ciphertext File** | `Config/secrets.yaml` | `Core/nixos/secrets.yaml` |
|
||||
| **Scope** | Personal operator tokens (Cloudflare, Hostinger, GitHub) | Service runtime credentials (Traefik, DBs, Docker daemons) |
|
||||
| **Tenancy** | Multi-project across account domains | Scoped strictly to homelab infrastructure workloads |
|
||||
| **Decryption Model** | In-memory on-demand via `sops -d --extract` in shell wrappers | Automated boot-time ramfs mount via `sops-nix` (`/run/secrets/`) |
|
||||
| **Key Identity** | Personal age identity (`~/.config/sops/age/keys.txt`) | Server host SSH key (`/etc/ssh/ssh_host_ed25519_key`) |
|
||||
| **Daemon Overhead** | **Zero** (`sops-nix` module intentionally omitted) | Managed via root systemd units |
|
||||
|
||||
---
|
||||
|
||||
## 2. Workstation Operator Secrets (`Config/secrets.yaml`)
|
||||
|
||||
Operator CLI tools (such as `flarectl` and `hostinger`) manage cloud infrastructure across multiple projects. To maintain least-privilege for the server, these credentials are kept on the workstation:
|
||||
|
||||
```yaml
|
||||
# Config/secrets.yaml (encrypted with operator age key)
|
||||
cloudflare:
|
||||
api_token: "..."
|
||||
account_id: "..."
|
||||
|
||||
hostinger:
|
||||
api_token: "..."
|
||||
```
|
||||
|
||||
### Process-Scoped In-Memory Decryption
|
||||
Rather than exporting tokens into global interactive shells or writing plaintext config files to disk, shell wrappers in `home/shell/secrets.sh` extract credentials into the child process environment on demand:
|
||||
|
||||
```bash
|
||||
# Example: flarectl wrapper in home/shell/secrets.sh
|
||||
flarectl() {
|
||||
local secrets_file="$HOME/Config/secrets.yaml"
|
||||
if [[ -f "$secrets_file" ]] && command -v sops >/dev/null 2>&1; then
|
||||
CF_API_TOKEN=$(sops -d --extract '["cloudflare"]["api_token"]' "$secrets_file" 2>/dev/null) \
|
||||
CF_ACCOUNT_ID=$(sops -d --extract '["cloudflare"]["account_id"]' "$secrets_file" 2>/dev/null) \
|
||||
command flarectl "$@"
|
||||
else
|
||||
command flarectl "$@"
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
* **Security**: Decryption occurs strictly in RAM (~17ms overhead).
|
||||
* **Isolation**: The environment variables exist only for the life of `flarectl "$@"` and do not persist in the parent interactive shell.
|
||||
|
||||
### Autonomous Agent Secrets (`Config/anne-secrets.yaml`)
|
||||
To prevent autonomous agents from having access to personal operator tokens (Cloudflare, Hostinger, personal GitHub), agent credentials live in dedicated, firewalled secret files:
|
||||
|
||||
```yaml
|
||||
# Config/anne-secrets.yaml (encrypted for both *laptop and *anne)
|
||||
gitea:
|
||||
token: "..."
|
||||
github:
|
||||
token: "..."
|
||||
```
|
||||
|
||||
* **Multi-Recipient Encryption**: Encrypted for both `*laptop` (`keys.txt`) and `*anne` (`anne_keys.txt`).
|
||||
* **Operator Convenience**: The workstation operator can view and edit `anne-secrets.yaml` seamlessly using `sops anne-secrets.yaml` without switching keys.
|
||||
* **Cryptographic Firewall**: When running in an isolated container or subagent environment with only `anne_keys.txt`, the agent physically cannot decrypt `Config/secrets.yaml`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Homelab Server Runtime Secrets (`Core/nixos/secrets.yaml`)
|
||||
|
||||
To rotate or add a secret for homelab services:
|
||||
|
||||
### Step 1: Open Ciphertext Locally on Workstation
|
||||
```bash
|
||||
cd ~/Projects/active/homelab/Core/nixos
|
||||
sops secrets.yaml
|
||||
```
|
||||
|
||||
SOPS detects your personal identity in `~/.config/sops/age/keys.txt`, decrypts the file in memory, and opens your default editor (`$EDITOR` / Neovim).
|
||||
|
||||
### Step 2: Make Changes and Save
|
||||
Edit values as necessary. Upon exiting the editor, SOPS encrypts new values using the public keys defined in `Core/.sops.yaml`.
|
||||
|
||||
### Step 3: Commit and Push
|
||||
```bash
|
||||
git add secrets.yaml
|
||||
git commit -m "sec(core): rotate service credentials"
|
||||
git push origin main
|
||||
```
|
||||
|
||||
### Step 4: Rebuild Server
|
||||
```bash
|
||||
ssh server-remote "cd ~/Core && git pull && sudo nixos-rebuild switch --flake .#server"
|
||||
```
|
||||
The server evaluates the new ciphertext, decrypts it into `/run/secrets/`, and restarts affected systemd and Docker containers.
|
||||
|
||||
---
|
||||
|
||||
## 4. Backing Up & Restoring the Operator Age Key
|
||||
|
||||
The operator key is your cryptographic identity for managing homelab infrastructure:
|
||||
|
||||
```bash
|
||||
# Location:
|
||||
~/.config/sops/age/keys.txt
|
||||
|
||||
# File format:
|
||||
# public key: age1...
|
||||
AGE-SECRET-KEY-1...
|
||||
```
|
||||
|
||||
Store this key securely in a password manager (e.g. Bitwarden/Vaultwarden). If re-installing the workstation, restore this file with mode `0600` before editing `Core` secrets.
|
||||
@@ -0,0 +1,97 @@
|
||||
# 🔄 System Lifecycle: Rebuilding, Rollbacks & Maintenance
|
||||
|
||||
This document explains the technical lifecycle of the workstation—from Nix flake evaluation down to system activation—and provides operational procedures for rollbacks and disk maintenance.
|
||||
|
||||
---
|
||||
|
||||
## 1. What Happens During `nixos-rebuild switch`?
|
||||
|
||||
When you execute a system rebuild, NixOS and Home Manager execute a multi-stage pipeline:
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
FLAKE["flake.nix<br/><i>(Declarations & Pinned Inputs)</i>"] -->|Evaluate| DRV["Derivation Computation<br/><i>(/nix/store/*.drv)</i>"]
|
||||
DRV -->|Compile & Link| CLOSURE["System Closure<br/><i>(/nix/store/nixos-system-laptop-...)</i>"]
|
||||
|
||||
subgraph Activation Phase ["System Activation (Root / Switch)"]
|
||||
CLOSURE --> SYS_PROFILE["Update /nix/var/nix/profiles/system"]
|
||||
SYS_PROFILE --> BOOT_LINK["Install to /boot/EFI/systemd-boot"]
|
||||
SYS_PROFILE --> SYSD_UNITS["Restart & Reload Modified systemd Services"]
|
||||
SYS_PROFILE --> PAM_USERS["Sync Users, Groups, and PAM Policies"]
|
||||
end
|
||||
|
||||
subgraph Home Manager Phase ["User Session Activation"]
|
||||
CLOSURE --> HM_PROFILE["Update ~/.local/state/nix/profiles/home-manager"]
|
||||
HM_PROFILE --> SYMLINKS["Update ~/.config and ~/ Symlink Farm"]
|
||||
HM_PROFILE --> HM_UNITS["Restart systemd --user Units (e.g., dsearch, dms)"]
|
||||
end
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 2. The Command Matrix: Rebuild Actions
|
||||
|
||||
| Command | Rebuilds System? | Boots Next Time? | Affects Active Session? | Use Case |
|
||||
| :--- | :--- | :--- | :--- | :--- |
|
||||
| `nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link` | Yes (Dry) | No | No | Safe validation of compilation without system mutation. |
|
||||
| `sudo nixos-rebuild dry-build --flake .#laptop` | Yes (Dry) | No | No | Prints what would be built or downloaded. |
|
||||
| `sudo nixos-rebuild test --flake .#laptop` | Yes (Live) | No | **Yes** | Test services or configs immediately without polluting bootloader. |
|
||||
| `sudo nixos-rebuild switch --flake .#laptop` | Yes (Live) | **Yes** | **Yes** | Standard activation. Sets new default boot generation. |
|
||||
| `sudo nixos-rebuild boot --flake .#laptop` | Yes (Live) | **Yes** | No | Prepares next boot without altering currently running services. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Generations & Rollback Strategies
|
||||
|
||||
Every time `nixos-rebuild switch` runs, NixOS records a numbered generation.
|
||||
|
||||
### Strategy A: Bootloader Menu Rollback (Disaster Recovery)
|
||||
If a new generation prevents the display server or network from starting:
|
||||
1. Reboot the laptop.
|
||||
2. At the `systemd-boot` menu, press `Space` or arrow keys.
|
||||
3. Select an earlier generation from the list (e.g. `Generation 42`).
|
||||
4. Boot into the known working system.
|
||||
|
||||
### Strategy B: Command-Line Rollback (Active Session)
|
||||
If an update introduced a minor defect and you are logged in:
|
||||
```bash
|
||||
# Roll back system to the previous generation
|
||||
sudo nixos-rebuild --rollback switch
|
||||
|
||||
# Roll back only Home Manager (user session)
|
||||
home-manager generations
|
||||
# Select generation ID to activate
|
||||
```
|
||||
|
||||
### Strategy C: List Generations
|
||||
```bash
|
||||
# List system generations
|
||||
sudo nix-env -p /nix/var/nix/profiles/system --list-generations
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Workstation Maintenance Runbook
|
||||
|
||||
### Routine Disk Cleanup
|
||||
Over time, old generations accumulate in `/nix/store`:
|
||||
|
||||
```bash
|
||||
# 1. Delete system generations older than 14 days
|
||||
sudo nix-collect-garbage --delete-older-than 14d
|
||||
|
||||
# 2. Delete user-level generations older than 14 days
|
||||
nix-collect-garbage --delete-older-than 14d
|
||||
|
||||
# 3. Clean untracked bootloader entries
|
||||
sudo nixos-rebuild boot --flake .#laptop
|
||||
```
|
||||
|
||||
### Updating Flake Dependencies
|
||||
```bash
|
||||
# Update all inputs (including nixpkgs channel tarball)
|
||||
nix flake update
|
||||
|
||||
# Verify build before committing flake.lock
|
||||
nix build .#nixosConfigurations.laptop.config.system.build.toplevel --no-link
|
||||
```
|
||||
@@ -1,78 +0,0 @@
|
||||
# 🛠️ System Maintenance Guide
|
||||
|
||||
This document describes how to update the system safely, verify its health post-update, and clean up disk space by removing old configurations.
|
||||
|
||||
---
|
||||
|
||||
## 🔄 Performing Clean & Secure System Updates
|
||||
|
||||
NixOS systems managed with Flakes lock dependency versions inside `flake.lock`. To update the system securely, follow this workflow:
|
||||
|
||||
### Step 1: Update the Flake Inputs
|
||||
Fetch the latest revisions of your inputs (e.g., `nixpkgs`, `home-manager`, and other plugins):
|
||||
```bash
|
||||
nix flake update
|
||||
```
|
||||
|
||||
### Step 2: Validate the Build & Formatting
|
||||
Test-build the derivation without applying it to your bootloader. This prevents dirty installations or builder failures (such as Python PEP8 style errors) from affecting system configuration state:
|
||||
```bash
|
||||
nix build .#nixosConfigurations.desktop.config.system.build.toplevel --no-link
|
||||
```
|
||||
|
||||
### Step 3: Switch & Apply the Update
|
||||
Once the test build completes successfully, switch to the new generation:
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake .#desktop
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🏥 Post-Update Health Checklist
|
||||
|
||||
Verify system health immediately after a major system switch:
|
||||
|
||||
1. **Systemd Service Status:** Ensure all units are running and no critical services failed:
|
||||
```bash
|
||||
systemctl --failed
|
||||
systemctl --user --failed
|
||||
```
|
||||
2. **Display & Window Manager:** Verify that your graphics drivers, audio services (PipeWire/WirePlumber), and hotkeys are responsive.
|
||||
3. **Secrets Integrity:** Check that decrypted secrets are loaded correctly:
|
||||
```bash
|
||||
ls -la /run/secrets/
|
||||
```
|
||||
4. **Network Resolution:** Check DNS resolution and active IP rotation daemons:
|
||||
```bash
|
||||
systemctl status dynu-monitor.service
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🧹 Cleaning Up Old Generations
|
||||
|
||||
Nix keeps older versions (generations) of your system configuration so you can roll back instantly. However, this takes up storage space.
|
||||
|
||||
### Step 1: List System Generations
|
||||
To view all available system generations:
|
||||
```bash
|
||||
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
|
||||
```
|
||||
|
||||
### Step 2: Delete Old Generations
|
||||
* **Remove older than X days:**
|
||||
```bash
|
||||
sudo nix-env --delete-generations +5d --profile /nix/var/nix/profiles/system
|
||||
```
|
||||
* **Remove specific generations:**
|
||||
```bash
|
||||
sudo nix-env --delete-generations 42 43 --profile /nix/var/nix/profiles/system
|
||||
```
|
||||
|
||||
### Step 3: Collect Garbage (Reclaim Disk Space)
|
||||
Deleting generations only updates configuration links. To actually free up disk space and prune unused dependencies:
|
||||
```bash
|
||||
# Run garbage collection for system and user profiles
|
||||
sudo nix-collect-garbage -d
|
||||
nix-collect-garbage -d
|
||||
```
|
||||
@@ -1,72 +0,0 @@
|
||||
# 🎛️ Tmux Environment & Cheat Sheet
|
||||
|
||||
This repository configures **Tmux** declaratively via Home Manager in [terminal.nix](file:///home/kiskaadee/Config/modules/user/terminal.nix#L30). The configuration is optimized for speed, Vim keybindings, and seamless split-pane navigation.
|
||||
|
||||
---
|
||||
|
||||
## 🔑 Core Settings
|
||||
|
||||
* **Prefix Key**: Uses the default **`Ctrl+b`**.
|
||||
* **Status Bar**: Anchored to the **top** of the terminal window.
|
||||
* **Base Index**: Windows and panes start indexing at **`1`** (aligning with your physical keyboard numbers).
|
||||
* **Mouse Support**: Enabled. You can scroll, click to select panes, and drag splits to resize them.
|
||||
* **Zero Esc-Lag**: Keyboard escape latency is set to `0ms` (essential for vim editing response).
|
||||
|
||||
---
|
||||
|
||||
## 🧭 Seamless Neovim Navigation
|
||||
|
||||
The configuration loads the **`vim-tmux-navigator`** plugin. This allows you to navigate between Vim/Neovim split windows and Tmux splits using the same hotkeys **without pressing the prefix key**:
|
||||
|
||||
| Shortcut | Action |
|
||||
| :--- | :--- |
|
||||
| `Ctrl + h` | Focus pane/split to the **left** |
|
||||
| `Ctrl + j` | Focus pane/split **down** |
|
||||
| `Ctrl + k` | Focus pane/split **up** |
|
||||
| `Ctrl + l` | Focus pane/split to the **right** |
|
||||
|
||||
---
|
||||
|
||||
## 📋 Common Tmux Keybindings
|
||||
|
||||
For the following shortcuts, press your prefix key **`Ctrl+b`** first, release it, then press the shortcut key.
|
||||
|
||||
### Sessions & Windows
|
||||
| Key | Action |
|
||||
| :--- | :--- |
|
||||
| `d` | **Detach** from the current session (keeps it running in the background) |
|
||||
| `c` | Create a **new window** (tab) |
|
||||
| `,` | **Rename** the current window |
|
||||
| `&` | Kill the current window |
|
||||
| `1` - `9` | Switch to window by index number |
|
||||
|
||||
### Splits & Panes
|
||||
| Key | Action |
|
||||
| :--- | :--- |
|
||||
| `"` | Split pane **horizontally** (top/bottom) |
|
||||
| `%` | Split pane **vertically** (left/right) |
|
||||
| `x` | Close/kill the current pane |
|
||||
| `z` | **Zoom** the current pane to full screen (press again to restore) |
|
||||
| `h` / `j` / `k` / `l` | Vim-style switch focus left/down/up/right (alternative to Ctrl+direction) |
|
||||
|
||||
---
|
||||
|
||||
## 🖥️ Command Line Session Management
|
||||
|
||||
Manage your persistent background sessions directly from your shell:
|
||||
|
||||
```bash
|
||||
# Start a new named session
|
||||
tmux new -s my-session-name
|
||||
|
||||
# List all active background sessions
|
||||
tmux ls
|
||||
|
||||
# Attach to an existing session
|
||||
tmux a -t my-session-name
|
||||
# Or attach to the last active session:
|
||||
tmux a
|
||||
|
||||
# Kill a session
|
||||
tmux kill-session -t my-session-name
|
||||
```
|
||||
Generated
+137
-78
@@ -8,11 +8,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788592425,
|
||||
"narHash": "sha256-N6tHHlKKL0ErBZN0FRN47bFRGe7jzd5n/s0iv5codi8=",
|
||||
"lastModified": 1795331353,
|
||||
"narHash": "sha256-llMfFaxJxf7aMf0NRuKFtmBpDh14q5qnpwiGy/DJsJc=",
|
||||
"owner": "jacopone",
|
||||
"repo": "antigravity-nix",
|
||||
"rev": "6310713b4f3e0c1d6ac28b30c2fdd66bfcec9275",
|
||||
"rev": "c9f1bae6b80d90c92eed93694bdb5291242fe9a4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -24,16 +24,17 @@
|
||||
"dank-greeter": {
|
||||
"inputs": {
|
||||
"dank-qml-common": "dank-qml-common",
|
||||
"dux-qt-base": "dux-qt-base",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788455394,
|
||||
"narHash": "sha256-Qjpv8Oq255lsCsm/rCFFr73W2euvw2HTbNnZ2xnf2jk=",
|
||||
"lastModified": 1795022150,
|
||||
"narHash": "sha256-EINAcQZPXnTzHJNGqFxTMFSv7eT0wxymdg10Pud131E=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-greeter",
|
||||
"rev": "54e41b9d97938ca055bf090ab08e2684b5030989",
|
||||
"rev": "3e4affaf85f91fd98fdb83a27651d2597963e8ae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -45,64 +46,65 @@
|
||||
"dank-qml-common": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1788376015,
|
||||
"narHash": "sha256-/tT8rTznLADndTwLBzdgzzgfJH1ZhYQibYo5v/F8U+U=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"rev": "26396ce432d6c71c3f5367438f96f4a8d667e160",
|
||||
"lastModified": 1795021255,
|
||||
"narHash": "sha256-fDhHTvIkU+oDuIvdOhG5RyNZSYuxwM3xscLLdxmLVY4=",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qml-common",
|
||||
"rev": "e7c185915fe2555c6e6681711054e6b79f546806",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qml-common",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dank-qml-common_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1788219423,
|
||||
"narHash": "sha256-U4WBPh+pfM2IRF+IOWWHaw3cWaR1kYtl+Rdp7i9S2OQ=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"rev": "a9ae19facd460a4150da269dafcfb044b0dd9eea",
|
||||
"lastModified": 1795139913,
|
||||
"narHash": "sha256-RYLCGIA8CuAIsmWUA1y8Ml+5bs8yIFNDQqOjeOlBr6A=",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qml-common",
|
||||
"rev": "e268d71117173d0934dbe773d3e2ed6efe11afda",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qml-common",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dank-qml-common_3": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1788376015,
|
||||
"narHash": "sha256-/tT8rTznLADndTwLBzdgzzgfJH1ZhYQibYo5v/F8U+U=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"rev": "26396ce432d6c71c3f5367438f96f4a8d667e160",
|
||||
"lastModified": 1795211080,
|
||||
"narHash": "sha256-PV5cT7st/9ioV5aHeNP0go7wFfHlKfBYVVRCQ8JkHXg=",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qml-common",
|
||||
"rev": "12f5e4457e0ca14b6a5f9a283ab581ce28c92855",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qml-common",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dankcalendar": {
|
||||
"inputs": {
|
||||
"dank-qml-common": "dank-qml-common_2",
|
||||
"dux-qt-base": "dux-qt-base_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788455696,
|
||||
"narHash": "sha256-S/HmiY9hOmWQIYtatqrIwq0FLJFaGgg0xJw0BCXOMLQ=",
|
||||
"lastModified": 1795331423,
|
||||
"narHash": "sha256-kwm++EAyRfrgQAJVLR9LeSGiWbk7ehB64mJG17a4/hY=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dankcalendar",
|
||||
"rev": "4b1203670d03f66473603b12578b3f1ce6772252",
|
||||
"rev": "62ee9f656831be30dd3b58384758199a8e904637",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -118,11 +120,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788455393,
|
||||
"narHash": "sha256-C9mVxnPCaA6mtz8H5GwMfBjOdhLRmXrpzcDc7z99iOo=",
|
||||
"lastModified": 1794282582,
|
||||
"narHash": "sha256-gZENm8lqgHN4UIg7pceXZEvYRy4UkbnW5cdsz2l1f3E=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "danksearch",
|
||||
"rev": "984f86e644a93d2a366d960e3c56233260a501de",
|
||||
"rev": "a25a7be5626ef4776a1600b1013583cff5ed71f9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -138,11 +140,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788455392,
|
||||
"narHash": "sha256-5oGojLTg8DjsKn97EurssiZJlpdUD9AvhaM/jXjK3+o=",
|
||||
"lastModified": 1794282582,
|
||||
"narHash": "sha256-7bQCy4e5cgj7ToGZmXjI4ksbmjxzK/Vi/ZUUiSuRhT4=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dgop",
|
||||
"rev": "4a6ae842f6bdb77bd588eba14a8672fc5ec4f1d0",
|
||||
"rev": "d91b45a6e1ef52ab3e7791286615759306477647",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -154,17 +156,18 @@
|
||||
"dms": {
|
||||
"inputs": {
|
||||
"dank-qml-common": "dank-qml-common_3",
|
||||
"dux-qt-base": "dux-qt-base_3",
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788565319,
|
||||
"narHash": "sha256-bK2ikO7yYqgff8WU7JkB1clafCuS9pGcN22wm7Xwf+k=",
|
||||
"lastModified": 1795342511,
|
||||
"narHash": "sha256-9cQ6VogdRRaf40wMBUip/EoufpSLnjNmosrijaYZwus=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "DankMaterialShell",
|
||||
"rev": "e4793327b8b21d104d46bf53414b228d80986585",
|
||||
"rev": "a265f0a1af5dcc78ae691487d94710cca82da62d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -173,6 +176,69 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dux-qt-base": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"dank-greeter",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794899417,
|
||||
"narHash": "sha256-E5xQiepbIMlywIAFHGt3c4uBGUysNfdmL/mscCspXrs=",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qt-base",
|
||||
"rev": "8a8c69406e75a797cf400ce151cc735ea2a02af1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qt-base",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dux-qt-base_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"dankcalendar",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1795139910,
|
||||
"narHash": "sha256-JxBwcoR86CfjT92/xQSbbaHn1OxddwtH/iF+u4fUvRw=",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qt-base",
|
||||
"rev": "75d4524dc5e678ca4b64a1f862dd7509ca6852b1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qt-base",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dux-qt-base_3": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"dms",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1795337492,
|
||||
"narHash": "sha256-xGJDFNGgtXujSneISCrN2TxKx2IkTMeFBgTmJIISGfs=",
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qt-base",
|
||||
"rev": "0ea003e30fc92c51943ab7660b58d883708e25c2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "duxlabs-dev",
|
||||
"repo": "dux-qt-base",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@@ -214,11 +280,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788487777,
|
||||
"narHash": "sha256-Ro/e1N4ZR8/XaFF+sF9SgfPK79HM5YNEppzFj8p+0Ak=",
|
||||
"lastModified": 1795340038,
|
||||
"narHash": "sha256-RtgZbV+4BDtJqMImbiPJri3fmVDbCbrz/B0cuPQUJQY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "693e8ce0fb240a73c116a03cfd7b19269c87af88",
|
||||
"rev": "03885bcd0b477bdecebebc57b213b0f8f0826d51",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -235,11 +301,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788229478,
|
||||
"narHash": "sha256-G0F2rFORVcFkEvVdE/qWQTnYekIc77YP5/vRF9nZlxU=",
|
||||
"lastModified": 1794715309,
|
||||
"narHash": "sha256-awkBBs5ctFKgEYjpNGpi3t/VqF589n5EWfdinRb2gNI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "1dc2d1f720ab17fc7981e087346bf54b26d284b1",
|
||||
"rev": "a1293da7dd8e497e08d26173f97e2976b36a31ea",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -248,22 +314,35 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"new-repo": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1788531059,
|
||||
"narHash": "sha256-hLD4l3QOGBQhkVp3mQ2lJ/YbEi99qUgKapb40KovZ88=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "801bef6abd86b91e51083066b83fb354a11fc640",
|
||||
"lastModified": 1792722922,
|
||||
"narHash": "sha256-g+6cdwq2KpzFoKKSCA+rN+fczgHPCr+isuwrGRsR4F4=",
|
||||
"owner": "kiskaadee",
|
||||
"repo": "new-repo",
|
||||
"rev": "e72b46a42e11115d64fa32ac53ddef459cb33d05",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"owner": "kiskaadee",
|
||||
"repo": "new-repo",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1795234589,
|
||||
"narHash": "sha256-pAEASBc6wof0S58XcSEdZoQ2iFQDkCnZwH+wFLrkd1Q=",
|
||||
"rev": "2786a2a72088ecf32aea5b3ec52099e6a7cff78f",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1125864.2786a2a72088/nixexprs.tar.zst"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"antigravity": "antigravity",
|
||||
@@ -273,31 +352,11 @@
|
||||
"dgop": "dgop",
|
||||
"dms": "dms",
|
||||
"home-manager": "home-manager",
|
||||
"new-repo": "new-repo",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"sops-nix": "sops-nix",
|
||||
"zen-browser": "zen-browser"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788337237,
|
||||
"narHash": "sha256-gkSH8VUtCo6hnysNmb9DbTuDepH2t5pv+QWjP75xKAk=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "fbf759290e0cb0a98dfc813a4eb7d53ad1dacb57",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
@@ -321,11 +380,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788405419,
|
||||
"narHash": "sha256-wuGizAVEmY0u15MYrhgy7AoQdHg+4Y2QiC+v/mxA8dc=",
|
||||
"lastModified": 1795333741,
|
||||
"narHash": "sha256-xJaT+L8DeMR0TJjAOlrjGqaRG2AjZrjivQfCtiLRtlY=",
|
||||
"owner": "0xc000022070",
|
||||
"repo": "zen-browser-flake",
|
||||
"rev": "fdb83f8fce835213fab7eab52c375926fe1a32dc",
|
||||
"rev": "81376950ac382a96b965f9d6f8bf60354ad99c2f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
{
|
||||
description = "Kiskaadee's Modular NixOS Configuration";
|
||||
description = "Kiskaadee's Declarative NixOS Laptop Workstation";
|
||||
|
||||
# --- External Repositories & Flake Inputs ---
|
||||
# These inputs specify where Nix downloads package sets, tools, and configurations.
|
||||
inputs = {
|
||||
# NixOS Unstable channel - used for bleeding-edge package releases
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
# NixOS Unstable channel - official project-hosted zstd tarball
|
||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
||||
|
||||
# Home Manager - manages user-space configurations, dotfiles, and shell environments
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs"; # Forces home-manager to use the same nixpkgs channel
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# DankMaterialShell (DMS) - core custom desktop shell environment and panel
|
||||
@@ -49,97 +48,113 @@
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
## Cryptographic Secrets management
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Antigravity CLI - coding companion and local AI agent helper
|
||||
# Antigravity Suite (CLI, Desktop GUI, IDE) - community flake providing automated updates
|
||||
antigravity = {
|
||||
url = "github:jacopone/antigravity-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# new-repo - Automated repository provisioning CLI across Gitea and GitHub
|
||||
new-repo = {
|
||||
url = "github:kiskaadee/new-repo";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
# --- System Outputs (Configuration Definitions) ---
|
||||
# Maps host machines to target environments, architecture types, and user settings.
|
||||
outputs = { self, nixpkgs, home-manager, dms, dgop, dank-greeter, dankcalendar, danksearch, zen-browser, antigravity, ...}@inputs: {
|
||||
# --- System Outputs ---
|
||||
outputs = { self, nixpkgs, home-manager, dms, dgop, dank-greeter, dankcalendar, danksearch, zen-browser, antigravity, ... }@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
# --- Linting, Formatting & Static Analysis Checks ---
|
||||
# Executed via `nix flake check` or `nix build .#checks.<system>.<check>`
|
||||
checks.${system} = {
|
||||
# Shell script linting via ShellCheck
|
||||
shellcheck = pkgs.runCommand "check-shellcheck" {
|
||||
nativeBuildInputs = [ pkgs.shellcheck ];
|
||||
} ''
|
||||
echo "🐚 [ShellCheck] Checking shell scripts..."
|
||||
find ${self} -type f -name "*.sh" -exec shellcheck -s bash {} +
|
||||
echo "✅ [ShellCheck] All shell scripts passed!"
|
||||
touch $out
|
||||
'';
|
||||
|
||||
# Lua linting via luacheck
|
||||
luacheck = pkgs.runCommand "check-luacheck" {
|
||||
nativeBuildInputs = [ pkgs.luaPackages.luacheck ];
|
||||
} ''
|
||||
echo "🌙 [Lua] Checking Neovim Lua configuration..."
|
||||
luacheck ${self}/home/config/nvim --globals vim
|
||||
echo "✅ [Lua] All Lua files passed!"
|
||||
touch $out
|
||||
'';
|
||||
|
||||
# Python linting via ruff
|
||||
ruff-lint = pkgs.runCommand "check-ruff-lint" {
|
||||
nativeBuildInputs = [ pkgs.ruff ];
|
||||
} ''
|
||||
echo "🐍 [Ruff] Running Python linter (ruff check)..."
|
||||
ruff check --no-cache ${self}
|
||||
echo "✅ [Ruff] All Python files passed linting!"
|
||||
touch $out
|
||||
'';
|
||||
|
||||
# Python formatting check via ruff
|
||||
ruff-format = pkgs.runCommand "check-ruff-format" {
|
||||
nativeBuildInputs = [ pkgs.ruff ];
|
||||
} ''
|
||||
echo "🎨 [Ruff] Checking Python formatting (ruff format)..."
|
||||
ruff format --check ${self}
|
||||
echo "✅ [Ruff] All Python files properly formatted!"
|
||||
touch $out
|
||||
'';
|
||||
|
||||
# Python static type analysis via pyright
|
||||
pyright = pkgs.runCommand "check-pyright" {
|
||||
nativeBuildInputs = [ pkgs.pyright ];
|
||||
} ''
|
||||
echo "🔬 [Pyright] Running Python type analysis..."
|
||||
pyright ${self}
|
||||
echo "✅ [Pyright] All Python type checks passed!"
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
# Declarative dev shell for editing the configuration repository
|
||||
devShells.${system} = {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
shellcheck
|
||||
luaPackages.luacheck
|
||||
ruff
|
||||
pyright
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nixosConfigurations = {
|
||||
|
||||
# 🌐 SERVER HOST (Dedicated Headless Homelab Node)
|
||||
# Production server host running Docker, Traefik, SOPS secrets, and DDNS.
|
||||
server = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./hosts/server/hardware-configuration.nix
|
||||
./hosts/server/configuration.nix
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
|
||||
home-manager.nixosModules.home-manager {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupFileExtension = "backup";
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
home-manager.users.kiskaadee = {
|
||||
imports = [
|
||||
./home.nix
|
||||
./hosts/server/home.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# 🖥️ DESKTOP HOST (Legacy Dual-Mode Workstation)
|
||||
# Workstation running Hyprland with specialisation fallback.
|
||||
desktop = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; }; # Pass flake inputs into submodules (e.g. system/base.nix)
|
||||
modules = [
|
||||
./hosts/desktop/hardware-configuration.nix # Autogenerated hardware/disk/CPU module
|
||||
./hosts/desktop/configuration.nix # Desktop environment / system package settings
|
||||
inputs.sops-nix.nixosModules.sops # Import Sops module
|
||||
inputs.dank-greeter.nixosModules.default # Import Dank Greeter module
|
||||
inputs.dankcalendar.nixosModules.default # Import Dank Calendar module
|
||||
|
||||
home-manager.nixosModules.home-manager {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupFileExtension = "backup"; # Auto-back up conflicting files
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
home-manager.users.kiskaadee = {
|
||||
imports = [
|
||||
./home.nix
|
||||
./hosts/desktop/home.nix
|
||||
inputs.danksearch.homeModules.default
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# 💻 LAPTOP HOST (Mobile Workstation)
|
||||
# Target laptop workstation running Niri window manager.
|
||||
laptop = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./hosts/laptop/hardware-configuration.nix
|
||||
./hosts/laptop/configuration.nix
|
||||
./system
|
||||
inputs.dank-greeter.nixosModules.default
|
||||
inputs.dankcalendar.nixosModules.default
|
||||
|
||||
home-manager.nixosModules.home-manager {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupFileExtension = "backup"; # Auto-back up conflicting files
|
||||
home-manager.backupFileExtension = "backup";
|
||||
# ~/.ssh/config is kept as a user-owned regular file (see the
|
||||
# de-symlink workaround), so HM hits an occupied .backup path.
|
||||
home-manager.overwriteBackup = true;
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
home-manager.users.kiskaadee = {
|
||||
imports = [
|
||||
./home.nix
|
||||
./hosts/laptop/home.nix
|
||||
./home
|
||||
inputs.danksearch.homeModules.default
|
||||
];
|
||||
};
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
# 🏠 Home Manager Base Configuration Entrypoint
|
||||
# Shared user environment foundations (Git, Shell, Neovim, Terminal) across all systems.
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Import core user-specific modules
|
||||
imports = [
|
||||
./modules/user/base.nix # Core shell configurations, utilities, git aliases, SOPS & age
|
||||
./modules/user/neovim.nix # Neovim configuration, plugins, tree-sitter, LSP, DAP
|
||||
./modules/user/terminal.nix # Terminal emulators and multiplexers (Alacritty, Tmux, Starship)
|
||||
];
|
||||
|
||||
# Home directory settings
|
||||
home.username = "kiskaadee";
|
||||
home.homeDirectory = "/home/kiskaadee";
|
||||
|
||||
# Ensure cargo/bin (and other user binaries) are in the system PATH
|
||||
home.sessionPath = [
|
||||
"$HOME/.cargo/bin"
|
||||
"$HOME/.local/bin"
|
||||
"$HOME/Core/scripts"
|
||||
];
|
||||
|
||||
# The state version of Home Manager that this configuration is compatible with.
|
||||
home.stateVersion = "26.05";
|
||||
|
||||
# Enable Home Manager to manage itself
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"key": "ctrl+space e",
|
||||
"command": "workbench.action.focusActiveEditorGroup"
|
||||
},
|
||||
{
|
||||
"key": "ctrl+space t",
|
||||
"command": "workbench.action.terminal.focus"
|
||||
},
|
||||
{
|
||||
"key": "ctrl+space c",
|
||||
"command": "antigravity.toggleChatFocus"
|
||||
},
|
||||
{
|
||||
"key": "ctrl+space f",
|
||||
"command": "workbench.view.explorer"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"workbench.colorTheme": "GitHub Dark Colorblind (Beta)",
|
||||
"terminal.integrated.fontFamily": "'FiraCode Nerd Font Mono', 'FiraCode Nerd Font', monospace",
|
||||
"editor.fontFamily": "'FiraCode Nerd Font', monospace",
|
||||
"editor.fontLigatures": true,
|
||||
"vim.useSystemClipboard": true,
|
||||
"vim.hlsearch": true,
|
||||
"terminal.integrated.allowChords": true,
|
||||
"terminal.integrated.commandsToSkipShell": [
|
||||
"workbench.action.focusActiveEditorGroup",
|
||||
"workbench.action.terminal.focus",
|
||||
"antigravity.toggleChatFocus",
|
||||
"workbench.view.explorer"
|
||||
]
|
||||
}
|
||||
File renamed without changes.
@@ -231,6 +231,13 @@ animations {
|
||||
// Window rules let you adjust behavior for individual windows.
|
||||
// Find more information on the wiki:
|
||||
// https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules
|
||||
|
||||
// Dim unfocused windows slightly for depth and focus awareness
|
||||
window-rule {
|
||||
match is-focused=false
|
||||
opacity 0.95
|
||||
}
|
||||
|
||||
// Work around WezTerm's initial configure bug
|
||||
// by setting an empty default-column-width.
|
||||
window-rule {
|
||||
@@ -281,6 +288,7 @@ window-rule {
|
||||
match app-id=r#"chromium|google-chrome|brave-browser"# title="^Picture in picture$"
|
||||
open-floating true
|
||||
default-floating-position x=20 y=20 relative-to="bottom-right"
|
||||
opacity 1.0
|
||||
}
|
||||
window-rule {
|
||||
match app-id="zoom"
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
binds {
|
||||
// === Core Application Launchers ===
|
||||
Mod+Return hotkey-overlay-title="Alacritty Terminal" { spawn "alacritty"; }
|
||||
Mod+B hotkey-overlay-title="Firefox Browser" { spawn "firefox"; }
|
||||
Mod+O hotkey-overlay-title="Obsidian Notes" { spawn "flatpak" "run" "md.obsidian.Obsidian"; }
|
||||
Mod+Return hotkey-overlay-title="Alacritty Terminal (Shell)" { spawn "alacritty"; }
|
||||
Mod+T hotkey-overlay-title="Workspace Terminal (Sessionizer)" { spawn "alacritty" "-e" "tmux-sessionizer"; }
|
||||
Mod+B hotkey-overlay-title="Firefox Browser" { spawn "firefox"; }
|
||||
Mod+O hotkey-overlay-title="Obsidian Notes" { spawn "flatpak" "run" "md.obsidian.Obsidian"; }
|
||||
|
||||
// === Active Window Management ===
|
||||
// Force kill active window process via Niri IPC (JSON parsed)
|
||||
@@ -43,6 +44,16 @@ binds {
|
||||
Mod+Alt+M hotkey-overlay-title="Cast: Target Focused Monitor" { set-dynamic-cast-monitor; }
|
||||
Mod+Alt+C hotkey-overlay-title="Cast: Clear Target" { clear-dynamic-cast-target; }
|
||||
|
||||
// === Monitor Navigation (Orientation-Agnostic & Directional) ===
|
||||
Mod+grave hotkey-overlay-title="Focus Next Monitor" { focus-monitor-next; }
|
||||
Mod+Shift+grave hotkey-overlay-title="Move Column to Next Monitor" { move-column-to-monitor-next; }
|
||||
Mod+Ctrl+Down hotkey-overlay-title="Focus Monitor Down" { focus-monitor-down; }
|
||||
Mod+Ctrl+Up hotkey-overlay-title="Focus Monitor Up" { focus-monitor-up; }
|
||||
|
||||
// === Workspace Movement Relocation ===
|
||||
Mod+Ctrl+Page_Down hotkey-overlay-title="Move Column to Workspace Down" { move-column-to-workspace-down; }
|
||||
Mod+Ctrl+Page_Up hotkey-overlay-title="Move Column to Workspace Up" { move-column-to-workspace-up; }
|
||||
|
||||
// === Config Management ===
|
||||
Mod+Ctrl+Shift+R hotkey-overlay-title="Reload Niri Config" {
|
||||
spawn "bash" "-c" "niri msg action load-config-file && notify-send -a 'Niri' 'Configuration' 'Niri config reloaded successfully'";
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -44,6 +44,14 @@ if vim.lsp.config then
|
||||
root_markers = { '.git' },
|
||||
})
|
||||
vim.lsp.enable('kdl_lsp')
|
||||
|
||||
-- HTML LSP: vscode-html-language-server
|
||||
vim.lsp.config('html', {})
|
||||
vim.lsp.enable('html')
|
||||
|
||||
-- XML LSP: LemMinX
|
||||
vim.lsp.config('lemminx', {})
|
||||
vim.lsp.enable('lemminx')
|
||||
end
|
||||
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -111,6 +111,11 @@
|
||||
"binary": {
|
||||
"path_lookup": true
|
||||
}
|
||||
},
|
||||
"vscode-html-language-server": {
|
||||
"binary": {
|
||||
"path_lookup": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"languages": {
|
||||
File renamed without changes.
@@ -0,0 +1,28 @@
|
||||
# 🏠 Home Manager Workstation Profile Entrypoint
|
||||
# User-level environment for kiskaadee on the laptop workstation.
|
||||
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./desktop.nix
|
||||
./dev.nix
|
||||
./shell.nix
|
||||
];
|
||||
|
||||
# User identity & home path
|
||||
home.username = "kiskaadee";
|
||||
home.homeDirectory = "/home/kiskaadee";
|
||||
|
||||
# User binary search paths
|
||||
home.sessionPath = [
|
||||
"$HOME/.cargo/bin"
|
||||
"$HOME/.local/bin"
|
||||
];
|
||||
|
||||
# Compatibility state version
|
||||
home.stateVersion = "26.05";
|
||||
|
||||
# Enable Home Manager self-management
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
@@ -1,13 +1,42 @@
|
||||
# 🎨 User Graphical Module
|
||||
# Configures graphical workspace tools, GUI applications, and window manager session unit targets.
|
||||
# Only imported by desktop and laptop profiles.
|
||||
# 🎨 User Desktop & Graphical Applications
|
||||
# GUI applications, Wayland capture tools, Alacritty, Firefox, DankSearch, and Niri/Zed dotfiles.
|
||||
|
||||
{ inputs, pkgs, ... }:
|
||||
|
||||
let
|
||||
# Declaratively compile local scripts as user utility packages
|
||||
bundleProject = pkgs.writeScriptBin "bundle-project" (builtins.readFile ./scripts/bundle_project.py);
|
||||
recordScript = pkgs.writeScriptBin "record" (builtins.readFile ./scripts/record.sh);
|
||||
in
|
||||
{
|
||||
# Graphical packages managed via Home Manager
|
||||
home.packages = with pkgs; [
|
||||
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default # Modern browser build
|
||||
zed-editor # GPU-accelerated desktop text editor
|
||||
# Custom scripts
|
||||
bundleProject
|
||||
recordScript
|
||||
|
||||
# Modern Web Browser
|
||||
inputs.zen-browser.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||
|
||||
# AI Assistants & Desktop GUI
|
||||
inputs.antigravity.packages.${pkgs.stdenv.hostPlatform.system}.google-antigravity
|
||||
inputs.antigravity.packages.${pkgs.stdenv.hostPlatform.system}.google-antigravity-ide
|
||||
opencode-desktop
|
||||
|
||||
# Graphical Applications & Editors
|
||||
anydesk
|
||||
zed-editor
|
||||
obsidian
|
||||
kdePackages.okular
|
||||
inkscape
|
||||
libreoffice
|
||||
nautilus
|
||||
yazi
|
||||
mpv
|
||||
gimp
|
||||
imagemagick
|
||||
eyed3
|
||||
ffmpeg
|
||||
mkvtoolnix
|
||||
|
||||
# Wayland Clipboard, Screenshot & Screen Capture Utilities
|
||||
wl-clipboard
|
||||
@@ -17,19 +46,6 @@
|
||||
libnotify
|
||||
wf-recorder
|
||||
obs-studio
|
||||
|
||||
# Language Servers for Zed (and general dev use)
|
||||
rust-analyzer
|
||||
pyright
|
||||
ruff
|
||||
nil
|
||||
nixd
|
||||
jdt-language-server
|
||||
typescript-language-server
|
||||
lua-language-server
|
||||
taplo
|
||||
marksman
|
||||
prettier
|
||||
];
|
||||
|
||||
# GPU-Accelerated Terminal Emulator (Alacritty)
|
||||
@@ -38,22 +54,42 @@
|
||||
settings = builtins.fromTOML (builtins.readFile ./config/alacritty/alacritty.toml);
|
||||
};
|
||||
|
||||
# Firefox configuration
|
||||
# Firefox configuration with hardware acceleration
|
||||
programs.firefox = {
|
||||
enable = true;
|
||||
profiles.default = {
|
||||
settings = {
|
||||
# Force hardware acceleration
|
||||
"layers.acceleration.force-enabled" = true;
|
||||
"gfx.webrender.all" = true;
|
||||
|
||||
# Disable pocket-telemetry
|
||||
"extensions.pocket.enabled" = false;
|
||||
"datareporting.healthreport.uploadEnabled" = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Visual Studio Code declarative configuration
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
profiles.default = {
|
||||
extensions = with pkgs.vscode-extensions; [
|
||||
vscodevim.vim
|
||||
];
|
||||
};
|
||||
argvSettings = {
|
||||
"enable-crash-reporter" = true;
|
||||
"password-store" = "gnome-libsecret";
|
||||
};
|
||||
};
|
||||
|
||||
# GTK & Icon Theme Configuration
|
||||
gtk = {
|
||||
enable = true;
|
||||
iconTheme = {
|
||||
name = "Adwaita";
|
||||
package = pkgs.adwaita-icon-theme;
|
||||
};
|
||||
};
|
||||
|
||||
# Declarative configuration files for Zed editor
|
||||
home.file.".config/zed/settings.json".source = ./config/zed/settings.json;
|
||||
home.file.".config/zed/themes".source = ./config/zed/themes;
|
||||
@@ -62,16 +98,11 @@
|
||||
home.file.".config/niri/config.kdl".source = ./config/niri/config.kdl;
|
||||
home.file.".config/niri/custom.kdl".source = ./config/niri/custom.kdl;
|
||||
|
||||
# ⚙️ Systemd user session targets for window managers
|
||||
systemd.user.targets.hyprland-session = {
|
||||
Unit = {
|
||||
Description = "Hyprland graphical session";
|
||||
Documentation = [ "man:systemd.special(7)" ];
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
Wants = [ "graphical-session-pre.target" ];
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
};
|
||||
};
|
||||
# Declarative configuration files for Antigravity IDE
|
||||
home.file.".antigravity-ide/User/settings.json".source = ./config/antigravity-ide/settings.json;
|
||||
home.file.".antigravity-ide/User/keybindings.json".source = ./config/antigravity-ide/keybindings.json;
|
||||
|
||||
# Systemd user session target for Niri window manager
|
||||
|
||||
systemd.user.targets.niri-session = {
|
||||
Unit = {
|
||||
@@ -83,7 +114,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
# 🔍 DankSearch - Fast Indexed Filesystem Search Service
|
||||
# DankSearch - Fast Indexed Filesystem Search Service
|
||||
programs.dsearch = {
|
||||
enable = true;
|
||||
config = {
|
||||
+260
@@ -0,0 +1,260 @@
|
||||
# 🛠️ Developer Environment, Toolchains & Neovim
|
||||
# Compilers, SDKs, language servers, API testing tools, and modular Neovim configuration.
|
||||
|
||||
{ inputs, pkgs, ... }:
|
||||
|
||||
let
|
||||
symposium = pkgs.stdenv.mkDerivation rec {
|
||||
pname = "symposium";
|
||||
version = "0.5.1";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/symposium-dev/symposium/releases/download/symposium-v${version}/cargo-agents-x86_64-unknown-linux-musl.tar.gz";
|
||||
hash = "sha256-/YhTLS/Rmp4tx6xhL/awYDAiebH9+4dssfL0lRmtzHk=";
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
installPhase = ''
|
||||
install -Dm755 cargo-agents $out/bin/cargo-agents
|
||||
ln -s $out/bin/cargo-agents $out/bin/symposium
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "Collaborative AI toolset for Rust projects (cargo-agents)";
|
||||
homepage = "https://symposium.dev";
|
||||
license = with licenses; [ mit asl20 ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "cargo-agents";
|
||||
};
|
||||
};
|
||||
|
||||
hostinger-cli = pkgs.stdenv.mkDerivation rec {
|
||||
pname = "hostinger-cli";
|
||||
version = "4.1.4";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/hostinger/api-cli/releases/download/v${version}/hostinger-${version}-linux-amd64.tar.gz";
|
||||
hash = "sha256-DGliGk9wuSnf2HbCkQDcEbSv1TWmV9W4Jw7LWqCcj4E=";
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
installPhase = ''
|
||||
install -Dm755 hostinger $out/bin/hostinger
|
||||
install -Dm644 completions/hostinger.bash $out/share/bash-completion/completions/hostinger
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "Official Hostinger API Command Line Interface";
|
||||
homepage = "https://github.com/hostinger/api-cli";
|
||||
license = licenses.mit;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "hostinger";
|
||||
};
|
||||
};
|
||||
|
||||
gitea-cli = pkgs.stdenv.mkDerivation rec {
|
||||
pname = "gitea-cli";
|
||||
version = "1.0.0";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://gitea.com/gitea/cli/releases/download/v${version}/gitea-cli-${version}-linux-amd64";
|
||||
hash = "sha256-f/q+QV0F380YtJfVe0nIJHZLq5vvCUrPiQyWRZNsM8E=";
|
||||
};
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [ pkgs.installShellFiles ];
|
||||
|
||||
installPhase = ''
|
||||
install -Dm755 $src $out/bin/gt
|
||||
|
||||
# Generate and install shell completions
|
||||
installShellCompletion --cmd gt \
|
||||
--bash <($out/bin/gt completion bash) \
|
||||
--fish <($out/bin/gt completion fish) \
|
||||
--zsh <($out/bin/gt completion zsh)
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "Official command-line tool for Gitea (successor to tea)";
|
||||
homepage = "https://gitea.com/gitea/cli";
|
||||
license = licenses.mit;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "gt";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
# Neovim CLI & IDE Editor Configuration
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true; # Make neovim the default $EDITOR
|
||||
viAlias = true; # Symlink vi -> nvim
|
||||
vimAlias = true; # Symlink vim -> nvim
|
||||
|
||||
# Core Editor Settings (Lua-based)
|
||||
initLua = builtins.readFile ./config/nvim/init.lua;
|
||||
|
||||
# Declarative Plugin Management
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
{
|
||||
plugin = catppuccin-nvim;
|
||||
type = "lua";
|
||||
config = builtins.readFile ./config/nvim/catppuccin.lua;
|
||||
}
|
||||
(nvim-treesitter.withPlugins (p: with p; [
|
||||
python
|
||||
rust
|
||||
nix
|
||||
lua
|
||||
java
|
||||
javascript
|
||||
typescript
|
||||
markdown
|
||||
kdl
|
||||
toml
|
||||
bash
|
||||
]))
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
type = "lua";
|
||||
}
|
||||
{
|
||||
plugin = nvim-dap;
|
||||
}
|
||||
{
|
||||
plugin = nvim-dap-ui;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Declarative configuration files for Neovim (lsp.lua & dap.lua loaded dynamically via init.lua)
|
||||
home.file.".config/nvim/lsp.lua".source = ./config/nvim/lsp.lua;
|
||||
home.file.".config/nvim/dap.lua".source = ./config/nvim/dap.lua;
|
||||
|
||||
# Developer packages & Toolchains
|
||||
home.packages = with pkgs; [
|
||||
# AI Assistant Companion & Agent Orchestration
|
||||
inputs.antigravity.packages.${pkgs.stdenv.hostPlatform.system}.google-antigravity-cli
|
||||
herdr
|
||||
graphify
|
||||
codex
|
||||
opencode
|
||||
bubblewrap # Unprivileged sandboxing tool
|
||||
pi-coding-agent
|
||||
symposium
|
||||
|
||||
# Rust Toolchain & Language Server
|
||||
cargo
|
||||
rustc
|
||||
rustfmt
|
||||
clippy
|
||||
rust-analyzer
|
||||
gcc
|
||||
|
||||
# Python Package Runner & Toolchain (LSPs/linters managed per-project)
|
||||
(python3.withPackages (ps: [
|
||||
ps.pyyaml
|
||||
]))
|
||||
uv
|
||||
|
||||
# Node.js, Web & Formatter Tooling
|
||||
nodejs
|
||||
prettier
|
||||
|
||||
# Language Servers, Linters & Diagnostics (Zed, Neovim, General)
|
||||
nil
|
||||
nixd
|
||||
jdt-language-server
|
||||
typescript-language-server
|
||||
lua-language-server
|
||||
luaPackages.luacheck
|
||||
taplo
|
||||
marksman
|
||||
shellcheck
|
||||
vscode-langservers-extracted
|
||||
lemminx
|
||||
|
||||
# Cloud CLI, Git Forge & Database Management
|
||||
gitea-cli # Gitea official CLI client (gt, successor to tea)
|
||||
google-cloud-sdk # GCP administration utilities
|
||||
flarectl # Cloudflare official CLI client
|
||||
hostinger-cli # Hostinger official API CLI
|
||||
turso-cli # Turso libSQL management CLI
|
||||
postgresql # PostgreSQL client utilities (psql, pg_dump)
|
||||
pgcli # Postgres client with auto-completion
|
||||
|
||||
# API Testing & Networking
|
||||
httpie # User-friendly HTTP/REST client
|
||||
bruno # Fast, git-friendly GUI API client
|
||||
websocat # WebSocket client
|
||||
grpcurl # gRPC command-line tool
|
||||
bind.dnsutils # DNS lookup tools (dig, nslookup)
|
||||
doggo # Modern, human-friendly DNS client with DoH/DoT
|
||||
openssh # SSH client tools
|
||||
sshfs # FUSE-based SSH filesystem mount
|
||||
nmap # Network scanner
|
||||
arp-scan # ARP packet scanner
|
||||
|
||||
# File & Archive Utilities
|
||||
wget
|
||||
zip
|
||||
unzip
|
||||
unrar
|
||||
rsync
|
||||
aria2
|
||||
|
||||
# CLI Productivity & Text Processing
|
||||
ripgrep
|
||||
fd
|
||||
glow
|
||||
jq
|
||||
tree
|
||||
sqlite
|
||||
bc
|
||||
qpdf
|
||||
poppler-utils
|
||||
pandoc
|
||||
tty-clock
|
||||
curl
|
||||
parallel
|
||||
tuxedo
|
||||
|
||||
# Secrets Management
|
||||
rbw # Bitwarden CLI client
|
||||
sops # Mozilla SOPS CLI
|
||||
age # File encryption tool
|
||||
];
|
||||
|
||||
# Background two-way sync for corazoncp shared Google Drive repository
|
||||
systemd.user.services.corazoncp-drive-sync = {
|
||||
Unit = {
|
||||
Description = "Two-way sync between corazoncp/drive and Google Drive";
|
||||
After = [ "network-online.target" "graphical-session.target" ];
|
||||
Wants = [ "network-online.target" ];
|
||||
};
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.bash}/bin/bash /home/kiskaadee/Projects/active/corazoncp/drive/sync-drive.sh";
|
||||
Environment = [
|
||||
"PATH=${pkgs.lib.makeBinPath [ pkgs.rclone pkgs.git pkgs.openssh pkgs.libnotify pkgs.util-linux pkgs.findutils pkgs.coreutils ]}"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.timers.corazoncp-drive-sync = {
|
||||
Unit = {
|
||||
Description = "Poll corazoncp shared Google Drive every 15 minutes";
|
||||
};
|
||||
Timer = {
|
||||
OnBootSec = "2m";
|
||||
OnUnitActiveSec = "15m";
|
||||
Persistent = true;
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "timers.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Regular → Executable
+3
-4
@@ -99,11 +99,11 @@ def create_bundle(target_dir: Path, output_file: Path) -> None:
|
||||
out_f.write("\n")
|
||||
out_f.write("\n")
|
||||
|
||||
except Exception as e:
|
||||
except (OSError, UnicodeDecodeError) as e:
|
||||
out_f.write(f"[Error reading file: {e}]\n\n")
|
||||
|
||||
print("Done!")
|
||||
except Exception as e:
|
||||
except OSError as e:
|
||||
print(f"Error writing output file: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -114,8 +114,7 @@ def main() -> None:
|
||||
"""
|
||||
parser = argparse.ArgumentParser(
|
||||
description=(
|
||||
"Bundle a directory structure and its files into "
|
||||
"a single text document."
|
||||
"Bundle a directory structure and its files into a single text document."
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
# 🌐 Cloudflare DDNS Quick Updater for roadtotech.me
|
||||
|
||||
ZONE="roadtotech.me"
|
||||
TARGET_RECORDS=("roadtotech.me" "mail.roadtotech.me")
|
||||
|
||||
# 1. Load Cloudflare credentials via SOPS if not already present in environment
|
||||
if [[ -z "${CF_API_TOKEN:-}" ]]; then
|
||||
secrets_file="${HOME}/Config/secrets.yaml"
|
||||
if [[ -f "${secrets_file}" ]] && command -v sops >/dev/null 2>&1; then
|
||||
CF_API_TOKEN="$(sops -d --extract '["cloudflare"]["api_token"]' "${secrets_file}")"
|
||||
export CF_API_TOKEN
|
||||
CF_ACCOUNT_ID="$(sops -d --extract '["cloudflare"]["account_id"]' "${secrets_file}")"
|
||||
export CF_ACCOUNT_ID
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "${CF_API_TOKEN:-}" ]]; then
|
||||
echo "Error: CF_API_TOKEN is not set and could not be extracted from secrets.yaml." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2. Determine target public WAN IP
|
||||
if [[ -n "${1:-}" ]]; then
|
||||
NEW_IP="$1"
|
||||
echo "Using manually specified IP: ${NEW_IP}"
|
||||
else
|
||||
echo "Detecting current public WAN IP..."
|
||||
NEW_IP="$(curl -s --max-time 5 https://api.ipify.org || curl -s --max-time 5 https://icanhazip.com || true)"
|
||||
NEW_IP="$(echo "${NEW_IP}" | tr -d '[:space:]')"
|
||||
echo "Detected WAN IP: ${NEW_IP}"
|
||||
fi
|
||||
|
||||
# Validate IPv4 format
|
||||
if [[ ! "${NEW_IP}" =~ ^([0-9]{1,3}\.){3}[0-9]{1,3}$ ]]; then
|
||||
echo "Error: Invalid IPv4 address '${NEW_IP}'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 3. Query Cloudflare for existing records
|
||||
echo "Fetching active DNS records for ${ZONE}..."
|
||||
DNS_JSON="$(flarectl --json dns list --zone "${ZONE}")"
|
||||
|
||||
# 4. Iterate and update target A records
|
||||
UPDATED=0
|
||||
for RECORD_NAME in "${TARGET_RECORDS[@]}"; do
|
||||
RECORD_INFO="$(echo "${DNS_JSON}" | jq -r --arg name "${RECORD_NAME}" '.[] | select(.Name == $name and .Type == "A")')"
|
||||
|
||||
if [[ -z "${RECORD_INFO}" ]]; then
|
||||
echo "Warning: Record '${RECORD_NAME}' (Type A) not found in zone ${ZONE}." >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
RECORD_ID="$(echo "${RECORD_INFO}" | jq -r '.ID')"
|
||||
CURRENT_IP="$(echo "${RECORD_INFO}" | jq -r '.Content')"
|
||||
|
||||
if [[ "${CURRENT_IP}" == "${NEW_IP}" ]]; then
|
||||
echo "✓ ${RECORD_NAME} is already up to date (${CURRENT_IP})."
|
||||
else
|
||||
echo "Updating ${RECORD_NAME}: ${CURRENT_IP} -> ${NEW_IP}..."
|
||||
flarectl dns update --zone "${ZONE}" --id "${RECORD_ID}" --content "${NEW_IP}"
|
||||
echo "✓ ${RECORD_NAME} updated successfully."
|
||||
UPDATED=1
|
||||
fi
|
||||
done
|
||||
|
||||
# 5. Verification
|
||||
if [[ "${UPDATED}" -eq 1 ]]; then
|
||||
echo "Verifying resolution on Cloudflare nameservers..."
|
||||
sleep 2
|
||||
RESOLVED_IP="$(dig @pam.ns.cloudflare.com "${ZONE}" +short | tail -n1)"
|
||||
echo "Authoritative pam.ns.cloudflare.com resolves ${ZONE} -> ${RESOLVED_IP}"
|
||||
fi
|
||||
|
||||
echo "Done."
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 📹 Wayland Screen Recording Utility (Niri & Hyprland compatible)
|
||||
# Leverages 'wf-recorder' for GPU-accelerated video recording and pipewire audio routing.
|
||||
# 📹 Wayland Screen Recording Utility (Niri-native)
|
||||
# Leverages 'wf-recorder' for GPU-accelerated video recording and PipeWire audio routing.
|
||||
# Supports capturing specific regions, active windows, focused monitors, or full displays.
|
||||
#
|
||||
# Usage:
|
||||
@@ -69,14 +69,8 @@ case "$MODE" in
|
||||
TYPE_DESC="Area Recording"
|
||||
;;
|
||||
window)
|
||||
# Try querying Hyprland active window coordinates if on Hyprland
|
||||
if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ] && command -v hyprctl >/dev/null 2>&1; then
|
||||
GEOM=$(hyprctl activewindow -j 2>/dev/null | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')
|
||||
fi
|
||||
# Fallback to interactive window / region selection via slurp
|
||||
if [ -z "$GEOM" ] || [ "$GEOM" = "null,null nullxnull" ]; then
|
||||
GEOM=$(slurp)
|
||||
fi
|
||||
# Interactive window selection via slurp
|
||||
GEOM=$(slurp)
|
||||
if [ -z "$GEOM" ]; then
|
||||
notify-send -t 2000 "Screen Recorder" "Recording cancelled"
|
||||
exit 1
|
||||
@@ -84,13 +78,10 @@ case "$MODE" in
|
||||
TYPE_DESC="Window Recording"
|
||||
;;
|
||||
output)
|
||||
# Query focused monitor on Niri or Hyprland
|
||||
if [ "$XDG_CURRENT_DESKTOP" = "niri" ] || command -v niri >/dev/null 2>&1; then
|
||||
# Query focused monitor on Niri
|
||||
if command -v niri >/dev/null 2>&1; then
|
||||
OUTPUT_TARGET=$(niri msg -j focused-output 2>/dev/null | jq -r '.name // empty')
|
||||
fi
|
||||
if [ -z "$OUTPUT_TARGET" ] && command -v hyprctl >/dev/null 2>&1; then
|
||||
OUTPUT_TARGET=$(hyprctl monitors -j 2>/dev/null | jq -r '.[] | select(.focused == true) | .name // empty')
|
||||
fi
|
||||
TYPE_DESC="Monitor Recording"
|
||||
;;
|
||||
screen)
|
||||
@@ -0,0 +1,187 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Declarative workspace roots
|
||||
EXPLICIT_WORKSPACES=(
|
||||
"$HOME/Config"
|
||||
"$HOME/Brain"
|
||||
"$HOME/Homelab/Core"
|
||||
)
|
||||
|
||||
DISCOVERY_ROOTS=(
|
||||
"$HOME/Projects"
|
||||
"$HOME/Homelab"
|
||||
)
|
||||
|
||||
# Normalize folder basename to a valid, deterministic tmux session name
|
||||
normalize_name() {
|
||||
local raw="$1"
|
||||
local name
|
||||
name=$(basename "$raw" | tr '[:upper:]' '[:lower:]' | sed -E 's/[ .]+/-/g; s/[^a-z0-9_-]//g; s/[-_]+$//')
|
||||
if [[ -z "$name" ]]; then
|
||||
echo "ERROR: normalized session name for '$raw' is empty" >&2
|
||||
return 1
|
||||
fi
|
||||
echo "$name"
|
||||
}
|
||||
|
||||
# Discover all registered and git-backed workspaces
|
||||
# Outputs tab-separated: <session_name>\t<absolute_path>
|
||||
get_projects() {
|
||||
local -A seen_paths=()
|
||||
|
||||
# 1. Explicit workspaces
|
||||
for ws in "${EXPLICIT_WORKSPACES[@]}"; do
|
||||
if [[ -d "$ws" ]]; then
|
||||
seen_paths["$ws"]=1
|
||||
fi
|
||||
done
|
||||
|
||||
# 2. Discovered git repos under existing roots
|
||||
for root in "${DISCOVERY_ROOTS[@]}"; do
|
||||
[[ -d "$root" ]] || continue
|
||||
while IFS= read -r gitdir; do
|
||||
local pdir
|
||||
pdir=$(dirname "$gitdir")
|
||||
seen_paths["$pdir"]=1
|
||||
done < <(fd -H -d 4 -t d '^\.git$' "$root" 2>/dev/null)
|
||||
done
|
||||
|
||||
# 3. Format output
|
||||
for dir in "${!seen_paths[@]}"; do
|
||||
local sname
|
||||
if sname=$(normalize_name "$dir" 2>/dev/null); then
|
||||
printf "%s\t%s\n" "$sname" "$dir"
|
||||
fi
|
||||
done | sort -k1,1
|
||||
}
|
||||
|
||||
# Ensure the workspace registry has zero session-name collisions
|
||||
validate_registry() {
|
||||
local registry="$1"
|
||||
local collisions
|
||||
collisions=$(printf "%s\n" "$registry" | awk -F'\t' '
|
||||
{
|
||||
count[$1]++
|
||||
paths[$1] = paths[$1] "\n " $2
|
||||
}
|
||||
END {
|
||||
for (s in count) {
|
||||
if (count[s] > 1) {
|
||||
printf "ERROR: workspace name collision: '\''%s'\''%s\n\n", s, paths[s]
|
||||
}
|
||||
}
|
||||
}
|
||||
')
|
||||
|
||||
if [[ -n "$collisions" ]]; then
|
||||
printf "%s" "$collisions" >&2
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Resolve target directory and session name from arguments or interactive selection
|
||||
resolve_workspace() {
|
||||
local projects
|
||||
projects=$(get_projects)
|
||||
validate_registry "$projects" || exit 1
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
local selected
|
||||
selected=$(printf "%s\n" "$projects" | fzf \
|
||||
--delimiter=$'\t' \
|
||||
--with-nth=1,2 \
|
||||
--prompt="Workspace > " \
|
||||
--height=40% \
|
||||
--reverse || true)
|
||||
|
||||
if [[ -z "$selected" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "$selected"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local query="$1"
|
||||
|
||||
# 1. Existing directory path
|
||||
if [[ -d "$query" ]]; then
|
||||
local abs_path sname
|
||||
abs_path=$(realpath "$query")
|
||||
sname=$(normalize_name "$abs_path") || exit 1
|
||||
printf "%s\t%s\n" "$sname" "$abs_path"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# 2. Exact session name match
|
||||
local exact exact_cnt
|
||||
exact=$(printf "%s\n" "$projects" | awk -F'\t' -v q="$query" 'tolower($1) == tolower(q)')
|
||||
exact_cnt=$(printf "%s\n" "$exact" | grep -c -v "^$" || true)
|
||||
if [[ "$exact_cnt" -eq 1 ]]; then
|
||||
echo "$exact"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# 3. Exact basename match
|
||||
local base_matches base_cnt query_base
|
||||
query_base=$(basename "$query" | tr '[:upper:]' '[:lower:]')
|
||||
base_matches=$(printf "%s\n" "$projects" | awk -F'\t' -v q="$query_base" '
|
||||
{
|
||||
n = split($2, parts, "/")
|
||||
if (tolower(parts[n]) == q) print $0
|
||||
}
|
||||
')
|
||||
base_cnt=$(printf "%s\n" "$base_matches" | grep -c -v "^$" || true)
|
||||
if [[ "$base_cnt" -eq 1 ]]; then
|
||||
echo "$base_matches"
|
||||
return 0
|
||||
elif [[ "$base_cnt" -gt 1 ]]; then
|
||||
echo "ERROR: ambiguous project basename '$query':" >&2
|
||||
printf "%s\n" "$base_matches" | awk -F'\t' '{print " " $2}' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 4. Unique Substring Match
|
||||
local sub_matches sub_cnt query_lower
|
||||
query_lower=$(echo "$query" | tr '[:upper:]' '[:lower:]')
|
||||
sub_matches=$(printf "%s\n" "$projects" | awk -F'\t' -v q="$query_lower" '
|
||||
index(tolower($1), q) || index(tolower($2), q)
|
||||
')
|
||||
sub_cnt=$(printf "%s\n" "$sub_matches" | grep -c -v "^$" || true)
|
||||
if [[ "$sub_cnt" -eq 1 ]]; then
|
||||
echo "$sub_matches"
|
||||
return 0
|
||||
elif [[ "$sub_cnt" -gt 1 ]]; then
|
||||
echo "ERROR: ambiguous match for '$query' (multiple candidates found):" >&2
|
||||
printf "%s\n" "$sub_matches" | awk -F'\t' '{printf " %-20s %s\n", $1, $2}' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "ERROR: no workspace found matching '$query'" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
main() {
|
||||
local target
|
||||
target=$(resolve_workspace "$@")
|
||||
[[ -z "$target" ]] && exit 0
|
||||
|
||||
local session_name target_dir
|
||||
IFS=$'\t' read -r session_name target_dir <<< "$target"
|
||||
|
||||
# Ensure session exists (initialize cwd only on creation)
|
||||
if ! tmux has-session -t "$session_name" 2>/dev/null; then
|
||||
tmux new-session -ds "$session_name" -c "$target_dir"
|
||||
fi
|
||||
|
||||
# Attach or switch client based on current context
|
||||
if [[ -z "${TMUX:-}" ]]; then
|
||||
exec tmux attach-session -t "$session_name"
|
||||
else
|
||||
tmux switch-client -t "$session_name"
|
||||
fi
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Executable
+177
@@ -0,0 +1,177 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 🎙️ Whisper Audio Message Transcriber
|
||||
# Fast, local, offline audio transcription using whisper-cpp and ffmpeg.
|
||||
# Optimised for voice messages (.ogg, .opus, .m4a, .mp3, .wav).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
show_help() {
|
||||
cat << 'EOF'
|
||||
Usage: transcribe [OPTIONS] <audio-file> [audio-file2 ...]
|
||||
|
||||
Transcribes audio recordings into plain text using local whisper.cpp.
|
||||
|
||||
Options:
|
||||
-c, --clip, --clipboard Copy transcription result to Wayland clipboard (wl-copy)
|
||||
-s, --save Save transcript alongside audio file as <filename>.txt
|
||||
-m, --model <name> Whisper model size (default: small, ~488MB)
|
||||
Options: tiny, base, small, medium, large-v3-turbo
|
||||
-l, --lang <code|auto> Spoken language (e.g. en, es, auto; default: auto)
|
||||
-t, --threads <num> Computation threads (default: CPU core count)
|
||||
-q, --quiet Suppress informational messages to stderr
|
||||
-h, --help Show this help message and exit
|
||||
|
||||
Examples:
|
||||
transcribe voice_note.ogg
|
||||
transcribe -c memo.m4a
|
||||
transcribe -s -l es recording.opus
|
||||
EOF
|
||||
}
|
||||
|
||||
MODEL="${TRANSCRIBE_MODEL:-small}"
|
||||
LANG="${TRANSCRIBE_LANG:-auto}"
|
||||
CLIP=0
|
||||
SAVE=0
|
||||
QUIET=0
|
||||
THREADS="$(nproc 2>/dev/null || echo 4)"
|
||||
|
||||
# Parse CLI options
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-c|--clip|--clipboard)
|
||||
CLIP=1
|
||||
shift
|
||||
;;
|
||||
-s|--save)
|
||||
SAVE=1
|
||||
shift
|
||||
;;
|
||||
-m|--model)
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Error: --model requires an argument" >&2
|
||||
exit 1
|
||||
fi
|
||||
MODEL="$2"
|
||||
shift 2
|
||||
;;
|
||||
-l|--lang|--language)
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Error: --language requires an argument" >&2
|
||||
exit 1
|
||||
fi
|
||||
LANG="$2"
|
||||
shift 2
|
||||
;;
|
||||
-t|--threads)
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Error: --threads requires an argument" >&2
|
||||
exit 1
|
||||
fi
|
||||
THREADS="$2"
|
||||
shift 2
|
||||
;;
|
||||
-q|--quiet)
|
||||
QUIET=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
echo "Unknown option: $1" >&2
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Error: No audio files provided." >&2
|
||||
show_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MODEL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/whisper-cpp/models"
|
||||
MODEL_FILE="$MODEL_DIR/ggml-${MODEL}.bin"
|
||||
|
||||
# Auto-download model on first run if missing
|
||||
if [ ! -f "$MODEL_FILE" ]; then
|
||||
if [ "$QUIET" -eq 0 ]; then
|
||||
echo "Model 'ggml-${MODEL}.bin' not found in $MODEL_DIR." >&2
|
||||
echo "Downloading model '${MODEL}'..." >&2
|
||||
fi
|
||||
mkdir -p "$MODEL_DIR"
|
||||
whisper-cpp-download-ggml-model "$MODEL" "$MODEL_DIR"
|
||||
fi
|
||||
|
||||
# Set up temporary working directory for 16kHz audio normalization
|
||||
TEMP_DIR="$(mktemp -d -t transcribe-XXXXXX)"
|
||||
cleanup() {
|
||||
rm -rf "$TEMP_DIR"
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
ALL_OUTPUT=""
|
||||
|
||||
for input_file in "$@"; do
|
||||
if [ ! -f "$input_file" ]; then
|
||||
echo "Warning: File '$input_file' not found, skipping." >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
TEMP_WAV="$TEMP_DIR/converted_$(basename "$input_file").wav"
|
||||
|
||||
# Normalize audio to 16kHz mono 16-bit PCM WAV (Whisper specification)
|
||||
if ! ffmpeg -hide_banner -loglevel error -y -i "$input_file" -ar 16000 -ac 1 -c:a pcm_s16le "$TEMP_WAV"; then
|
||||
echo "Error: Failed to process audio file '$input_file' with ffmpeg." >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
# Run whisper-cli
|
||||
RAW_TRANSCRIPT="$(whisper-cli -m "$MODEL_FILE" -f "$TEMP_WAV" -l "$LANG" -t "$THREADS" -nt -np)"
|
||||
|
||||
# Clean transcript: strip leading whitespace from segments
|
||||
CLEAN_TRANSCRIPT="$(echo "$RAW_TRANSCRIPT" | sed -e 's/^[[:space:]]*//' | sed -e '/^[[:space:]]*$/d')"
|
||||
|
||||
# Print to stdout
|
||||
printf "%s\n" "$CLEAN_TRANSCRIPT"
|
||||
|
||||
# Optional: Save next to original audio file
|
||||
if [ "$SAVE" -eq 1 ]; then
|
||||
OUT_TXT="${input_file%.*}.txt"
|
||||
printf "%s\n" "$CLEAN_TRANSCRIPT" > "$OUT_TXT"
|
||||
if [ "$QUIET" -eq 0 ]; then
|
||||
echo "Saved transcript to: $OUT_TXT" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$ALL_OUTPUT" ]; then
|
||||
ALL_OUTPUT="${ALL_OUTPUT}
|
||||
${CLEAN_TRANSCRIPT}"
|
||||
else
|
||||
ALL_OUTPUT="$CLEAN_TRANSCRIPT"
|
||||
fi
|
||||
|
||||
rm -f "$TEMP_WAV"
|
||||
done
|
||||
|
||||
# Optional: Copy accumulated transcript to clipboard
|
||||
if [ "$CLIP" -eq 1 ] && [ -n "$ALL_OUTPUT" ]; then
|
||||
if command -v wl-copy >/dev/null 2>&1; then
|
||||
printf "%s\n" "$ALL_OUTPUT" | wl-copy
|
||||
if [ "$QUIET" -eq 0 ]; then
|
||||
echo "Copied transcript to clipboard." >&2
|
||||
fi
|
||||
else
|
||||
echo "Warning: wl-copy not found, skipping clipboard copy." >&2
|
||||
fi
|
||||
fi
|
||||
@@ -1,13 +1,76 @@
|
||||
# 🛠️ User Base Shell & Git Environment
|
||||
# This module defines the foundation of the interactive user shell, command line utilities,
|
||||
# custom shell scripts, aliases, and Git workflows.
|
||||
# 🐚 User Shell, Terminal Multiplexing & Git Environment
|
||||
# Bash aliases, modular shell scripts, Git, Delta, Gh, Direnv, SSH client, Tmux, Starship, and Fastfetch.
|
||||
|
||||
{ pkgs, ...}:
|
||||
{ inputs, pkgs, ... }:
|
||||
|
||||
let
|
||||
# Hermetic packaging for project-driven persistent terminal workspaces
|
||||
tmuxSessionizer = pkgs.writeShellApplication {
|
||||
name = "tmux-sessionizer";
|
||||
runtimeInputs = with pkgs; [
|
||||
bash
|
||||
coreutils
|
||||
gnused
|
||||
gawk
|
||||
gnugrep
|
||||
fd
|
||||
fzf
|
||||
tmux
|
||||
];
|
||||
text = builtins.readFile ./scripts/tmux-sessionizer.sh;
|
||||
};
|
||||
|
||||
# Declarative provisioning CLI packaged hermetically from remote flake input
|
||||
newRepo = pkgs.runCommand "new-repo" {
|
||||
nativeBuildInputs = [ pkgs.python3 ];
|
||||
} ''
|
||||
mkdir -p $out/bin
|
||||
cp ${inputs.new-repo}/new_repo.py $out/bin/new-repo
|
||||
chmod +x $out/bin/new-repo
|
||||
patchShebangs $out/bin/new-repo
|
||||
'';
|
||||
|
||||
# Hermetic packaging for local audio transcription via whisper-cpp
|
||||
transcribeCli = pkgs.writeShellApplication {
|
||||
name = "transcribe";
|
||||
runtimeInputs = with pkgs; [
|
||||
bash
|
||||
coreutils
|
||||
gnused
|
||||
gnugrep
|
||||
ffmpeg-headless
|
||||
whisper-cpp
|
||||
wl-clipboard
|
||||
curl
|
||||
];
|
||||
text = builtins.readFile ./scripts/transcribe.sh;
|
||||
};
|
||||
|
||||
# Quick manual/automation DDNS updater for Cloudflare homelab domain
|
||||
cfDdns = pkgs.writeShellApplication {
|
||||
name = "cf-ddns";
|
||||
runtimeInputs = with pkgs; [
|
||||
bash
|
||||
coreutils
|
||||
curl
|
||||
jq
|
||||
sops
|
||||
flarectl
|
||||
bind.dnsutils
|
||||
];
|
||||
text = builtins.readFile ./scripts/cf-ddns.sh;
|
||||
};
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
tmuxSessionizer
|
||||
newRepo
|
||||
transcribeCli
|
||||
cfDdns
|
||||
];
|
||||
|
||||
programs = {
|
||||
# 🌟 Git Version Control Configuration
|
||||
# Declares default user identity, global conflict styles, and highly optimized git aliases
|
||||
git = {
|
||||
enable = true;
|
||||
settings = {
|
||||
@@ -44,9 +107,17 @@
|
||||
init.defaultBranch = "main";
|
||||
merge.conflictstyle = "zdiff3";
|
||||
pull.rebase = true;
|
||||
|
||||
url."ssh://git@gitea.roadtotech.me:2223/" = {
|
||||
insteadOf = [
|
||||
"https://gitea.roadtotech.me/"
|
||||
"git@gitea.roadtotech.me:"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Syntax-highlighting pager for git
|
||||
delta = {
|
||||
enable = true;
|
||||
enableGitIntegration = true;
|
||||
@@ -58,14 +129,14 @@
|
||||
};
|
||||
};
|
||||
|
||||
# ⚡ Direnv - Automatic environment loading
|
||||
# Automatically activates nix development shells when entering project directories containing .envrc
|
||||
# ⚡ Direnv - Automatic environment loading for Nix dev shells
|
||||
direnv = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
# GitHub CLI
|
||||
gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
@@ -82,33 +153,60 @@
|
||||
};
|
||||
|
||||
# 🔑 SSH Client Configuration
|
||||
# Declaratively configures SSH client connections and host options
|
||||
ssh = {
|
||||
enable = true;
|
||||
enableDefaultConfig = false;
|
||||
settings = {
|
||||
"*" = {
|
||||
User = "kiskaadee";
|
||||
ServerAliveInterval = 15;
|
||||
ServerAliveCountMax = 3;
|
||||
};
|
||||
laptop = {
|
||||
HostName = "192.168.1.32";
|
||||
User = "kiskaadee";
|
||||
Port = 22;
|
||||
};
|
||||
server-local = {
|
||||
User = "operator";
|
||||
HostName = "192.168.1.36";
|
||||
Port = 22;
|
||||
};
|
||||
server-remote = {
|
||||
User = "operator";
|
||||
HostName = "roadtotech.me";
|
||||
Port = 2222;
|
||||
};
|
||||
"gitea.roadtotech.me" = {
|
||||
HostName = "gitea.roadtotech.me";
|
||||
Port = 2223;
|
||||
User = "git";
|
||||
};
|
||||
"webos-tv" = {
|
||||
HostName = "192.168.1.11";
|
||||
User = "prisoner";
|
||||
Port = 9922;
|
||||
IdentityFile = "~/.ssh/webos_rsa";
|
||||
HostKeyAlgorithms = "+ssh-rsa";
|
||||
PubkeyAcceptedAlgorithms = "+ssh-rsa";
|
||||
};
|
||||
phone = {
|
||||
HostName = "192.168.1.46";
|
||||
User = "u0_a56";
|
||||
Port = 8022;
|
||||
IdentityFile = "~/.ssh/id_ed25519";
|
||||
IdentitiesOnly = true;
|
||||
};
|
||||
tablet = {
|
||||
HostName = "192.168.1.5";
|
||||
User = "u0_a259";
|
||||
Port = 8022;
|
||||
IdentityFile = "~/.ssh/id_ed25519";
|
||||
IdentitiesOnly = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# 🗺️ Navigation & Directory Listing
|
||||
# Modern replacements for traditional cd, ls, and grep tools.
|
||||
zoxide = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
@@ -125,7 +223,7 @@
|
||||
eza = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
extraOptions = ["--group-directories-first" "--header" "--icons"];
|
||||
extraOptions = [ "--group-directories-first" "--header" "--icons" ];
|
||||
};
|
||||
|
||||
tealdeer = {
|
||||
@@ -138,17 +236,35 @@
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# 🖥️ Terminal Multiplexer (Tmux)
|
||||
tmux = {
|
||||
enable = true;
|
||||
extraConfig = builtins.readFile ./config/tmux.conf;
|
||||
};
|
||||
|
||||
# 🚀 Cross-Shell Prompt (Starship)
|
||||
starship = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
settings = builtins.fromTOML (builtins.readFile ./config/starship.toml);
|
||||
};
|
||||
|
||||
# 📊 System Information Dashboard (Fastfetch)
|
||||
fastfetch.enable = true;
|
||||
|
||||
# 🐚 Bash Shell Configuration
|
||||
# Bridges the Arch 'bash-custom' environment to NixOS, defining aliases and sourcing modular scripts.
|
||||
bash = {
|
||||
enable = true;
|
||||
enableCompletion = true; # Enable programmable auto-completion for system commands
|
||||
enableCompletion = true;
|
||||
|
||||
# Shell Aliases for speed, productivity, and command overrides
|
||||
shellAliases = {
|
||||
zed = "zeditor";
|
||||
reload = "exec bash";
|
||||
reload = "exec $SHELL";
|
||||
ts = "tmux-sessionizer";
|
||||
check = "~/Config/scripts/test";
|
||||
nfc = "nix flake check -L";
|
||||
ff = "fastfetch --logo none";
|
||||
p3 = "python3";
|
||||
|
||||
# System Navigation
|
||||
".." = "cd ..";
|
||||
@@ -158,8 +274,6 @@
|
||||
|
||||
# System Administration
|
||||
nix-switch = "sudo nixos-rebuild switch --flake ~/Config#$(hostname)";
|
||||
server-on = "sudo /run/current-system/specialisation/server/bin/switch-to-configuration switch";
|
||||
server-off = "sudo /run/current-system/bin/switch-to-configuration switch";
|
||||
sys = "dgop";
|
||||
wifi = "nmtui";
|
||||
lock = "hyprlock";
|
||||
@@ -176,14 +290,11 @@
|
||||
# Network Diagnostics
|
||||
pgoog = "ping google.com -c 3";
|
||||
|
||||
# Python / Py5
|
||||
p5 = "uv run py5-run-sketch";
|
||||
p5w = "uv run watchfiles \"py5-run-sketch main.py\"";
|
||||
|
||||
# Editor Shorthand
|
||||
v = "nvim";
|
||||
clock = "tty-clock";
|
||||
ql = "quicklinks";
|
||||
sql-highlight = "bat --language=sql --style=plain";
|
||||
|
||||
# Interactive Jump helper
|
||||
zi = "zoxide query -i --preview 'eza --tree --level 2 --color=always {}'";
|
||||
@@ -199,17 +310,20 @@
|
||||
gfo = "git fetch origin";
|
||||
gcheck = "git checkout";
|
||||
gadc = "git add -A && git diff --staged | wl-copy";
|
||||
ght = "gh-token";
|
||||
};
|
||||
|
||||
# Inject modular shell helper scripts directly into .bashrc.
|
||||
# This allows us to keep discrete logic files without cluttering home.nix or base.nix.
|
||||
# Inject modular shell helper scripts directly into .bashrc
|
||||
bashrcExtra = ''
|
||||
# Ensure Home Manager session variables and PATH are available in non-login / SSH shells
|
||||
[[ -f ~/.nix-profile/etc/profile.d/hm-session-vars.sh ]] && . ~/.nix-profile/etc/profile.d/hm-session-vars.sh
|
||||
# Ensure Home Manager session variables and user PATH are available in non-login / SSH shells
|
||||
[[ -f /etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh ]] && . /etc/profiles/per-user/$USER/etc/profile.d/hm-session-vars.sh
|
||||
[[ -f ~/.profile ]] && . ~/.profile
|
||||
export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"
|
||||
|
||||
${builtins.readFile ./shell/wayland.sh} # Wayland clipboard helper (wlc)
|
||||
${builtins.readFile ./shell/git.sh} # Git workflow automations (gacp, gitignore)
|
||||
${builtins.readFile ./shell/pdf.sh} # Command line PDF decryption helper
|
||||
${builtins.readFile ./shell/secrets.sh} # SOPS secret extraction helper (gh-token)
|
||||
${builtins.readFile ./shell/quicklinks.sh} # Interactive fzf web launcher
|
||||
${builtins.readFile ./shell/jump.sh} # Directory jumper & interactive fuzzy navigation
|
||||
${builtins.readFile ./shell/todo.sh} # Todo.txt & tuxedo shortcuts and syntax highlighter
|
||||
@@ -218,14 +332,7 @@
|
||||
};
|
||||
};
|
||||
|
||||
# 📊 Custom Catnap-style Fastfetch
|
||||
# A stylized, minimalist system information dashboard displayed on shell startup
|
||||
programs.fastfetch.enable = true;
|
||||
# Link fastfetch config
|
||||
home.file.".config/fastfetch/config.jsonc".source = ./config/fastfetch/config.jsonc;
|
||||
|
||||
# Standalone CLI utilities & system dependencies
|
||||
home.packages = with pkgs; [
|
||||
ripgrep fd glow jq tree sqlite python3 nodejs
|
||||
bc qpdf tty-clock uv curl parallel tuxedo sops age
|
||||
];
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
# shellcheck shell=bash
|
||||
# 🌟 Custom Git Automation & Helper Utilities
|
||||
# Sourced in .bashrc to streamline gitignore modifications, commit-push workflows, and new repo setups.
|
||||
|
||||
# 1. gitignore: Quickly appends patterns to the repository's root .gitignore file
|
||||
# then automatically commits and pushes the change.
|
||||
# 1. gitignore: Quickly appends patterns to the repository's root .gitignore file.
|
||||
gitignore() {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: gitignore <pattern> [pattern...]"
|
||||
@@ -10,7 +10,8 @@ gitignore() {
|
||||
fi
|
||||
|
||||
# Find the top-level repository directory path
|
||||
local GIT_ROOT=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
local GIT_ROOT
|
||||
GIT_ROOT=$(git rev-parse --show-toplevel 2> /dev/null)
|
||||
if [ -z "$GIT_ROOT" ]; then
|
||||
echo "Error: Not a Git repository."
|
||||
return 1
|
||||
@@ -28,7 +29,6 @@ gitignore() {
|
||||
fi
|
||||
|
||||
local added_count=0
|
||||
local commit_msg_list=""
|
||||
|
||||
for pattern in "$@"; do
|
||||
# Check if the pattern is already present in the .gitignore file
|
||||
@@ -38,18 +38,10 @@ gitignore() {
|
||||
echo "$pattern" >> "$GIT_IGNORE_FILE"
|
||||
echo "Added '$pattern'"
|
||||
((added_count++))
|
||||
commit_msg_list+="${pattern}, "
|
||||
fi
|
||||
done
|
||||
|
||||
# If any patterns were added, commit and push them automatically
|
||||
if [ $added_count -gt 0 ]; then
|
||||
commit_msg_list="${commit_msg_list%, }"
|
||||
echo "Committing and pushing changes..."
|
||||
git add "$GIT_IGNORE_FILE"
|
||||
git commit -m "Add to .gitignore: $commit_msg_list"
|
||||
git push
|
||||
else
|
||||
if [ "$added_count" -eq 0 ]; then
|
||||
echo "No new patterns were added."
|
||||
fi
|
||||
}
|
||||
@@ -63,24 +55,9 @@ gacp() {
|
||||
fi
|
||||
git add -A
|
||||
git commit -m "$1"
|
||||
local branch_name=$(git branch --show-current)
|
||||
local branch_name
|
||||
branch_name=$(git branch --show-current)
|
||||
git push origin "${branch_name}"
|
||||
echo "Pushed to origin/${branch_name}"
|
||||
}
|
||||
|
||||
# 3. new-repo: Initializes a new directory, git repository, and pushes it to GitHub via 'gh' CLI.
|
||||
new-repo() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: new-repo <repository-name>"
|
||||
return 1
|
||||
fi
|
||||
local repo_name="$1"
|
||||
mkdir -p "$repo_name"
|
||||
cd "$repo_name" || return 1
|
||||
git init -b main
|
||||
echo "# $repo_name" > README.md
|
||||
touch .gitignore LICENSE
|
||||
git add -A && git commit -m "Initial commit"
|
||||
# Call the GitHub CLI tool to create the repository on GitHub
|
||||
gh repo create "$repo_name" --public --source=. --remote=origin --push
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
# shellcheck shell=bash
|
||||
# --- Word Deletion & Readline Keybindings ---
|
||||
if [[ -n "$BASH_VERSION" ]] && [[ "$-" == *i* ]]; then
|
||||
# Ctrl+W: Delete entire word under cursor (backward-word + kill-word)
|
||||
bind '"\C-w": "\eb\ed"' 2>/dev/null
|
||||
|
||||
# Ctrl+Delete: Forward word delete (matches Alacritty \e[3;5~)
|
||||
bind '"\e[3;5~": kill-word' 2>/dev/null
|
||||
|
||||
# Ctrl+Backspace / Alt+Backspace: Backward word delete (start to cursor)
|
||||
bind '"\e\x7f": backward-kill-word' 2>/dev/null
|
||||
bind '"\e\b": backward-kill-word' 2>/dev/null
|
||||
fi
|
||||
|
||||
# --- Visual Entry ---
|
||||
# Display system information dashboard upon opening interactive shells
|
||||
if [[ $- == *i* ]]; then
|
||||
fastfetch --logo none
|
||||
fi
|
||||
|
||||
# --- Nix Command Ergonomics ---
|
||||
# Ensure `nix flake check` always prints build and verification logs (-L),
|
||||
# and inject GitHub personal access token via NIX_CONFIG on-demand to prevent API rate limiting.
|
||||
nix() {
|
||||
local token=""
|
||||
if declare -F _get_nix_gh_token >/dev/null 2>&1; then
|
||||
token=$(_get_nix_gh_token)
|
||||
fi
|
||||
|
||||
if [[ -n "$token" ]]; then
|
||||
if [[ "${1:-}" == "flake" && "${2:-}" == "check" && "$*" != *"--log-format"* && "$*" != *"-L"* ]]; then
|
||||
NIX_CONFIG="access-tokens = github.com=${token}${NIX_CONFIG:+ $NIX_CONFIG}" command nix flake check -L "${@:3}"
|
||||
else
|
||||
NIX_CONFIG="access-tokens = github.com=${token}${NIX_CONFIG:+ $NIX_CONFIG}" command nix "$@"
|
||||
fi
|
||||
else
|
||||
if [[ "${1:-}" == "flake" && "${2:-}" == "check" && "$*" != *"--log-format"* && "$*" != *"-L"* ]]; then
|
||||
command nix flake check -L "${@:3}"
|
||||
else
|
||||
command nix "$@"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
# shellcheck shell=bash
|
||||
# 🗺️ Fuzzy Navigation & Directory Jump Helpers
|
||||
# Sourced in .bashrc to provide quick, interactive folder traversal using Yazi and fzf.
|
||||
|
||||
# 1. fm: Interactive file manager wrapper using Yazi.
|
||||
# Synchronizes the active terminal shell working directory to Yazi's exit folder (sticky directory).
|
||||
fm() {
|
||||
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
|
||||
local tmp
|
||||
tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
|
||||
yazi "$@" --cwd-file="$tmp"
|
||||
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
|
||||
cd -- "$cwd"
|
||||
cd -- "$cwd" || return
|
||||
fi
|
||||
rm -f -- "$tmp"
|
||||
}
|
||||
@@ -85,10 +87,24 @@ copy_dir() {
|
||||
printf "%s" "$dir" | wl-copy
|
||||
}
|
||||
|
||||
# 10. Shorthand Navigation Aliases
|
||||
cfg() { jump "$HOME/Config" "$1" 2; } # Quickly jump inside ~/Config modules
|
||||
prj() { jump "$HOME/Projects" "$1"; } # Jump into local workspace projects
|
||||
lrn() { jump "/$HOME/Learn" "$1"; } # Jump to ~/Learn
|
||||
dep() { jump "$HOME/Deployments" "$1"; } # Jump to Deployments folder
|
||||
dl() { jump "$HOME/Downloads" "$1"; } # Jump to Downloads
|
||||
med() { jump "/media" "$1"; } # Jump to /media mounted storage
|
||||
# 10. Shorthand Navigation Aliases (Dual 2-letter and mnemonic mapping)
|
||||
brain() { jump "$HOME/Brain" "$1" 2; } # Jump into ~/Brain
|
||||
homelab() { jump "$HOME/Homelab" "$1" 2; } # Jump into ~/Homelab
|
||||
conf() { jump "$HOME/Config" "$1" 2; } # Jump into ~/Config
|
||||
doc() { jump "$HOME/Documents" "$1" 2; } # Jump into ~/Documents
|
||||
dl() { jump "$HOME/Downloads" "$1" 2; } # Jump into ~/Downloads
|
||||
pic() { jump "$HOME/Pictures" "$1" 2; } # Jump into ~/Pictures
|
||||
pj() { jump "$HOME/Projects" "$1" 3; } # Jump into ~/Projects (depth 3)
|
||||
|
||||
# 2-Letter Fast Aliases
|
||||
br() { brain "$@"; }
|
||||
cf() { conf "$@"; }
|
||||
dc() { doc "$@"; }
|
||||
pc() { pic "$@"; }
|
||||
hl() { homelab "$@"; }
|
||||
|
||||
# Convenience & Backward-Compatibility Aliases
|
||||
docs() { doc "$@"; }
|
||||
pict() { pic "$@"; }
|
||||
cfg() { conf "$@"; }
|
||||
prj() { pj "$@"; }
|
||||
@@ -1,20 +1,19 @@
|
||||
# shellcheck shell=bash
|
||||
# 📄 Command Line PDF Utilities
|
||||
# Sourced in .bashrc to provide quick file operations on PDF documents.
|
||||
|
||||
# 1. pdf_dc: Decrypts a password-protected PDF document.
|
||||
# Uses 'qpdf' under the hood. Automatically searches for a default password
|
||||
# decrypted securely by sops-nix in `/run/secrets/pdf_decrypt_password`
|
||||
# in `$HOME/.config/pdf_decrypt_password` (or via $PDF_PASSWORD_FILE)
|
||||
# if no password argument is supplied.
|
||||
pdf_dc() {
|
||||
local secret_file="/run/secrets/pdf_decrypt_password"
|
||||
local secret_file="${PDF_PASSWORD_FILE:-$HOME/.config/pdf_decrypt_password}"
|
||||
local input_file="$1"
|
||||
local password="$2"
|
||||
|
||||
# Attempt to auto-load password from sops secret if none was provided on the CLI
|
||||
if [[ -z "$password" ]]; then
|
||||
if [[ -f "$secret_file" ]]; then
|
||||
password=$(cat "$secret_file")
|
||||
fi
|
||||
# Attempt to auto-load password from local config file if none was provided on the CLI
|
||||
if [[ -z "$password" && -f "$secret_file" ]]; then
|
||||
password=$(cat "$secret_file")
|
||||
fi
|
||||
|
||||
if [[ -z "$password" ]]; then
|
||||
@@ -32,7 +31,7 @@ pdf_dc() {
|
||||
# Handle file overwrite prompts
|
||||
if [[ -f "$output_file" ]]; then
|
||||
echo "Error: Output file '$output_file' already exists."
|
||||
read -p "Do you want to overwrite it? (y/n): " overwrite
|
||||
read -r -p "Do you want to overwrite it? (y/n): " overwrite
|
||||
if [[ "$overwrite" != "y" ]]; then
|
||||
echo "Operation cancelled."
|
||||
return 1
|
||||
@@ -1,3 +1,4 @@
|
||||
# shellcheck shell=bash
|
||||
# 🚀 Quicklinks Launcher Utility
|
||||
# Sourced in .bashrc to provide an interactive bookmarks and command-launcher interface.
|
||||
# Parses a pipe-separated config file (`~/.quicklinks`) containing custom CLI commands or URLs.
|
||||
@@ -0,0 +1,71 @@
|
||||
# shellcheck shell=bash
|
||||
# 🔐 Secret Extraction & Clipboard Utilities
|
||||
# Sourced in .bashrc to provide quick, safe extraction of SOPS-managed secrets into the Wayland clipboard.
|
||||
|
||||
# 1. gh-token: Extracts the GitHub repository token from Homelab secrets directly into the Wayland clipboard.
|
||||
# Uses 'sops -d --extract' to decrypt only the required key in memory without persisting plaintext to disk.
|
||||
# Uses 'wl-copy -n --sensitive' to strip trailing newlines and flag the content as sensitive for clipboard managers.
|
||||
gh-token() {
|
||||
local secrets_file="${HOMELAB_SECRETS_FILE:-$HOME/Homelab/Core/nixos/secrets.yaml}"
|
||||
|
||||
if ! command -v sops >/dev/null 2>&1; then
|
||||
echo "Error: 'sops' is not installed or not in PATH." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! command -v wl-copy >/dev/null 2>&1; then
|
||||
echo "Error: 'wl-copy' is not installed or not in PATH." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "$secrets_file" ]]; then
|
||||
echo "Error: Secrets file not found at '$secrets_file'." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local token
|
||||
token=$(sops -d --extract '["system"]["gh_repo_token"]' "$secrets_file" 2>/dev/null)
|
||||
local status=$?
|
||||
|
||||
if [[ $status -ne 0 || -z "$token" ]]; then
|
||||
echo "Error: Failed to extract 'system.gh_repo_token' from sops." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf "%s" "$token" | wl-copy -n --sensitive
|
||||
unset token
|
||||
|
||||
echo "GitHub repo token copied to clipboard (marked sensitive)."
|
||||
}
|
||||
|
||||
|
||||
flarectl() {
|
||||
local secrets_file="$HOME/Config/secrets.yaml"
|
||||
if [[ -f "$secrets_file" ]] && command -v sops >/dev/null 2>&1; then
|
||||
CF_API_TOKEN=$(sops -d --extract '["cloudflare"]["api_token"]' "$secrets_file" 2>/dev/null) \
|
||||
CF_ACCOUNT_ID=$(sops -d --extract '["cloudflare"]["account_id"]' "$secrets_file" 2>/dev/null) \
|
||||
command flarectl "$@"
|
||||
else
|
||||
command flarectl "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
hostinger() {
|
||||
local secrets_file="$HOME/Config/secrets.yaml"
|
||||
if [[ -f "$secrets_file" ]] && command -v sops >/dev/null 2>&1; then
|
||||
HOSTINGER_API_TOKEN=$(sops -d --extract '["hostinger"]["api_token"]' "$secrets_file" 2>/dev/null) \
|
||||
command hostinger "$@"
|
||||
else
|
||||
command hostinger "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# 4. _get_nix_gh_token: Extracts and caches the GitHub repo token in memory for Nix invocations.
|
||||
# Decrypts only on first use and caches in the shell session variable __NIX_GH_TOKEN to avoid repeated SOPS latency.
|
||||
_get_nix_gh_token() {
|
||||
local secrets_file="${CONFIG_SECRETS_FILE:-$HOME/Config/secrets.yaml}"
|
||||
if [[ -z "${__NIX_GH_TOKEN:-}" ]] && [[ -f "$secrets_file" ]] && command -v sops >/dev/null 2>&1; then
|
||||
__NIX_GH_TOKEN=$(sops -d --extract '["github"]["gh_repo_token"]' "$secrets_file" 2>/dev/null) || true
|
||||
fi
|
||||
printf "%s" "${__NIX_GH_TOKEN:-}"
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
# shellcheck shell=bash
|
||||
# 📝 Todo.txt & Tuxedo Productivity Helper and Syntax Highlighter
|
||||
# Sourced in .bashrc to provide colorized listings and quick task management shortcuts.
|
||||
|
||||
@@ -42,23 +43,32 @@ _todo_color() {
|
||||
}'
|
||||
}
|
||||
|
||||
_todo_active_tasks() {
|
||||
tuxedo --json ls 2>/dev/null | jq -r '
|
||||
map(select(.done | not))
|
||||
| sort_by([ (if .priority then 0 else 1 end), .priority, .n ])
|
||||
| .[]
|
||||
| "\(.n) \(.raw)"
|
||||
' 2>/dev/null
|
||||
}
|
||||
|
||||
todo() {
|
||||
case "$1" in
|
||||
# todo next [N] / todo n [N] -> show top N priority tasks (default: 1)
|
||||
next|n)
|
||||
shift
|
||||
local count="${1:-1}"
|
||||
tuxedo 2>/dev/null ls | head -n "$count" | _todo_color
|
||||
_todo_active_tasks | head -n "$count" | _todo_color
|
||||
;;
|
||||
# todo check-next / todo do-next / todo dn -> complete top priority task
|
||||
check-next|do-next|dn)
|
||||
local top_task
|
||||
top_task=$(tuxedo 2>/dev/null ls | head -n 1)
|
||||
top_task=$(_todo_active_tasks | head -n 1)
|
||||
if [[ -n "$top_task" ]]; then
|
||||
local task_id
|
||||
task_id=$(echo "$top_task" | awk '{print $1}')
|
||||
echo "Completing: $top_task"
|
||||
tuxedo do "$task_id"
|
||||
tuxedo "do" "$task_id"
|
||||
else
|
||||
echo "No tasks found in todo.txt"
|
||||
fi
|
||||
@@ -1,3 +1,4 @@
|
||||
# shellcheck shell=bash
|
||||
# 📋 Custom Wayland Desktop Utilities
|
||||
# Sourced in .bashrc to provide command-line utilities optimized for Wayland compositor environments.
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
-- Optional per-user keybind overrides (managed by DMS). Loaded after default binds.
|
||||
|
||||
-- Screen screenshots (Copy to clipboard only, preventing saving files to directory)
|
||||
hl.bind("SUPER + S", hl.dsp.exec_cmd("grimblast --notify copy area"))
|
||||
hl.bind("SUPER + SHIFT + S", hl.dsp.exec_cmd("grimblast --notify copy active"))
|
||||
hl.bind("SUPER + CTRL + S", hl.dsp.exec_cmd("grimblast --notify copy output"))
|
||||
hl.bind("SUPER + SHIFT + CTRL + S", hl.dsp.exec_cmd("grimblast --notify copy screen"))
|
||||
|
||||
-- Screen video recordings (SUPER + W series)
|
||||
hl.bind("SUPER + W", hl.dsp.exec_cmd("~/.config/hypr/scripts/record.sh area"))
|
||||
hl.bind("SUPER + SHIFT + W", hl.dsp.exec_cmd("~/.config/hypr/scripts/record.sh output"))
|
||||
hl.bind("SUPER + CTRL + W", hl.dsp.exec_cmd("~/.config/hypr/scripts/record.sh area audio"))
|
||||
hl.bind("SUPER + SHIFT + CTRL + W", hl.dsp.exec_cmd("~/.config/hypr/scripts/record.sh output audio"))
|
||||
|
||||
@@ -1,172 +0,0 @@
|
||||
-- DMS default keybinds (Hyprland 0.55+ Lua)
|
||||
|
||||
-- === Application Launchers ===
|
||||
hl.bind("SUPER + Return", hl.dsp.exec_cmd("alacritty"))
|
||||
hl.bind("SUPER + B", hl.dsp.exec_cmd("firefox"))
|
||||
hl.bind("SUPER + space", hl.dsp.exec_cmd("dms ipc call spotlight toggle"))
|
||||
hl.bind("ALT + space", hl.dsp.exec_cmd("dms ipc call spotlight-bar toggle"))
|
||||
hl.bind("SUPER + V", hl.dsp.exec_cmd("dms ipc call clipboard toggle"))
|
||||
hl.bind("SUPER + M", hl.dsp.exec_cmd("dms ipc call processlist focusOrToggle"))
|
||||
hl.bind("SUPER + comma", hl.dsp.exec_cmd("dms ipc call settings focusOrToggle"))
|
||||
hl.bind("SUPER + N", hl.dsp.exec_cmd("dms ipc call notifications toggle"))
|
||||
hl.bind("SUPER + SHIFT + N", hl.dsp.exec_cmd("dms ipc call notepad toggle"))
|
||||
hl.bind("SUPER + Y", hl.dsp.exec_cmd("dms ipc call dankdash wallpaper"))
|
||||
hl.bind("SUPER + TAB", hl.dsp.exec_cmd("dms ipc call hypr toggleOverview"))
|
||||
hl.bind("SUPER + O", hl.dsp.exec_cmd("dms ipc call hypr toggleOverview"))
|
||||
hl.bind("SUPER + X", hl.dsp.exec_cmd("dms ipc call powermenu toggle"))
|
||||
|
||||
-- === Cheat sheet
|
||||
hl.bind("SUPER + SHIFT + Slash", hl.dsp.exec_cmd("dms ipc call keybinds toggle hyprland"))
|
||||
|
||||
-- === Security ===
|
||||
hl.bind("SUPER + ALT + L", hl.dsp.exec_cmd("dms ipc call lock lock"))
|
||||
hl.bind("SUPER + SHIFT + E", hl.dsp.exit())
|
||||
hl.bind("CTRL + ALT + Delete", hl.dsp.exec_cmd("dms ipc call processlist focusOrToggle"))
|
||||
|
||||
-- === Audio Controls ===
|
||||
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("dms ipc call audio increment 3"), { locked = true, repeating = true })
|
||||
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("dms ipc call audio decrement 3"), { locked = true, repeating = true })
|
||||
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("dms ipc call audio mute"), { locked = true })
|
||||
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("dms ipc call audio micmute"), { locked = true })
|
||||
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("dms ipc call mpris playPause"), { locked = true })
|
||||
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("dms ipc call mpris playPause"), { locked = true })
|
||||
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("dms ipc call mpris previous"), { locked = true })
|
||||
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("dms ipc call mpris next"), { locked = true })
|
||||
hl.bind("CTRL + XF86AudioRaiseVolume", hl.dsp.exec_cmd("dms ipc call mpris increment 3"), { locked = true, repeating = true })
|
||||
hl.bind("CTRL + XF86AudioLowerVolume", hl.dsp.exec_cmd("dms ipc call mpris decrement 3"), { locked = true, repeating = true })
|
||||
|
||||
-- === Brightness Controls ===
|
||||
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd([[dms ipc call brightness increment 5 ""]]), { locked = true, repeating = true })
|
||||
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd([[dms ipc call brightness decrement 5 ""]]), { locked = true, repeating = true })
|
||||
|
||||
-- === Window Management ===
|
||||
hl.bind("SUPER + Q", hl.dsp.window.close())
|
||||
hl.bind("SUPER + F", hl.dsp.window.fullscreen({ mode = "maximized", action = "toggle" }))
|
||||
hl.bind("SUPER + SHIFT + F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" }))
|
||||
hl.bind("SUPER + SHIFT + T", hl.dsp.window.float({ action = "toggle" }))
|
||||
-- hl.bind("SUPER + W", hl.dsp.group.toggle())
|
||||
hl.bind("SUPER + SHIFT + W", hl.dsp.exec_cmd("dms ipc call window-rules toggle"))
|
||||
|
||||
-- === Focus Navigation ===
|
||||
hl.bind("SUPER + left", hl.dsp.focus({ direction = "l" }))
|
||||
hl.bind("SUPER + down", hl.dsp.focus({ direction = "d" }))
|
||||
hl.bind("SUPER + up", hl.dsp.focus({ direction = "u" }))
|
||||
hl.bind("SUPER + right", hl.dsp.focus({ direction = "r" }))
|
||||
hl.bind("SUPER + H", hl.dsp.focus({ direction = "l" }))
|
||||
hl.bind("SUPER + J", hl.dsp.focus({ direction = "d" }))
|
||||
hl.bind("SUPER + K", hl.dsp.focus({ direction = "u" }))
|
||||
hl.bind("SUPER + L", hl.dsp.focus({ direction = "r" }))
|
||||
|
||||
-- === Window Movement ===
|
||||
hl.bind("SUPER + SHIFT + left", hl.dsp.window.move({ direction = "l" }))
|
||||
hl.bind("SUPER + SHIFT + down", hl.dsp.window.move({ direction = "d" }))
|
||||
hl.bind("SUPER + SHIFT + up", hl.dsp.window.move({ direction = "u" }))
|
||||
hl.bind("SUPER + SHIFT + right", hl.dsp.window.move({ direction = "r" }))
|
||||
hl.bind("SUPER + SHIFT + H", hl.dsp.window.move({ direction = "l" }))
|
||||
hl.bind("SUPER + SHIFT + J", hl.dsp.window.move({ direction = "d" }))
|
||||
hl.bind("SUPER + SHIFT + K", hl.dsp.window.move({ direction = "u" }))
|
||||
hl.bind("SUPER + SHIFT + L", hl.dsp.window.move({ direction = "r" }))
|
||||
|
||||
-- === Column Navigation ===
|
||||
hl.bind("SUPER + Home", hl.dsp.focus({ window = "first" }))
|
||||
hl.bind("SUPER + End", hl.dsp.focus({ window = "last" }))
|
||||
|
||||
-- === Monitor Navigation ===
|
||||
hl.bind("SUPER + CTRL + left", hl.dsp.focus({ monitor = "l" }))
|
||||
hl.bind("SUPER + CTRL + right", hl.dsp.focus({ monitor = "r" }))
|
||||
hl.bind("SUPER + CTRL + H", hl.dsp.focus({ monitor = "l" }))
|
||||
hl.bind("SUPER + CTRL + J", hl.dsp.focus({ monitor = "d" }))
|
||||
hl.bind("SUPER + CTRL + K", hl.dsp.focus({ monitor = "u" }))
|
||||
hl.bind("SUPER + CTRL + L", hl.dsp.focus({ monitor = "r" }))
|
||||
|
||||
-- === Move to Monitor ===
|
||||
hl.bind("SUPER + SHIFT + CTRL + left", hl.dsp.window.move({ monitor = "l" }))
|
||||
hl.bind("SUPER + SHIFT + CTRL + down", hl.dsp.window.move({ monitor = "d" }))
|
||||
hl.bind("SUPER + SHIFT + CTRL + up", hl.dsp.window.move({ monitor = "u" }))
|
||||
hl.bind("SUPER + SHIFT + CTRL + right", hl.dsp.window.move({ monitor = "r" }))
|
||||
hl.bind("SUPER + SHIFT + CTRL + H", hl.dsp.window.move({ monitor = "l" }))
|
||||
hl.bind("SUPER + SHIFT + CTRL + J", hl.dsp.window.move({ monitor = "d" }))
|
||||
hl.bind("SUPER + SHIFT + CTRL + K", hl.dsp.window.move({ monitor = "u" }))
|
||||
hl.bind("SUPER + SHIFT + CTRL + L", hl.dsp.window.move({ monitor = "r" }))
|
||||
|
||||
-- === Workspace Navigation ===
|
||||
hl.bind("SUPER + Page_Down", hl.dsp.focus({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + Page_Up", hl.dsp.focus({ workspace = "e-1" }))
|
||||
hl.bind("SUPER + U", hl.dsp.focus({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + I", hl.dsp.focus({ workspace = "e-1" }))
|
||||
hl.bind("SUPER + CTRL + down", hl.dsp.window.move({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + CTRL + up", hl.dsp.window.move({ workspace = "e-1" }))
|
||||
hl.bind("SUPER + CTRL + U", hl.dsp.window.move({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + CTRL + I", hl.dsp.window.move({ workspace = "e-1" }))
|
||||
|
||||
-- === Workspace Management ===
|
||||
hl.bind("CTRL + SHIFT + R", hl.dsp.exec_cmd("dms ipc call workspace-rename open"))
|
||||
|
||||
-- === Move Workspaces ===
|
||||
hl.bind("SUPER + SHIFT + Page_Down", hl.dsp.window.move({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + SHIFT + Page_Up", hl.dsp.window.move({ workspace = "e-1" }))
|
||||
hl.bind("SUPER + SHIFT + U", hl.dsp.window.move({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + SHIFT + I", hl.dsp.window.move({ workspace = "e-1" }))
|
||||
|
||||
-- === Mouse Wheel Navigation ===
|
||||
hl.bind("SUPER + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
|
||||
hl.bind("SUPER + CTRL + mouse_down", hl.dsp.window.move({ workspace = "e+1" }))
|
||||
hl.bind("SUPER + CTRL + mouse_up", hl.dsp.window.move({ workspace = "e-1" }))
|
||||
|
||||
-- === Touchpad Gestures ===
|
||||
hl.gesture({ fingers = 3, direction = "horizontal", action = "workspace" })
|
||||
|
||||
-- === Numbered Workspaces ===
|
||||
hl.bind("SUPER + 1", hl.dsp.focus({ workspace = "1" }))
|
||||
hl.bind("SUPER + 2", hl.dsp.focus({ workspace = "2" }))
|
||||
hl.bind("SUPER + 3", hl.dsp.focus({ workspace = "3" }))
|
||||
hl.bind("SUPER + 4", hl.dsp.focus({ workspace = "4" }))
|
||||
hl.bind("SUPER + 5", hl.dsp.focus({ workspace = "5" }))
|
||||
hl.bind("SUPER + 6", hl.dsp.focus({ workspace = "6" }))
|
||||
hl.bind("SUPER + 7", hl.dsp.focus({ workspace = "7" }))
|
||||
hl.bind("SUPER + 8", hl.dsp.focus({ workspace = "8" }))
|
||||
hl.bind("SUPER + 9", hl.dsp.focus({ workspace = "9" }))
|
||||
|
||||
-- === Move to Numbered Workspaces ===
|
||||
hl.bind("SUPER + SHIFT + 1", hl.dsp.window.move({ workspace = "1" }))
|
||||
hl.bind("SUPER + SHIFT + 2", hl.dsp.window.move({ workspace = "2" }))
|
||||
hl.bind("SUPER + SHIFT + 3", hl.dsp.window.move({ workspace = "3" }))
|
||||
hl.bind("SUPER + SHIFT + 4", hl.dsp.window.move({ workspace = "4" }))
|
||||
hl.bind("SUPER + SHIFT + 5", hl.dsp.window.move({ workspace = "5" }))
|
||||
hl.bind("SUPER + SHIFT + 6", hl.dsp.window.move({ workspace = "6" }))
|
||||
hl.bind("SUPER + SHIFT + 7", hl.dsp.window.move({ workspace = "7" }))
|
||||
hl.bind("SUPER + SHIFT + 8", hl.dsp.window.move({ workspace = "8" }))
|
||||
hl.bind("SUPER + SHIFT + 9", hl.dsp.window.move({ workspace = "9" }))
|
||||
|
||||
-- === Column Management ===
|
||||
hl.bind("SUPER + bracketleft", hl.dsp.layout("preselect l"))
|
||||
hl.bind("SUPER + bracketright", hl.dsp.layout("preselect r"))
|
||||
|
||||
-- === Sizing & Layout ===
|
||||
hl.bind("SUPER + R", hl.dsp.layout("togglesplit"))
|
||||
hl.bind("SUPER + CTRL + F", hl.dsp.window.fullscreen({ mode = "maximized", action = "set" }))
|
||||
|
||||
-- === Move/resize windows with mainMod + LMB/RMB and dragging ===
|
||||
hl.bind("SUPER + mouse:272", hl.dsp.window.drag(), { mouse = true, description = "Move window" })
|
||||
hl.bind("SUPER + mouse:273", hl.dsp.window.resize(), { mouse = true, description = "Resize window" })
|
||||
|
||||
hl.bind("SUPER + code:20", hl.dsp.window.resize({ x = -100, y = 0, relative = true }), { description = "Expand window left" })
|
||||
hl.bind("SUPER + code:21", hl.dsp.window.resize({ x = 100, y = 0, relative = true }), { description = "Shrink window left" })
|
||||
|
||||
-- === Manual Sizing ===
|
||||
hl.bind("SUPER + minus", hl.dsp.window.resize({ x = -100, y = 0, relative = true }), { repeating = true })
|
||||
hl.bind("SUPER + equal", hl.dsp.window.resize({ x = 100, y = 0, relative = true }), { repeating = true })
|
||||
hl.bind("SUPER + SHIFT + minus", hl.dsp.window.resize({ x = 0, y = -100, relative = true }), { repeating = true })
|
||||
hl.bind("SUPER + SHIFT + equal", hl.dsp.window.resize({ x = 0, y = 100, relative = true }), { repeating = true })
|
||||
|
||||
-- === Screenshots ===
|
||||
hl.bind("Print", hl.dsp.exec_cmd("dms screenshot"))
|
||||
hl.bind("CTRL + Print", hl.dsp.exec_cmd("dms screenshot full"))
|
||||
hl.bind("ALT + Print", hl.dsp.exec_cmd("dms screenshot window"))
|
||||
|
||||
-- === Display Profiles ===
|
||||
hl.bind("SUPER + P", hl.dsp.exec_cmd("dms ipc outputs cycleProfile"))
|
||||
|
||||
-- === System Controls ===
|
||||
hl.bind("SUPER + SHIFT + P", hl.dsp.dpms({ action = "toggle" }))
|
||||
@@ -1,27 +0,0 @@
|
||||
-- Auto-generated by DMS Matugen hook — do not edit manually.
|
||||
-- Remove require("dms.colors") from hyprland.lua to override.
|
||||
|
||||
hl.config({
|
||||
general = {
|
||||
col = {
|
||||
active_border = "rgb(d0bcff)",
|
||||
inactive_border = "rgb(948f99)",
|
||||
},
|
||||
},
|
||||
group = {
|
||||
col = {
|
||||
border_active = "rgb(d0bcff)",
|
||||
border_inactive = "rgb(948f99)",
|
||||
border_locked_active = "rgb(f2b8b5)",
|
||||
border_locked_inactive = "rgb(948f99)",
|
||||
},
|
||||
groupbar = {
|
||||
col = {
|
||||
active = "rgb(d0bcff)",
|
||||
inactive = "rgb(948f99)",
|
||||
locked_active = "rgb(f2b8b5)",
|
||||
locked_inactive = "rgb(948f99)",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1 +0,0 @@
|
||||
-- Cursor theme overrides. Deploy writes ~/.config/hypr/dms/cursor.lua
|
||||
@@ -1,13 +0,0 @@
|
||||
-- Auto-generated by DMS — do not edit manually
|
||||
|
||||
hl.config({
|
||||
general = {
|
||||
gaps_in = 4,
|
||||
gaps_out = 4,
|
||||
border_size = 2,
|
||||
resize_on_border = false,
|
||||
},
|
||||
decoration = {
|
||||
rounding = 12,
|
||||
},
|
||||
})
|
||||
@@ -1,17 +0,0 @@
|
||||
-- Per-output monitor rules — embedded sibling of the legacy outputs.conf fragment.
|
||||
|
||||
hl.monitor({
|
||||
output = "DP-1",
|
||||
mode = "2560x1440@180.0",
|
||||
position = "0x0",
|
||||
scale = 1,
|
||||
vrr = 0
|
||||
})
|
||||
|
||||
hl.monitor({
|
||||
output = "HDMI-A-1",
|
||||
mode = "1920x1080@60.0",
|
||||
position = "2560x790",
|
||||
scale = 1,
|
||||
vrr = 0
|
||||
})
|
||||
@@ -1 +0,0 @@
|
||||
-- Window rules. Deploy writes ~/.config/hypr/dms/windowrules.lua
|
||||
@@ -1,89 +0,0 @@
|
||||
-- Hyprland configuration (Lua) — https://wiki.hypr.land/Configuring/Start/
|
||||
|
||||
hl.config({ autogenerated = false })
|
||||
|
||||
-- DMS_STARTUP_BEGIN
|
||||
hl.on("hyprland.start", function()
|
||||
hl.exec_cmd("dbus-update-activation-environment --systemd --all")
|
||||
hl.exec_cmd("systemctl --user start hyprland-session.target")
|
||||
end)
|
||||
-- DMS_STARTUP_END
|
||||
|
||||
hl.config({
|
||||
input = {
|
||||
kb_layout = "us",
|
||||
kb_options = "compose:ralt",
|
||||
numlock_by_default = true,
|
||||
touchpad = {
|
||||
tap_to_click = true,
|
||||
natural_scroll = true,
|
||||
},
|
||||
},
|
||||
general = {
|
||||
gaps_in = 5,
|
||||
gaps_out = 5,
|
||||
border_size = 2,
|
||||
layout = "dwindle",
|
||||
},
|
||||
decoration = {
|
||||
rounding = 12,
|
||||
active_opacity = 1.0,
|
||||
inactive_opacity = 1.0,
|
||||
shadow = {
|
||||
enabled = true,
|
||||
range = 30,
|
||||
render_power = 5,
|
||||
offset = "0 5",
|
||||
color = "rgba(00000070)",
|
||||
},
|
||||
},
|
||||
misc = {
|
||||
disable_hyprland_logo = true,
|
||||
disable_splash_rendering = true,
|
||||
},
|
||||
dwindle = {
|
||||
preserve_split = true,
|
||||
},
|
||||
master = {
|
||||
mfact = 0.5,
|
||||
},
|
||||
})
|
||||
|
||||
hl.animation({ leaf = "windowsIn", enabled = true, speed = 3, bezier = "default" })
|
||||
hl.animation({ leaf = "windowsOut", enabled = true, speed = 3, bezier = "default" })
|
||||
hl.animation({ leaf = "workspaces", enabled = true, speed = 5, bezier = "default" })
|
||||
hl.animation({ leaf = "windowsMove", enabled = true, speed = 4, bezier = "default" })
|
||||
hl.animation({ leaf = "fade", enabled = true, speed = 3, bezier = "default" })
|
||||
hl.animation({ leaf = "border", enabled = true, speed = 3, bezier = "default" })
|
||||
|
||||
hl.window_rule({ match = { class = "^(org\\.wezfurlong\\.wezterm)$" }, tile = true })
|
||||
hl.window_rule({ match = { class = "^(org\\.gnome\\.)" }, rounding = 12 })
|
||||
hl.window_rule({ match = { class = "^(gnome-control-center)$" }, tile = true })
|
||||
hl.window_rule({ match = { class = "^(pavucontrol)$" }, tile = true })
|
||||
hl.window_rule({ match = { class = "^(nm-connection-editor)$" }, tile = true })
|
||||
hl.window_rule({ match = { class = "^(org\\.gnome\\.Calculator)$" }, float = true })
|
||||
hl.window_rule({ match = { class = "^(gnome-calculator)$" }, float = true })
|
||||
hl.window_rule({ match = { class = "^(galculator)$" }, float = true })
|
||||
hl.window_rule({ match = { class = "^(blueman-manager)$" }, float = true })
|
||||
hl.window_rule({ match = { class = "^(org\\.gnome\\.Nautilus)$" }, float = true })
|
||||
hl.window_rule({ match = { class = "^(xdg-desktop-portal)$" }, float = true })
|
||||
hl.window_rule({
|
||||
match = { class = "^(steam)$", title = "^(notificationtoasts)" },
|
||||
no_initial_focus = true,
|
||||
pin = true,
|
||||
})
|
||||
hl.window_rule({
|
||||
match = { class = "^(firefox)$", title = "^(Picture-in-Picture)$" },
|
||||
float = true,
|
||||
})
|
||||
hl.window_rule({ match = { class = "^(zoom)$" }, float = true })
|
||||
hl.layer_rule({ match = { namespace = "^(quickshell)$" }, no_anim = true })
|
||||
hl.layer_rule({ match = { namespace = "^dms:.*" }, no_anim = true })
|
||||
|
||||
require("dms.colors")
|
||||
require("dms.outputs")
|
||||
require("dms.layout")
|
||||
require("dms.cursor")
|
||||
require("dms.binds")
|
||||
require("dms.binds-user")
|
||||
require("dms.windowrules")
|
||||
@@ -1,148 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 📹 Wayland Screen Recording Utility (Niri & Hyprland compatible)
|
||||
# Leverages 'wf-recorder' for GPU-accelerated video recording and pipewire audio routing.
|
||||
# Supports capturing specific regions, active windows, focused monitors, or full displays.
|
||||
#
|
||||
# Usage:
|
||||
# record.sh [area | window | output | screen] [audio]
|
||||
|
||||
PID_FILE="/tmp/wf-recorder.pid"
|
||||
TYPE_FILE="/tmp/wf-recorder.type"
|
||||
OUTPUT_DIR="${XDG_VIDEOS_DIR:-$HOME/Videos}"
|
||||
|
||||
# Ensure output directory exists
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# Stop any active recording session gracefully
|
||||
stop_recording() {
|
||||
# Check if we have a saved process ID
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat "$PID_FILE")
|
||||
if kill -0 "$PID" 2>/dev/null; then
|
||||
# Send INT signal (Ctrl+C equivalent) so wf-recorder can flush the output container
|
||||
kill -INT "$PID"
|
||||
# Wait briefly to permit filesystem write finalization
|
||||
sleep 0.5
|
||||
fi
|
||||
rm -f "$PID_FILE"
|
||||
fi
|
||||
|
||||
# Sweep for orphan instances of wf-recorder to prevent background process leaks
|
||||
if pgrep -x "wf-recorder" > /dev/null; then
|
||||
pkill -INT -x wf-recorder
|
||||
sleep 0.5
|
||||
fi
|
||||
|
||||
# Read the recording type metadata for user notification
|
||||
TYPE="Recording"
|
||||
if [ -f "$TYPE_FILE" ]; then
|
||||
TYPE=$(cat "$TYPE_FILE")
|
||||
rm -f "$TYPE_FILE"
|
||||
fi
|
||||
|
||||
notify-send -t 3000 -u normal "Screen Recorder" "$TYPE stopped and saved to $OUTPUT_DIR"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# If the script is invoked while a recording is already running, toggle it OFF
|
||||
if pgrep -x "wf-recorder" > /dev/null; then
|
||||
stop_recording
|
||||
fi
|
||||
|
||||
# Define operation modes
|
||||
MODE="${1:-area}"
|
||||
AUDIO_DEVICE=""
|
||||
TYPE_DESC="Screen Recording"
|
||||
GEOM=""
|
||||
OUTPUT_TARGET=""
|
||||
|
||||
# Extract geometric regions or output target based on requested mode
|
||||
case "$MODE" in
|
||||
area)
|
||||
# Interactive region selector using 'slurp'. User clicks and drags to select.
|
||||
GEOM=$(slurp)
|
||||
if [ -z "$GEOM" ]; then
|
||||
notify-send -t 2000 "Screen Recorder" "Recording cancelled"
|
||||
exit 1
|
||||
fi
|
||||
TYPE_DESC="Area Recording"
|
||||
;;
|
||||
window)
|
||||
# Try querying Hyprland active window coordinates if on Hyprland
|
||||
if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ] && command -v hyprctl >/dev/null 2>&1; then
|
||||
GEOM=$(hyprctl activewindow -j 2>/dev/null | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')
|
||||
fi
|
||||
# Fallback to interactive window / region selection via slurp
|
||||
if [ -z "$GEOM" ] || [ "$GEOM" = "null,null nullxnull" ]; then
|
||||
GEOM=$(slurp)
|
||||
fi
|
||||
if [ -z "$GEOM" ]; then
|
||||
notify-send -t 2000 "Screen Recorder" "Recording cancelled"
|
||||
exit 1
|
||||
fi
|
||||
TYPE_DESC="Window Recording"
|
||||
;;
|
||||
output)
|
||||
# Query focused monitor on Niri or Hyprland
|
||||
if [ "$XDG_CURRENT_DESKTOP" = "niri" ] || command -v niri >/dev/null 2>&1; then
|
||||
OUTPUT_TARGET=$(niri msg -j focused-output 2>/dev/null | jq -r '.name // empty')
|
||||
fi
|
||||
if [ -z "$OUTPUT_TARGET" ] && command -v hyprctl >/dev/null 2>&1; then
|
||||
OUTPUT_TARGET=$(hyprctl monitors -j 2>/dev/null | jq -r '.[] | select(.focused == true) | .name // empty')
|
||||
fi
|
||||
TYPE_DESC="Monitor Recording"
|
||||
;;
|
||||
screen)
|
||||
# Full desktop layout across monitors
|
||||
GEOM=""
|
||||
OUTPUT_TARGET=""
|
||||
TYPE_DESC="Full Screen Recording"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Resolve dynamic audio monitor node if requested
|
||||
if [ "$2" = "audio" ] || [ "$1" = "audio" ]; then
|
||||
# Parse status output of wireplumber to determine the currently active output Sink ID
|
||||
SINK_ID=$(wpctl status 2>/dev/null | sed -n '/Sinks:/,/Sources:/p' | grep '\*' | awk '{print $3}' | tr -d '.' | head -n 1)
|
||||
if [ -n "$SINK_ID" ]; then
|
||||
# Query wireplumber to resolve the dynamic node name of the identified sink
|
||||
NODE_NAME=$(wpctl inspect "$SINK_ID" 2>/dev/null | grep 'node.name' | awk -F'"' '{print $2}')
|
||||
if [ -n "$NODE_NAME" ]; then
|
||||
# Append .monitor to route output system audio loopback to the recording device
|
||||
AUDIO_DEVICE="${NODE_NAME}.monitor"
|
||||
fi
|
||||
fi
|
||||
# Fallback to default system source if parsing failed
|
||||
if [ -z "$AUDIO_DEVICE" ]; then
|
||||
AUDIO_DEVICE="default"
|
||||
fi
|
||||
TYPE_DESC="${TYPE_DESC} (with Audio)"
|
||||
fi
|
||||
|
||||
# Define output filename format
|
||||
FILENAME="recording_$(date +%Y-%m-%d_%H-%M-%S).mp4"
|
||||
FILEPATH="$OUTPUT_DIR/$FILENAME"
|
||||
|
||||
# Desktop notification before starting
|
||||
notify-send -t 2000 -u low "Screen Recorder" "Starting $TYPE_DESC..."
|
||||
|
||||
# Build wf-recorder arguments array
|
||||
CMD=(wf-recorder)
|
||||
if [ -n "$AUDIO_DEVICE" ]; then
|
||||
CMD+=(-a "$AUDIO_DEVICE")
|
||||
fi
|
||||
if [ -n "$GEOM" ]; then
|
||||
CMD+=(-g "$GEOM")
|
||||
elif [ -n "$OUTPUT_TARGET" ]; then
|
||||
CMD+=(-o "$OUTPUT_TARGET")
|
||||
fi
|
||||
CMD+=(-f "$FILEPATH")
|
||||
|
||||
# Execute wf-recorder in background
|
||||
"${CMD[@]}" &
|
||||
PID=$!
|
||||
|
||||
# Track PID and Type metadata in /tmp for toggle invocation
|
||||
echo "$PID" > "$PID_FILE"
|
||||
echo "$TYPE_DESC" > "$TYPE_FILE"
|
||||
@@ -1,97 +0,0 @@
|
||||
# 🖥️ Desktop Machine Configuration
|
||||
# This file defines host-specific system configurations for the Desktop environment.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix # Desktop-specific disk and CPU configuration
|
||||
../../modules/system/graphical.nix # System-wide graphical stack settings (DMS daemon)
|
||||
../../modules/system/base.nix # General hardware-agnostic OS settings
|
||||
./dynu.nix # Dynu DDNS update service
|
||||
./traefik-deployments.nix # Traefik deployments secrets module
|
||||
./homeserver.nix # Homeserver core services module
|
||||
];
|
||||
|
||||
# Enable experimental Nix features (required for Flakes and newer command line tools)
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# System-wide fonts installed for general window manager / applications
|
||||
fonts.packages = with pkgs; [
|
||||
inter
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.jetbrains-mono
|
||||
nerd-fonts.roboto-mono
|
||||
];
|
||||
|
||||
# Configure default fonts for system-wide alias fallbacks
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
monospace = [ "Fira Code" ];
|
||||
sansSerif = [ "Inter" ];
|
||||
};
|
||||
};
|
||||
|
||||
# EFI bootloader configuration
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Network identification
|
||||
networking.hostName = "desktop";
|
||||
|
||||
# Define the main user profile
|
||||
users.users.kiskaadee = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel" # Enable sudo access for administrative tasks
|
||||
"docker" # Allows running docker commands without sudo
|
||||
"networkmanager" # Allows modifying network configurations
|
||||
"lp" # Allows managing printers and print jobs
|
||||
"scanner" # Allows access to scanners
|
||||
];
|
||||
};
|
||||
|
||||
# Host graphical compositors (Niri as primary, Hyprland as secondary/fallback)
|
||||
programs = {
|
||||
niri.enable = true;
|
||||
hyprland.enable = true;
|
||||
nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
glib
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Specialisation for headless server mode
|
||||
specialisation.server.configuration = {
|
||||
# 1. Disable display manager and window manager
|
||||
services.greetd.enable = lib.mkForce false;
|
||||
programs.niri.enable = lib.mkForce false;
|
||||
programs.hyprland.enable = lib.mkForce false;
|
||||
programs.dms-shell.enable = lib.mkForce false;
|
||||
programs.dms-greeter.enable = lib.mkForce false;
|
||||
programs.dank-calendar.enable = lib.mkForce false;
|
||||
|
||||
# 2. Disable peripheral hardware services to reduce power consumption
|
||||
services.pipewire.enable = lib.mkForce false;
|
||||
services.printing.enable = lib.mkForce false;
|
||||
hardware.bluetooth.enable = lib.mkForce false;
|
||||
services.blueman.enable = lib.mkForce false;
|
||||
|
||||
# 3. Disable power-saving suspend/sleep/hibernate behaviors to keep server active
|
||||
systemd.targets.sleep.enable = lib.mkForce false;
|
||||
systemd.targets.suspend.enable = lib.mkForce false;
|
||||
systemd.targets.hibernate.enable = lib.mkForce false;
|
||||
systemd.targets.hybrid-sleep.enable = lib.mkForce false;
|
||||
|
||||
# 4. Enable active kernel-level power management tuning
|
||||
powerManagement.powertop.enable = lib.mkForce true;
|
||||
};
|
||||
|
||||
# Rebuild/State version. Do not modify.
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
# General configuration
|
||||
syslog=no
|
||||
pid=/run/ddclient/ddclient.pid
|
||||
cache=/var/lib/ddclient/ddclient.cache
|
||||
usev4=webv4
|
||||
|
||||
# Provider definition using credentials decrypted at runtime
|
||||
protocol=dyndns2
|
||||
server=api.dynu.com
|
||||
login=@dynu_user@
|
||||
password=@dynu_password@
|
||||
@dynu_domain@
|
||||
@@ -1,92 +0,0 @@
|
||||
# 🌐 Dynu DDNS IP Monitor & Updater Service
|
||||
# This NixOS module configures a smart, local-first IP change detector.
|
||||
# It queries public IP providers, maintains a history log of WAN IP rotations,
|
||||
# and triggers ddclient only when an actual change is detected to prevent API rate limits.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
# Declaratively read the external Python script into the Nix store at evaluation time
|
||||
ipMonitorScript = pkgs.writers.writePython3Bin "dynu-ip-monitor" { } (builtins.readFile ./monitor.py);
|
||||
in
|
||||
{
|
||||
# 1. Load the encrypted secrets file
|
||||
sops.defaultSopsFile = ./secrets.yaml;
|
||||
sops.defaultSopsFormat = "yaml";
|
||||
|
||||
# Define the keys to decrypt
|
||||
sops.secrets.dynu_user = { };
|
||||
sops.secrets.dynu_domain = { };
|
||||
sops.secrets.dynu_password = { };
|
||||
sops.secrets.pdf_decrypt_password = {
|
||||
owner = "kiskaadee";
|
||||
};
|
||||
|
||||
# Assemble the ddclient config file securely at boot time in /run/secrets/
|
||||
# Defaults to owner root:root (which avoids dynamic user evaluation issues)
|
||||
sops.templates."ddclient.conf" = {
|
||||
content = builtins.replaceStrings
|
||||
[ "@dynu_user@" "@dynu_password@" "@dynu_domain@" ]
|
||||
[
|
||||
config.sops.placeholder.dynu_user
|
||||
config.sops.placeholder.dynu_password
|
||||
config.sops.placeholder.dynu_domain
|
||||
]
|
||||
(builtins.readFile ./ddclient.conf);
|
||||
};
|
||||
|
||||
# 2. Enable ddclient and feed it the decrypted configuration template via systemd credentials
|
||||
services.ddclient = {
|
||||
enable = true;
|
||||
configFile = "/run/credentials/ddclient.service/ddclient.conf";
|
||||
};
|
||||
|
||||
systemd.services.ddclient = {
|
||||
serviceConfig = {
|
||||
# Securely load the root-owned secret file into the dynamic ddclient service
|
||||
LoadCredential = [ "ddclient.conf:${config.sops.templates."ddclient.conf".path}" ];
|
||||
};
|
||||
};
|
||||
|
||||
# 3. Disable ddclient's automatic timer.
|
||||
# This stops ddclient from polling every 10 minutes on its own.
|
||||
systemd.timers.ddclient.enable = false;
|
||||
|
||||
# 4. Define the smart IP change detector service
|
||||
systemd.services.dynu-monitor = {
|
||||
description = "Dynu DDNS Smart IP Change Monitor";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
path = with pkgs; [
|
||||
systemd # Required for systemctl
|
||||
];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
Group = "root";
|
||||
StateDirectory = "dynu";
|
||||
Environment = "HISTORY_FILE=/var/lib/dynu/ip_history.jsonl";
|
||||
ExecStart = "${ipMonitorScript}/bin/dynu-ip-monitor";
|
||||
TimeoutSec = 30;
|
||||
|
||||
# Hardening
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
ReadWritePaths = "/var/lib/dynu";
|
||||
};
|
||||
};
|
||||
|
||||
# 5. Run the smart IP change monitor periodically (every 30 minutes)
|
||||
systemd.timers.dynu-monitor = {
|
||||
description = "Run Dynu IP monitor periodically";
|
||||
timerConfig = {
|
||||
OnBootSec = "5min";
|
||||
OnUnitActiveSec = "30min";
|
||||
AccuracySec = "1min";
|
||||
Persistent = true;
|
||||
};
|
||||
wantedBy = [ "timers.target" ];
|
||||
};
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" ];
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/mapper/nixos_vg-root";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/66E6-7442";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
fileSystems."/media" =
|
||||
{ device = "/dev/mapper/nixos_vg-media";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/mapper/nixos_vg-home";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# 🏠 Desktop Host-Specific Home Manager Configuration
|
||||
# Graphical workstation environment for legacy desktop host.
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../modules/user/apps.nix
|
||||
../../modules/user/graphical.nix
|
||||
];
|
||||
|
||||
# Host-specific package installations for desktop (Hyprland environment)
|
||||
home.packages = with pkgs; [
|
||||
grimblast # Screenshot utility for Hyprland
|
||||
];
|
||||
|
||||
# Mount custom Hyprland and DankMaterialShell configuration files declaratively
|
||||
home.file.".config/hypr/hyprland.lua".source = ./config/hypr/hyprland.lua;
|
||||
home.file.".config/hypr/dms".source = ./config/hypr/dms;
|
||||
home.file.".config/hypr/scripts".source = ./config/hypr/scripts;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
# 🌐 Homeserver Core Environment Secrets & Systemd service configuration
|
||||
# This NixOS module manages secrets and the systemd lifecycle for the core homeserver stack.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# 1. Load the encrypted secrets file
|
||||
sops.defaultSopsFile = ./secrets.yaml;
|
||||
sops.defaultSopsFormat = "yaml";
|
||||
|
||||
# Define the keys to decrypt from secrets.yaml
|
||||
sops.secrets = lib.genAttrs [
|
||||
"dynu_api_key"
|
||||
"acme_email"
|
||||
"authelia_session_secret"
|
||||
"authelia_storage_encryption_key"
|
||||
"authelia_identity_validation_reset_password_jwt_secret"
|
||||
"authelia_user_kiskaadee_password_hash"
|
||||
] (name: { owner = "kiskaadee"; });
|
||||
|
||||
# 2. Generate the unified environment file at runtime in /run/secrets/homeserver.env
|
||||
sops.templates."homeserver.env" = {
|
||||
owner = "kiskaadee";
|
||||
content = lib.generators.toKeyValue {} {
|
||||
DOMAIN = "roadtotech.me";
|
||||
DOCKER_API_VERSION = "1.40";
|
||||
DYNU_API_KEY = config.sops.placeholder.dynu_api_key;
|
||||
ACME_EMAIL = config.sops.placeholder.acme_email;
|
||||
AUTHELIA_SESSION_SECRET = config.sops.placeholder.authelia_session_secret;
|
||||
AUTHELIA_STORAGE_ENCRYPTION_KEY = config.sops.placeholder.authelia_storage_encryption_key;
|
||||
AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET = config.sops.placeholder.authelia_identity_validation_reset_password_jwt_secret;
|
||||
};
|
||||
};
|
||||
|
||||
# Generate the declarative Authelia user database file at runtime in /run/secrets/users.yml
|
||||
sops.templates."users.yml" = {
|
||||
owner = "kiskaadee";
|
||||
content = ''
|
||||
users:
|
||||
kiskaadee:
|
||||
displayname: "Kiskaadee"
|
||||
password: "${config.sops.placeholder.authelia_user_kiskaadee_password_hash}"
|
||||
email: "fcortesbio@gmail.com"
|
||||
groups:
|
||||
- admins
|
||||
- dev
|
||||
'';
|
||||
};
|
||||
|
||||
# 3. Define the declarative systemd service to manage the homeserver container stack
|
||||
systemd.services.homeserver-core = {
|
||||
description = "Homeserver Core Stack (Traefik, Authelia, Homepage, etc.)";
|
||||
after = [ "network-online.target" "docker.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
WorkingDirectory = "/home/kiskaadee/Core";
|
||||
ExecStart = "${pkgs.docker-compose}/bin/docker-compose --env-file ${config.sops.templates."homeserver.env".path} up -d --remove-orphans";
|
||||
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
|
||||
};
|
||||
};
|
||||
|
||||
# 4. Open ports in the firewall for Traefik and Gitea SSH
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 2223 ];
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
"""
|
||||
Dynu DDNS Smart IP Change Monitor and Updater.
|
||||
|
||||
This script determines the current public IPv4 address by querying multiple
|
||||
external resolvers sequentially. It compares the discovered IP against the last
|
||||
recorded successful IP in a local history log. If a change is detected, it
|
||||
triggers the `ddclient.service` on-demand to perform the DNS record update.
|
||||
|
||||
This local-first state verification prevents making redundant API requests to
|
||||
the DNS provider, avoiding rate-limiting, IP bans, or API abuse flags.
|
||||
"""
|
||||
|
||||
import urllib.request
|
||||
import re
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
# History file location storing the transition log of public IP states.
|
||||
# Defaults to a state directory managed securely by the systemd service unit.
|
||||
HISTORY_FILE = os.environ.get("HISTORY_FILE", "/var/lib/dynu/ip_history.jsonl")
|
||||
|
||||
# Fallback sequence of external services to discover the public WAN IP.
|
||||
PROVIDERS = [
|
||||
"https://api.ipify.org",
|
||||
"https://ifconfig.me/ip",
|
||||
"https://icanhazip.com",
|
||||
"https://wtfismyip.com/text"
|
||||
]
|
||||
|
||||
|
||||
def is_valid_public_ipv4(ip):
|
||||
"""
|
||||
Validates that a string is a properly formatted public IPv4 address.
|
||||
|
||||
This function excludes standard private, loopback, link-local, and CGNAT
|
||||
blocks to avoid recording temporary, local, or invalid network states.
|
||||
"""
|
||||
match = re.match(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$", ip)
|
||||
if not match:
|
||||
return False
|
||||
octets = [int(x) for x in match.groups()]
|
||||
if any(x > 255 for x in octets):
|
||||
return False
|
||||
a, b, c, d = octets
|
||||
|
||||
# RFC 1918 Private ranges: 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12
|
||||
if a == 10:
|
||||
return False
|
||||
if a == 192 and b == 168:
|
||||
return False
|
||||
if a == 172 and 16 <= b <= 31:
|
||||
return False
|
||||
|
||||
# Carrier-Grade NAT (CGNAT) RFC 6598: 100.64.0.0/10
|
||||
if a == 100 and 64 <= b <= 127:
|
||||
return False
|
||||
|
||||
# Loopback address range: 127.0.0.0/8
|
||||
if a == 127:
|
||||
return False
|
||||
|
||||
# Link-local addresses: 169.254.0.0/16
|
||||
if a == 169 and b == 254:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def get_public_ip():
|
||||
"""
|
||||
Queries public IP providers until a valid public IPv4 is returned.
|
||||
|
||||
Returns:
|
||||
str: The validated public IP string, or None if all providers fail.
|
||||
"""
|
||||
errors = []
|
||||
for provider in PROVIDERS:
|
||||
try:
|
||||
req = urllib.request.Request(
|
||||
provider,
|
||||
headers={
|
||||
'User-Agent': 'Mozilla/5.0 (NixOS WAN Monitor)'
|
||||
}
|
||||
)
|
||||
# Fetch with 5s timeout to avoid hanging the systemd service
|
||||
with urllib.request.urlopen(req, timeout=5) as response:
|
||||
ip = response.read().decode('utf-8').strip()
|
||||
if is_valid_public_ipv4(ip):
|
||||
return ip
|
||||
else:
|
||||
errors.append(f"{provider}: invalid public IPv4 '{ip}'")
|
||||
except Exception as e:
|
||||
errors.append(f"{provider}: {str(e)}")
|
||||
|
||||
print(
|
||||
f"Error: All IP discovery providers failed. Details: {errors}",
|
||||
file=sys.stderr
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
def get_last_recorded_ip():
|
||||
"""
|
||||
Reads the history log to locate the last successful IP address.
|
||||
|
||||
Returns:
|
||||
str: The last successfully updated IP, or None if no log exists yet.
|
||||
"""
|
||||
if not os.path.exists(HISTORY_FILE):
|
||||
return None
|
||||
try:
|
||||
with open(HISTORY_FILE, "r") as f:
|
||||
lines = f.readlines()
|
||||
if not lines:
|
||||
return None
|
||||
# Search backwards to find the most recent successful transition
|
||||
for line in reversed(lines):
|
||||
try:
|
||||
entry = json.loads(line)
|
||||
if entry.get("status") == "success":
|
||||
return entry.get("ip")
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
except Exception as e:
|
||||
print(f"Warning: Failed to read history file: {e}", file=sys.stderr)
|
||||
return None
|
||||
|
||||
|
||||
def record_ip(ip, status, details=None):
|
||||
"""
|
||||
Appends a new event entry into the JSONLines history registry.
|
||||
"""
|
||||
os.makedirs(os.path.dirname(HISTORY_FILE), exist_ok=True)
|
||||
entry = {
|
||||
"timestamp": datetime.utcnow().isoformat() + "Z",
|
||||
"ip": ip,
|
||||
"status": status
|
||||
}
|
||||
if details:
|
||||
entry["details"] = details
|
||||
try:
|
||||
with open(HISTORY_FILE, "a") as f:
|
||||
f.write(json.dumps(entry) + "\n")
|
||||
except Exception as e:
|
||||
print(f"Error: Failed to write to history file: {e}", file=sys.stderr)
|
||||
|
||||
|
||||
def trigger_ddclient():
|
||||
"""
|
||||
Invokes the systemd service unit for `ddclient` on-demand.
|
||||
|
||||
Returns:
|
||||
tuple: (bool, str) representing (success_boolean, error_details_string)
|
||||
"""
|
||||
try:
|
||||
# Run ddclient as a one-shot activation via systemd to perform API call
|
||||
res = subprocess.run(
|
||||
["systemctl", "start", "ddclient.service"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
if res.returncode == 0:
|
||||
return True, None
|
||||
else:
|
||||
err_msg = (
|
||||
f"systemctl exited with {res.returncode}: "
|
||||
f"{res.stderr.strip()}"
|
||||
)
|
||||
return False, err_msg
|
||||
except Exception as e:
|
||||
return False, str(e)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Orchestrator logic for DDNS state management.
|
||||
"""
|
||||
current_ip = get_public_ip()
|
||||
if not current_ip:
|
||||
sys.exit(1)
|
||||
|
||||
last_ip = get_last_recorded_ip()
|
||||
if current_ip == last_ip:
|
||||
# IP matches last recorded working IP; do nothing to conserve quota
|
||||
sys.exit(0)
|
||||
|
||||
print(f"IP rotation detected! Old: {last_ip}, New: {current_ip}")
|
||||
|
||||
# Trigger ddclient to perform the DNS record update
|
||||
success, error_msg = trigger_ddclient()
|
||||
if success:
|
||||
print("Dynu DDNS update via ddclient triggered successfully.")
|
||||
record_ip(current_ip, "success")
|
||||
else:
|
||||
err_msg = f"Error: Failed to trigger ddclient update: {error_msg}"
|
||||
print(err_msg, file=sys.stderr)
|
||||
record_ip(current_ip, "failed_update", details=error_msg)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,42 +0,0 @@
|
||||
dynu_user: ENC[AES256_GCM,data:wDnJP2jHasV4,iv:7yk+J9tO9yqwe3POjFUTkP10I0gp1eEEQPvs4SJzBd0=,tag:98+v/rJGrTDTrxAQqhVomA==,type:str]
|
||||
dynu_domain: ENC[AES256_GCM,data:bZGnwbQEGVWnTRe7aWMSAMuhsZcIcmb2,iv:nWQzYtJeLYbtqlfe2hDMvtksFGuJ76Qjm+lnG7X2zgo=,tag:65UFCJl4JueHvkiRwcwdjQ==,type:str]
|
||||
dynu_password: ENC[AES256_GCM,data:F+YtoH6rJov2tgDdrIBGQ99b66PfJhUH0rybYhiF9ck=,iv:3o7vaYT8lNwn0fDt3opHtg5OGKkSxF8RkONTbFGe6Hw=,tag:T5EnMSwGHwAtfK1mS6FvMQ==,type:str]
|
||||
dynu_api_key: ENC[AES256_GCM,data:4v2mHY8gXIYfiEDjTcDYxhVXc5Lb/szA40oLOvwltGE=,iv:cq7pYGmN7lIWQYG5x+kaoH3GbdAb7MEufdHEMwaeFnA=,tag:sUTgBFcMGRMFgDzgDobsKw==,type:str]
|
||||
pdf_decrypt_password: ENC[AES256_GCM,data:8lh3pW2rMFs9AA==,iv:4+e0urvjYmdZ4/c0KcD7v9Ps8nKvopdYquwaMlYi2xQ=,tag:XHUESw6g1h1tR4EHrD4SaQ==,type:str]
|
||||
learning_turso_db_url: ENC[AES256_GCM,data:yV3wJI7Y5kymKjaWZ7i2Ywm7N3vSMO2ApJZALJbGVxsyIs77Z336Rljvf90hbuaTKnY=,iv:Bx2m1NpDDRU2lhiwRRlEZrhFzpNqMCDx4bbfHK63Fl8=,tag:xC7OeNC6+4Zk+IZxozWqgQ==,type:str]
|
||||
learning_turso_auth_token: ENC[AES256_GCM,data:1fl1kIEw7Z/Xv4ilMRZIt8/ei42O7KSg/yjBs5sxTYVaLrC3GNsngXuTClti8x3AjNsVN39uK2fLI8pUjGb60u07448SlByeBRQkodX/PX7WycaRl3IJ+FlaZJ/DijK2L3AEvOlECs/0PGr7hkgnVnjjg9c2YK+mJuT3xqY5DPytMU7f4nMFM/o63qNffB/N+WtxMsrD5izsawe95Bf6YQvpH+ue4qNn+ZIFmu/MRdCEsLjIRT4rbG76G6iIbLCT2Hr3W1hrzrCPcJ1KvLsAeT97iyNvfDdEWIdpv3DWS8jptS/G9Xvd2xJ8FWkbulZYpHLcjs4nNI0vKULi8VRfJYLYWqZ0gjNb+lkrYt6QgD13VWoC5X/H,iv:sc7Ppa5Jbrnhw97OSMSBQUrnYPH9rJfo+QzeNCbwtIM=,tag:v3AAGyqW9ahXL+dnmDr8BA==,type:str]
|
||||
mongo_root_username: ENC[AES256_GCM,data:9jIpJnClrLAc,iv:ZtOwIUdXZoY4168YWTCE1Vcz+fek1YHRsAAyFbgkU64=,tag:WmtiJ1sdeFSQxHz5k5I2dQ==,type:str]
|
||||
mongo_root_password: ENC[AES256_GCM,data:fbtY9aMXhd8D4TL6s7Ce,iv:xXckK6Sbg1PB+1Cifq6WkHtIk9FMgZ3Yf2HdjxPO6vU=,tag:bmyC2dv+QAaoOff+ejw2/g==,type:str]
|
||||
ollama_api_key: ENC[AES256_GCM,data:1vw8FayOxXv3kfy5xcUy,iv:2zgPy1GUfPtPCyFgtED0R6cPPFJmDdhDbVA+jnomG/k=,tag:3HOdQll25oMPx3jg7Mbrdg==,type:str]
|
||||
postgres_user: ENC[AES256_GCM,data:81MBXlhjMgKd,iv:54hTY9wtxy16iB/P2QqRsIgdJZyLWYdjaWUqVQFOd74=,tag:Z/idYinY3lB1THGqG7UWAA==,type:str]
|
||||
postgres_password: ENC[AES256_GCM,data:U2ttYoopG/Uc8HrX3kKq,iv:5pUV00FPcVtKsAx2M3HSUXxRhEXFZWWt9O97CRhKrkM=,tag:ZzbB3Ggu45sylveJcfqStw==,type:str]
|
||||
postgres_db: ENC[AES256_GCM,data:DJCXJz4SSjcETw==,iv:pM2UfxK8yOL8XxbAZY6XQyNKVPRrrGwjxtM8F3XOCU0=,tag:DcCu/9L4pz7WAkF8WkKzCA==,type:str]
|
||||
acme_email: ENC[AES256_GCM,data:nQwu6pSUVGwkoq3wvY1wKNMMvis=,iv:jDY32yCLQCruelmeZ1DaeFPoxMyM4/+Mpt6g5rsYrO8=,tag:ROcVL+/2zCzF8fId6MSlrg==,type:str]
|
||||
authelia_session_secret: ENC[AES256_GCM,data:sz99LUaspa4PyTZb0ukBPKZ5uQoomEiDZ/+IxU9OxzLhBysZChTZ7nIMAmxnffbT6dHuWE3cvGntKAAOqx7DKpTOkk/YFZk31Z1FfYZ59csrIW9LChWc7EeM21SzS9Z+1jU9Zo5PBsK93X7E1m9OTKtinCwivb+hLa6AVpmdOm4=,iv:V+oxP22Nm3DyY6/SA61SrQoVwraixlM8RANQ9wejFnI=,tag:8bAuoJ6jkg5hsrzMna23vQ==,type:str]
|
||||
authelia_storage_encryption_key: ENC[AES256_GCM,data:f/pHK6GORv8iHiQbDvybi/KShoKl9b3NJbfW6m8iBK4X0A9n9UiYj+LBRFY79xs78YvYj/fDROaWN1fQM6nXJf+HsUqZ7/V3cIfk8eQdYto1mVI53VByIAEURQopnb9/+ypAN61YnCwkL2CEm0ID/sOmbLVO/aQmK7ccuN9CP2I=,iv:BcoAkOdR/gGoiiP+KJNa0H/9rXpfZf2h8dT0sw5o9pU=,tag:DsPWeWABjZVvDHC5dE1XDA==,type:str]
|
||||
authelia_identity_validation_reset_password_jwt_secret: ENC[AES256_GCM,data:HNK2JEBHQBWuNnuqiqyhbk3NOoRhV40C4H+aM7kbFl+Ag1u0Vh4yafpQuyhzBH/e2jb3KDDu12m/7u2jv8bTLFhlp3b91KeKLz4c1sVoMNRzGYzIyynx42KYutaFLH42sBVgOQ/sCw1ug+Plt2bGFMK20PODdNzFELStvk4qH1Q=,iv:6nqNlshXJoemh97LlpUCp2t/AmXmxzufzjRZYEJzGXc=,tag:ATA3lP2hQl+jFFUERIayTw==,type:str]
|
||||
authelia_user_kiskaadee_password_hash: ENC[AES256_GCM,data:ZJvq9ocETSzIl3RH9Qg0Ls4p+9QCD1/e+g1uzpAKs6HZk0AjKtCrUtqxEUjqbPi3W9ymsXQzkurtfYRw47lqsom5yGoyW6Q1Tq19crCqibgn4DHc0XGp1uoIvtxUkDSijg==,iv:rsP/z/fwhJhJs7hH0Qx3ry7K++tmEiWke2MwNULHKWg=,tag:vA7cRip2+Y7ALPL/Kqo3uQ==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBGRUpiNDJVODBxZ3o0TGwv
|
||||
MHNCU2lENkdXMGJVcW5DeDJjQjJCaExTR0VVCjlTbVF4VW9FR3Q0akwrNlZZR09V
|
||||
Z2NYT2Q1bGtHdkhhNnJtdGVzVVJIZ2MKLS0tIHhkU1l0TDMxWUVEK280WVcxVk8w
|
||||
Y0ZUZ0xRdXhTRGxGSk9lOE1Ha1l2MFUKxUhwgiNLkWuYcxq/4vKVJ/Kdot8b8fEh
|
||||
DcZmV3Q+7hi2cZvkJ3MFEGNmESe7//bGHXDJOt7rEnCcjgbU+jPAug==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age16nr2t9jrw09kakuxy2vtvtgtwa9jvy5dmtge25rzlqelf5cjy4es46alu9
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA0U3dFSTBxckZjTFpMYzIv
|
||||
L2lwVk5HMk91YjdNejNGTkR0Uy9qR0pYVEJNCk5CQ2xLRS9rQnU5UzFzc2RzY1Rr
|
||||
NUNCWlA0Nmg5VFVkTzBNVG8vaWZkMEEKLS0tIFFwdW0yVFJyQmdhMk9tcStURTFm
|
||||
MjdVUVJEZHB1SUlGYVlNTDdER0lnb2cKbJ6sWXplLLph2o+0RbAk5DXPBk3Q9LaD
|
||||
KHX+ZcBi2WoOtZJEs5G+Z6fGeZHjJ1X2JTCv9oINsppu8FUovkYX/A==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age18q3lr2z4yeg2f86my42ym4hx0dvcwgjshmchyhdkgwvf4k37dsyq3mcjse
|
||||
lastmodified: "2026-08-11T16:01:34Z"
|
||||
mac: ENC[AES256_GCM,data:PoTV9ffRfrA04oKQj57pAK3TeH4VRZ9IYxlt3qQ9ELM6fgc0+HxXYGF3XHwier1Qk8KieZtL1CeWsCwVSMIbvs6krDqqv7dSWoVs8re2cVlkSpa99eReR1wpbNBOvv2mAHBVUgMfQlht/GaBbwbswk9bnIUY5zB7AsqCSjSsPQE=,iv:49yMPyXAPeyp1Peq/L3ruLingnyWnaok4t05lSqEnTQ=,tag:PXuMC2ZjZ9eq2Xn2V+ubHQ==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
@@ -1,97 +0,0 @@
|
||||
# 🌐 Traefik Deployments Environment Secrets configuration
|
||||
# This NixOS module manages secrets and environment variables for the unified apps in /traefik-deployments
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Load the encrypted secrets file
|
||||
sops.defaultSopsFile = ./secrets.yaml;
|
||||
sops.defaultSopsFormat = "yaml";
|
||||
|
||||
# Define the keys to decrypt from secrets.yaml (avoiding repeating the owner boilerplate)
|
||||
sops.secrets = lib.genAttrs [
|
||||
"learning_turso_db_url"
|
||||
"learning_turso_auth_token"
|
||||
"mongo_root_username"
|
||||
"mongo_root_password"
|
||||
"ollama_api_key"
|
||||
"postgres_user"
|
||||
"postgres_password"
|
||||
"postgres_db"
|
||||
] (name: { owner = "kiskaadee"; });
|
||||
|
||||
# Generate the unified environment file at runtime in /run/secrets/traefik-deployments.env
|
||||
sops.templates."traefik-deployments.env" = {
|
||||
owner = "kiskaadee";
|
||||
content = lib.generators.toKeyValue {} {
|
||||
# --- Core / Infrastructure Settings ---
|
||||
PROXY_NETWORK = "proxy-net";
|
||||
CERT_RESOLVER = "myresolver";
|
||||
DOMAIN_SUFFIX = "roadtotech.me";
|
||||
|
||||
# --- Dashboard & Landing ---
|
||||
DASHBOARD_DOMAIN = "dashboard.roadtotech.me";
|
||||
LANDING_DOMAIN = "roadtotech.me";
|
||||
|
||||
# --- Docs ---
|
||||
DOCS_DOMAIN = "docs.roadtotech.me";
|
||||
DOCS_PROJECT_PATH = "/home/kiskaadee/Brain";
|
||||
|
||||
# --- Excalidraw ---
|
||||
EXCALIDRAW_DOMAIN = "excalidraw.roadtotech.me";
|
||||
|
||||
# --- Gitea ---
|
||||
GITEA_DOMAIN = "gitea.roadtotech.me";
|
||||
GITEA_SSH_DOMAIN = "gitea.roadtotech.me";
|
||||
GITEA_SSH_PORT = "2223";
|
||||
GITEA_AUTH_MIDDLEWARE = "https-redirect@docker";
|
||||
|
||||
# --- Jellyfin ---
|
||||
JELLYFIN_SERVICE_NAME = "jellyfin";
|
||||
JELLYFIN_CONTAINER_NAME = "jellyfin";
|
||||
JELLYFIN_IMAGE_TAG = "latest";
|
||||
JELLYFIN_DOMAIN = "jellyfin.roadtotech.me";
|
||||
JELLYFIN_TZ = "UTC";
|
||||
JELLYFIN_PUID = "1000";
|
||||
JELLYFIN_PGID = "1000";
|
||||
JELLYFIN_MEDIA_PATH = "/media";
|
||||
JELLYFIN_HTTP_ENTRYPOINT = "web";
|
||||
JELLYFIN_HTTPS_ENTRYPOINT = "websecure";
|
||||
JELLYFIN_RATE_LIMIT_AVG = "100";
|
||||
JELLYFIN_RATE_LIMIT_BURST = "50";
|
||||
|
||||
# --- Learning Dashboard ---
|
||||
LEARNING_SERVICE_NAME = "learning-hub";
|
||||
LEARNING_DOMAIN = "learning.roadtotech.me";
|
||||
LEARNING_APP_PORT = "8000";
|
||||
LEARNING_SOCKET_PROXY_NETWORK = "socket-net";
|
||||
LEARNING_DOCKER_HOST = "tcp://socket-proxy:2375";
|
||||
TURSO_DATABASE_URL = config.sops.placeholder.learning_turso_db_url;
|
||||
TURSO_AUTH_TOKEN = config.sops.placeholder.learning_turso_auth_token;
|
||||
|
||||
# --- Mermaid ---
|
||||
MERMAID_DOMAIN = "mermaid.roadtotech.me";
|
||||
MERMAID_SERVICE_NAME = "mermaid";
|
||||
|
||||
# --- Minecraft ---
|
||||
MINECRAFT_DOMAIN = "minecraft.roadtotech.me";
|
||||
|
||||
# --- MongoDB ---
|
||||
MONGO_ROOT_USERNAME = config.sops.placeholder.mongo_root_username;
|
||||
MONGO_ROOT_PASSWORD = config.sops.placeholder.mongo_root_password;
|
||||
MONGO_DOMAIN = "mongodb.roadtotech.me";
|
||||
|
||||
# --- PostgreSQL ---
|
||||
POSTGRES_USER = config.sops.placeholder.postgres_user;
|
||||
POSTGRES_PASSWORD = config.sops.placeholder.postgres_password;
|
||||
POSTGRES_DB = config.sops.placeholder.postgres_db;
|
||||
POSTGRES_DOMAIN = "pgsql.roadtotech.me";
|
||||
|
||||
# --- Ollama ---
|
||||
OLLAMA_DOMAIN = "ollama.roadtotech.me";
|
||||
OLLAMA_API_KEY = config.sops.placeholder.ollama_api_key;
|
||||
OLLAMA_REPLICAS = "1";
|
||||
OLLAMA_DATA_VOLUME = "ollama_data";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
# 💻 Laptop Machine Configuration
|
||||
# This file defines host-specific system configurations for the Laptop environment.
|
||||
# Sharing 100% of base shell, neovim, apps, and terminal settings with desktop,
|
||||
# but swapping the graphical compositor stack to Niri.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../../modules/system/graphical.nix # System-wide graphical stack settings (DMS daemon + greeter)
|
||||
../../modules/system/base.nix # General hardware-agnostic OS settings
|
||||
];
|
||||
|
||||
# Enable experimental Nix features (required for Flakes and newer command line tools)
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# System-wide fonts installed for general window manager / applications
|
||||
fonts.packages = with pkgs; [
|
||||
inter
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.jetbrains-mono
|
||||
nerd-fonts.roboto-mono
|
||||
];
|
||||
|
||||
# Configure default fonts for system-wide alias fallbacks
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
monospace = [ "Fira Code" ];
|
||||
sansSerif = [ "Inter" ];
|
||||
};
|
||||
};
|
||||
|
||||
# EFI bootloader configuration
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Network identification
|
||||
networking.hostName = "laptop";
|
||||
|
||||
# Define the main user profile
|
||||
users.users.kiskaadee = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel" # Enable sudo access for administrative tasks
|
||||
"docker" # Allows running docker commands without sudo
|
||||
"networkmanager" # Allows modifying network configurations
|
||||
"lp" # Allows managing printers and print jobs
|
||||
"scanner" # Allows access to scanners
|
||||
];
|
||||
};
|
||||
|
||||
# Host-specific graphical compositor (Niri window manager for laptop)
|
||||
programs.niri.enable = true;
|
||||
|
||||
# Dynamic binary execution support (for unpatched binaries, VS Code server, language servers)
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
glib
|
||||
];
|
||||
};
|
||||
|
||||
# 🔋 Laptop Power & Battery Management
|
||||
services.power-profiles-daemon.enable = true;
|
||||
services.upower.enable = true;
|
||||
|
||||
# Backlight brightness control utility
|
||||
environment.systemPackages = with pkgs; [
|
||||
brightnessctl
|
||||
];
|
||||
|
||||
# Rebuild/State version. Do not modify.
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
# 🏠 Laptop Host-Specific Home Manager Configuration
|
||||
# Graphical workstation environment for Niri-powered mobile laptop.
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../modules/user/apps.nix
|
||||
../../modules/user/graphical.nix
|
||||
];
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
# 🌐 Server Machine Configuration (Headless Homelab Node)
|
||||
# This file defines host-specific system configurations for the dedicated Server environment.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix # Server-specific disk and CPU configuration
|
||||
../../modules/system/base.nix # General hardware-agnostic OS settings
|
||||
./dynu.nix # Dynu DDNS update service
|
||||
./traefik-deployments.nix # Traefik deployments secrets module
|
||||
./homeserver.nix # Homeserver core services module
|
||||
];
|
||||
|
||||
# Enable experimental Nix features
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# System-wide fonts
|
||||
fonts.packages = with pkgs; [
|
||||
nerd-fonts.fira-code
|
||||
nerd-fonts.jetbrains-mono
|
||||
nerd-fonts.fira-mono
|
||||
inter
|
||||
];
|
||||
|
||||
# Configure default fonts
|
||||
fonts.fontconfig = {
|
||||
enable = true;
|
||||
defaultFonts = {
|
||||
monospace = [ "FiraCode Nerd Font" "JetBrainsMono Nerd Font" "Fira Code" ];
|
||||
sansSerif = [ "Inter" ];
|
||||
};
|
||||
};
|
||||
|
||||
# Console font for local TTY screen
|
||||
console = {
|
||||
font = "Lat2-Terminus16";
|
||||
keyMap = "us";
|
||||
};
|
||||
|
||||
# EFI bootloader configuration
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Network identification
|
||||
networking.hostName = "server";
|
||||
|
||||
# Define the main user profile
|
||||
users.users.kiskaadee = {
|
||||
isNormalUser = true;
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICAVPPMk+WApUd/fo78+lsRGnLKSlY4GDZiNGKwBAifD"
|
||||
];
|
||||
extraGroups = [
|
||||
"wheel" # Enable sudo access
|
||||
"docker" # Allows running docker commands without sudo
|
||||
"networkmanager" # Allows modifying network configurations
|
||||
];
|
||||
};
|
||||
|
||||
# Dynamic binary execution support
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
glib
|
||||
];
|
||||
};
|
||||
|
||||
# Headless Server Optimizations:
|
||||
# Disable peripheral hardware & desktop services
|
||||
services.pipewire.enable = lib.mkForce false;
|
||||
services.printing.enable = lib.mkForce false;
|
||||
hardware.bluetooth.enable = lib.mkForce false;
|
||||
services.blueman.enable = lib.mkForce false;
|
||||
services.greetd.enable = lib.mkForce false;
|
||||
|
||||
# Disable power-saving suspend/sleep/hibernate behaviors to keep homelab always active
|
||||
systemd.targets.sleep.enable = lib.mkForce false;
|
||||
systemd.targets.suspend.enable = lib.mkForce false;
|
||||
systemd.targets.hibernate.enable = lib.mkForce false;
|
||||
systemd.targets.hybrid-sleep.enable = lib.mkForce false;
|
||||
|
||||
# Kernel-level power management tuning
|
||||
powerManagement.powertop.enable = true;
|
||||
|
||||
# Rebuild/State version. Do not modify.
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
# General configuration
|
||||
syslog=no
|
||||
pid=/run/ddclient/ddclient.pid
|
||||
cache=/var/lib/ddclient/ddclient.cache
|
||||
usev4=webv4
|
||||
|
||||
# Provider definition using credentials decrypted at runtime
|
||||
protocol=dyndns2
|
||||
server=api.dynu.com
|
||||
login=@dynu_user@
|
||||
password=@dynu_password@
|
||||
@dynu_domain@
|
||||
@@ -1,92 +0,0 @@
|
||||
# 🌐 Dynu DDNS IP Monitor & Updater Service
|
||||
# This NixOS module configures a smart, local-first IP change detector.
|
||||
# It queries public IP providers, maintains a history log of WAN IP rotations,
|
||||
# and triggers ddclient only when an actual change is detected to prevent API rate limits.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
# Declaratively read the external Python script into the Nix store at evaluation time
|
||||
ipMonitorScript = pkgs.writers.writePython3Bin "dynu-ip-monitor" { } (builtins.readFile ./monitor.py);
|
||||
in
|
||||
{
|
||||
# 1. Load the encrypted secrets file
|
||||
sops.defaultSopsFile = ./secrets.yaml;
|
||||
sops.defaultSopsFormat = "yaml";
|
||||
|
||||
# Define the keys to decrypt
|
||||
sops.secrets.dynu_user = { };
|
||||
sops.secrets.dynu_domain = { };
|
||||
sops.secrets.dynu_password = { };
|
||||
sops.secrets.pdf_decrypt_password = {
|
||||
owner = "kiskaadee";
|
||||
};
|
||||
|
||||
# Assemble the ddclient config file securely at boot time in /run/secrets/
|
||||
# Defaults to owner root:root (which avoids dynamic user evaluation issues)
|
||||
sops.templates."ddclient.conf" = {
|
||||
content = builtins.replaceStrings
|
||||
[ "@dynu_user@" "@dynu_password@" "@dynu_domain@" ]
|
||||
[
|
||||
config.sops.placeholder.dynu_user
|
||||
config.sops.placeholder.dynu_password
|
||||
config.sops.placeholder.dynu_domain
|
||||
]
|
||||
(builtins.readFile ./ddclient.conf);
|
||||
};
|
||||
|
||||
# 2. Enable ddclient and feed it the decrypted configuration template via systemd credentials
|
||||
services.ddclient = {
|
||||
enable = true;
|
||||
configFile = "/run/credentials/ddclient.service/ddclient.conf";
|
||||
};
|
||||
|
||||
systemd.services.ddclient = {
|
||||
serviceConfig = {
|
||||
# Securely load the root-owned secret file into the dynamic ddclient service
|
||||
LoadCredential = [ "ddclient.conf:${config.sops.templates."ddclient.conf".path}" ];
|
||||
};
|
||||
};
|
||||
|
||||
# 3. Disable ddclient's automatic timer.
|
||||
# This stops ddclient from polling every 10 minutes on its own.
|
||||
systemd.timers.ddclient.enable = false;
|
||||
|
||||
# 4. Define the smart IP change detector service
|
||||
systemd.services.dynu-monitor = {
|
||||
description = "Dynu DDNS Smart IP Change Monitor";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
path = with pkgs; [
|
||||
systemd # Required for systemctl
|
||||
];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
Group = "root";
|
||||
StateDirectory = "dynu";
|
||||
Environment = "HISTORY_FILE=/var/lib/dynu/ip_history.jsonl";
|
||||
ExecStart = "${ipMonitorScript}/bin/dynu-ip-monitor";
|
||||
TimeoutSec = 30;
|
||||
|
||||
# Hardening
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
ReadWritePaths = "/var/lib/dynu";
|
||||
};
|
||||
};
|
||||
|
||||
# 5. Run the smart IP change monitor periodically (every 30 minutes)
|
||||
systemd.timers.dynu-monitor = {
|
||||
description = "Run Dynu IP monitor periodically";
|
||||
timerConfig = {
|
||||
OnBootSec = "5min";
|
||||
OnUnitActiveSec = "30min";
|
||||
AccuracySec = "1min";
|
||||
Persistent = true;
|
||||
};
|
||||
wantedBy = [ "timers.target" ];
|
||||
};
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usbhid" ];
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/mapper/nixos_vg-root";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/66E6-7442";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
|
||||
fileSystems."/media" =
|
||||
{ device = "/dev/mapper/nixos_vg-media";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/home" =
|
||||
{ device = "/dev/mapper/nixos_vg-home";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
# 🏠 Server Host-Specific Home Manager Configuration
|
||||
# Pure CLI environment for headless server operation.
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Server CLI packages
|
||||
home.packages = with pkgs; [
|
||||
htop
|
||||
iotop
|
||||
iftop
|
||||
ncdu
|
||||
];
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
# 🌐 Homeserver Core Environment Secrets & Systemd service configuration
|
||||
# This NixOS module manages secrets and the systemd lifecycle for the core homeserver stack.
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# 1. Load the encrypted secrets file
|
||||
sops.defaultSopsFile = ./secrets.yaml;
|
||||
sops.defaultSopsFormat = "yaml";
|
||||
|
||||
# Define the keys to decrypt from secrets.yaml
|
||||
sops.secrets = lib.genAttrs [
|
||||
"dynu_api_key"
|
||||
"acme_email"
|
||||
"authelia_session_secret"
|
||||
"authelia_storage_encryption_key"
|
||||
"authelia_identity_validation_reset_password_jwt_secret"
|
||||
"authelia_user_kiskaadee_password_hash"
|
||||
] (name: { owner = "kiskaadee"; });
|
||||
|
||||
# 2. Generate the unified environment file at runtime in /run/secrets/homeserver.env
|
||||
sops.templates."homeserver.env" = {
|
||||
owner = "kiskaadee";
|
||||
content = lib.generators.toKeyValue {} {
|
||||
DOMAIN = "roadtotech.me";
|
||||
DOCKER_API_VERSION = "1.40";
|
||||
DYNU_API_KEY = config.sops.placeholder.dynu_api_key;
|
||||
ACME_EMAIL = config.sops.placeholder.acme_email;
|
||||
AUTHELIA_SESSION_SECRET = config.sops.placeholder.authelia_session_secret;
|
||||
AUTHELIA_STORAGE_ENCRYPTION_KEY = config.sops.placeholder.authelia_storage_encryption_key;
|
||||
AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET = config.sops.placeholder.authelia_identity_validation_reset_password_jwt_secret;
|
||||
};
|
||||
};
|
||||
|
||||
# Generate the declarative Authelia user database file at runtime in /run/secrets/users.yml
|
||||
sops.templates."users.yml" = {
|
||||
owner = "kiskaadee";
|
||||
content = ''
|
||||
users:
|
||||
kiskaadee:
|
||||
displayname: "Kiskaadee"
|
||||
password: "${config.sops.placeholder.authelia_user_kiskaadee_password_hash}"
|
||||
email: "fcortesbio@gmail.com"
|
||||
groups:
|
||||
- admins
|
||||
- dev
|
||||
'';
|
||||
};
|
||||
|
||||
# 3. Define the declarative systemd service to manage the homeserver container stack
|
||||
systemd.services.homeserver-core = {
|
||||
description = "Homeserver Core Stack (Traefik, Authelia, Homepage, etc.)";
|
||||
after = [ "network-online.target" "docker.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
WorkingDirectory = "/home/kiskaadee/Core";
|
||||
ExecStart = "${pkgs.docker-compose}/bin/docker-compose --env-file ${config.sops.templates."homeserver.env".path} up -d --remove-orphans";
|
||||
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
|
||||
};
|
||||
};
|
||||
|
||||
# 4. Open ports in the firewall for Traefik and Gitea SSH
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 2223 ];
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
"""
|
||||
Dynu DDNS Smart IP Change Monitor and Updater.
|
||||
|
||||
This script determines the current public IPv4 address by querying multiple
|
||||
external resolvers sequentially. It compares the discovered IP against the last
|
||||
recorded successful IP in a local history log. If a change is detected, it
|
||||
triggers the `ddclient.service` on-demand to perform the DNS record update.
|
||||
|
||||
This local-first state verification prevents making redundant API requests to
|
||||
the DNS provider, avoiding rate-limiting, IP bans, or API abuse flags.
|
||||
"""
|
||||
|
||||
import urllib.request
|
||||
import re
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
# History file location storing the transition log of public IP states.
|
||||
# Defaults to a state directory managed securely by the systemd service unit.
|
||||
HISTORY_FILE = os.environ.get("HISTORY_FILE", "/var/lib/dynu/ip_history.jsonl")
|
||||
|
||||
# Fallback sequence of external services to discover the public WAN IP.
|
||||
PROVIDERS = [
|
||||
"https://api.ipify.org",
|
||||
"https://ifconfig.me/ip",
|
||||
"https://icanhazip.com",
|
||||
"https://wtfismyip.com/text"
|
||||
]
|
||||
|
||||
|
||||
def is_valid_public_ipv4(ip):
|
||||
"""
|
||||
Validates that a string is a properly formatted public IPv4 address.
|
||||
|
||||
This function excludes standard private, loopback, link-local, and CGNAT
|
||||
blocks to avoid recording temporary, local, or invalid network states.
|
||||
"""
|
||||
match = re.match(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$", ip)
|
||||
if not match:
|
||||
return False
|
||||
octets = [int(x) for x in match.groups()]
|
||||
if any(x > 255 for x in octets):
|
||||
return False
|
||||
a, b, c, d = octets
|
||||
|
||||
# RFC 1918 Private ranges: 10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12
|
||||
if a == 10:
|
||||
return False
|
||||
if a == 192 and b == 168:
|
||||
return False
|
||||
if a == 172 and 16 <= b <= 31:
|
||||
return False
|
||||
|
||||
# Carrier-Grade NAT (CGNAT) RFC 6598: 100.64.0.0/10
|
||||
if a == 100 and 64 <= b <= 127:
|
||||
return False
|
||||
|
||||
# Loopback address range: 127.0.0.0/8
|
||||
if a == 127:
|
||||
return False
|
||||
|
||||
# Link-local addresses: 169.254.0.0/16
|
||||
if a == 169 and b == 254:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def get_public_ip():
|
||||
"""
|
||||
Queries public IP providers until a valid public IPv4 is returned.
|
||||
|
||||
Returns:
|
||||
str: The validated public IP string, or None if all providers fail.
|
||||
"""
|
||||
errors = []
|
||||
for provider in PROVIDERS:
|
||||
try:
|
||||
req = urllib.request.Request(
|
||||
provider,
|
||||
headers={
|
||||
'User-Agent': 'Mozilla/5.0 (NixOS WAN Monitor)'
|
||||
}
|
||||
)
|
||||
# Fetch with 5s timeout to avoid hanging the systemd service
|
||||
with urllib.request.urlopen(req, timeout=5) as response:
|
||||
ip = response.read().decode('utf-8').strip()
|
||||
if is_valid_public_ipv4(ip):
|
||||
return ip
|
||||
else:
|
||||
errors.append(f"{provider}: invalid public IPv4 '{ip}'")
|
||||
except Exception as e:
|
||||
errors.append(f"{provider}: {str(e)}")
|
||||
|
||||
print(
|
||||
f"Error: All IP discovery providers failed. Details: {errors}",
|
||||
file=sys.stderr
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
def get_last_recorded_ip():
|
||||
"""
|
||||
Reads the history log to locate the last successful IP address.
|
||||
|
||||
Returns:
|
||||
str: The last successfully updated IP, or None if no log exists yet.
|
||||
"""
|
||||
if not os.path.exists(HISTORY_FILE):
|
||||
return None
|
||||
try:
|
||||
with open(HISTORY_FILE, "r") as f:
|
||||
lines = f.readlines()
|
||||
if not lines:
|
||||
return None
|
||||
# Search backwards to find the most recent successful transition
|
||||
for line in reversed(lines):
|
||||
try:
|
||||
entry = json.loads(line)
|
||||
if entry.get("status") == "success":
|
||||
return entry.get("ip")
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
except Exception as e:
|
||||
print(f"Warning: Failed to read history file: {e}", file=sys.stderr)
|
||||
return None
|
||||
|
||||
|
||||
def record_ip(ip, status, details=None):
|
||||
"""
|
||||
Appends a new event entry into the JSONLines history registry.
|
||||
"""
|
||||
os.makedirs(os.path.dirname(HISTORY_FILE), exist_ok=True)
|
||||
entry = {
|
||||
"timestamp": datetime.utcnow().isoformat() + "Z",
|
||||
"ip": ip,
|
||||
"status": status
|
||||
}
|
||||
if details:
|
||||
entry["details"] = details
|
||||
try:
|
||||
with open(HISTORY_FILE, "a") as f:
|
||||
f.write(json.dumps(entry) + "\n")
|
||||
except Exception as e:
|
||||
print(f"Error: Failed to write to history file: {e}", file=sys.stderr)
|
||||
|
||||
|
||||
def trigger_ddclient():
|
||||
"""
|
||||
Invokes the systemd service unit for `ddclient` on-demand.
|
||||
|
||||
Returns:
|
||||
tuple: (bool, str) representing (success_boolean, error_details_string)
|
||||
"""
|
||||
try:
|
||||
# Run ddclient as a one-shot activation via systemd to perform API call
|
||||
res = subprocess.run(
|
||||
["systemctl", "start", "ddclient.service"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
if res.returncode == 0:
|
||||
return True, None
|
||||
else:
|
||||
err_msg = (
|
||||
f"systemctl exited with {res.returncode}: "
|
||||
f"{res.stderr.strip()}"
|
||||
)
|
||||
return False, err_msg
|
||||
except Exception as e:
|
||||
return False, str(e)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Orchestrator logic for DDNS state management.
|
||||
"""
|
||||
current_ip = get_public_ip()
|
||||
if not current_ip:
|
||||
sys.exit(1)
|
||||
|
||||
last_ip = get_last_recorded_ip()
|
||||
if current_ip == last_ip:
|
||||
# IP matches last recorded working IP; do nothing to conserve quota
|
||||
sys.exit(0)
|
||||
|
||||
print(f"IP rotation detected! Old: {last_ip}, New: {current_ip}")
|
||||
|
||||
# Trigger ddclient to perform the DNS record update
|
||||
success, error_msg = trigger_ddclient()
|
||||
if success:
|
||||
print("Dynu DDNS update via ddclient triggered successfully.")
|
||||
record_ip(current_ip, "success")
|
||||
else:
|
||||
err_msg = f"Error: Failed to trigger ddclient update: {error_msg}"
|
||||
print(err_msg, file=sys.stderr)
|
||||
record_ip(current_ip, "failed_update", details=error_msg)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,43 +0,0 @@
|
||||
gh_repo_token: ENC[AES256_GCM,data:KhjkHZ6DgpOX2uBOPL1gEP/A0el7ThheNnMZzuItWMxORSNp/0RScw==,iv:Lqutj5o+YmQT5UzVc5Jb4wb23xx39BjYOqhEhVwWEO4=,tag:J50S36WWc+ZwHj15IcrRFg==,type:str]
|
||||
dynu_user: ENC[AES256_GCM,data:wDnJP2jHasV4,iv:7yk+J9tO9yqwe3POjFUTkP10I0gp1eEEQPvs4SJzBd0=,tag:98+v/rJGrTDTrxAQqhVomA==,type:str]
|
||||
dynu_domain: ENC[AES256_GCM,data:3m2kTOriCfg+OUOLkA==,iv:jbWVHQETVDV/mWnEWrwXzpo+BAwzZkA5WB//rSeoxNs=,tag:psP9jmzVkKfD3Cgjxa0Szg==,type:str]
|
||||
dynu_password: ENC[AES256_GCM,data:F+YtoH6rJov2tgDdrIBGQ99b66PfJhUH0rybYhiF9ck=,iv:3o7vaYT8lNwn0fDt3opHtg5OGKkSxF8RkONTbFGe6Hw=,tag:T5EnMSwGHwAtfK1mS6FvMQ==,type:str]
|
||||
dynu_api_key: ENC[AES256_GCM,data:4v2mHY8gXIYfiEDjTcDYxhVXc5Lb/szA40oLOvwltGE=,iv:cq7pYGmN7lIWQYG5x+kaoH3GbdAb7MEufdHEMwaeFnA=,tag:sUTgBFcMGRMFgDzgDobsKw==,type:str]
|
||||
pdf_decrypt_password: ENC[AES256_GCM,data:8lh3pW2rMFs9AA==,iv:4+e0urvjYmdZ4/c0KcD7v9Ps8nKvopdYquwaMlYi2xQ=,tag:XHUESw6g1h1tR4EHrD4SaQ==,type:str]
|
||||
learning_turso_db_url: ENC[AES256_GCM,data:yV3wJI7Y5kymKjaWZ7i2Ywm7N3vSMO2ApJZALJbGVxsyIs77Z336Rljvf90hbuaTKnY=,iv:Bx2m1NpDDRU2lhiwRRlEZrhFzpNqMCDx4bbfHK63Fl8=,tag:xC7OeNC6+4Zk+IZxozWqgQ==,type:str]
|
||||
learning_turso_auth_token: ENC[AES256_GCM,data:1fl1kIEw7Z/Xv4ilMRZIt8/ei42O7KSg/yjBs5sxTYVaLrC3GNsngXuTClti8x3AjNsVN39uK2fLI8pUjGb60u07448SlByeBRQkodX/PX7WycaRl3IJ+FlaZJ/DijK2L3AEvOlECs/0PGr7hkgnVnjjg9c2YK+mJuT3xqY5DPytMU7f4nMFM/o63qNffB/N+WtxMsrD5izsawe95Bf6YQvpH+ue4qNn+ZIFmu/MRdCEsLjIRT4rbG76G6iIbLCT2Hr3W1hrzrCPcJ1KvLsAeT97iyNvfDdEWIdpv3DWS8jptS/G9Xvd2xJ8FWkbulZYpHLcjs4nNI0vKULi8VRfJYLYWqZ0gjNb+lkrYt6QgD13VWoC5X/H,iv:sc7Ppa5Jbrnhw97OSMSBQUrnYPH9rJfo+QzeNCbwtIM=,tag:v3AAGyqW9ahXL+dnmDr8BA==,type:str]
|
||||
mongo_root_username: ENC[AES256_GCM,data:9jIpJnClrLAc,iv:ZtOwIUdXZoY4168YWTCE1Vcz+fek1YHRsAAyFbgkU64=,tag:WmtiJ1sdeFSQxHz5k5I2dQ==,type:str]
|
||||
mongo_root_password: ENC[AES256_GCM,data:fbtY9aMXhd8D4TL6s7Ce,iv:xXckK6Sbg1PB+1Cifq6WkHtIk9FMgZ3Yf2HdjxPO6vU=,tag:bmyC2dv+QAaoOff+ejw2/g==,type:str]
|
||||
ollama_api_key: ENC[AES256_GCM,data:1vw8FayOxXv3kfy5xcUy,iv:2zgPy1GUfPtPCyFgtED0R6cPPFJmDdhDbVA+jnomG/k=,tag:3HOdQll25oMPx3jg7Mbrdg==,type:str]
|
||||
postgres_user: ENC[AES256_GCM,data:81MBXlhjMgKd,iv:54hTY9wtxy16iB/P2QqRsIgdJZyLWYdjaWUqVQFOd74=,tag:Z/idYinY3lB1THGqG7UWAA==,type:str]
|
||||
postgres_password: ENC[AES256_GCM,data:U2ttYoopG/Uc8HrX3kKq,iv:5pUV00FPcVtKsAx2M3HSUXxRhEXFZWWt9O97CRhKrkM=,tag:ZzbB3Ggu45sylveJcfqStw==,type:str]
|
||||
postgres_db: ENC[AES256_GCM,data:DJCXJz4SSjcETw==,iv:pM2UfxK8yOL8XxbAZY6XQyNKVPRrrGwjxtM8F3XOCU0=,tag:DcCu/9L4pz7WAkF8WkKzCA==,type:str]
|
||||
acme_email: ENC[AES256_GCM,data:nQwu6pSUVGwkoq3wvY1wKNMMvis=,iv:jDY32yCLQCruelmeZ1DaeFPoxMyM4/+Mpt6g5rsYrO8=,tag:ROcVL+/2zCzF8fId6MSlrg==,type:str]
|
||||
authelia_session_secret: ENC[AES256_GCM,data:sz99LUaspa4PyTZb0ukBPKZ5uQoomEiDZ/+IxU9OxzLhBysZChTZ7nIMAmxnffbT6dHuWE3cvGntKAAOqx7DKpTOkk/YFZk31Z1FfYZ59csrIW9LChWc7EeM21SzS9Z+1jU9Zo5PBsK93X7E1m9OTKtinCwivb+hLa6AVpmdOm4=,iv:V+oxP22Nm3DyY6/SA61SrQoVwraixlM8RANQ9wejFnI=,tag:8bAuoJ6jkg5hsrzMna23vQ==,type:str]
|
||||
authelia_storage_encryption_key: ENC[AES256_GCM,data:f/pHK6GORv8iHiQbDvybi/KShoKl9b3NJbfW6m8iBK4X0A9n9UiYj+LBRFY79xs78YvYj/fDROaWN1fQM6nXJf+HsUqZ7/V3cIfk8eQdYto1mVI53VByIAEURQopnb9/+ypAN61YnCwkL2CEm0ID/sOmbLVO/aQmK7ccuN9CP2I=,iv:BcoAkOdR/gGoiiP+KJNa0H/9rXpfZf2h8dT0sw5o9pU=,tag:DsPWeWABjZVvDHC5dE1XDA==,type:str]
|
||||
authelia_identity_validation_reset_password_jwt_secret: ENC[AES256_GCM,data:HNK2JEBHQBWuNnuqiqyhbk3NOoRhV40C4H+aM7kbFl+Ag1u0Vh4yafpQuyhzBH/e2jb3KDDu12m/7u2jv8bTLFhlp3b91KeKLz4c1sVoMNRzGYzIyynx42KYutaFLH42sBVgOQ/sCw1ug+Plt2bGFMK20PODdNzFELStvk4qH1Q=,iv:6nqNlshXJoemh97LlpUCp2t/AmXmxzufzjRZYEJzGXc=,tag:ATA3lP2hQl+jFFUERIayTw==,type:str]
|
||||
authelia_user_kiskaadee_password_hash: ENC[AES256_GCM,data:ZJvq9ocETSzIl3RH9Qg0Ls4p+9QCD1/e+g1uzpAKs6HZk0AjKtCrUtqxEUjqbPi3W9ymsXQzkurtfYRw47lqsom5yGoyW6Q1Tq19crCqibgn4DHc0XGp1uoIvtxUkDSijg==,iv:rsP/z/fwhJhJs7hH0Qx3ry7K++tmEiWke2MwNULHKWg=,tag:vA7cRip2+Y7ALPL/Kqo3uQ==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBBKzVPdHc2MHJQMTJGN3hN
|
||||
L3puWlVJTEU2OXVhOTl4WGhTbm5iNmlINDJ3ClBubThRWFpJMCtOeEFUeGJyQzkw
|
||||
cGh4YklHM3NlSkp5TDR5dmtuVUwvK2sKLS0tIFF5M1JYWjRSeW1nVytuY1lnaTBa
|
||||
NldSTzNTN1NUcllxQ1gxeVF6NGladHMKfpxCOTT2XmMtyewi6TDW3hYeKKc6D84/
|
||||
wFrmN0Q4nZzJ3+v9+rQ8Q/w36zaTEgrCE/B7+/swhzaVUOOFY7Cd2w==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age18q3lr2z4yeg2f86my42ym4hx0dvcwgjshmchyhdkgwvf4k37dsyq3mcjse
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBseXFpMlRvdEFzb25IM3VV
|
||||
Mjc1Y3hvNVRyRUhzaXRiM3RnRGhja0Zwbm5BCmUwRU1iMjRPZzBNYzd3djkrZk9Q
|
||||
NHR0bEYwTFRDK2F3MlZkdlN3NWxLcVEKLS0tIFRaWVN4akZWSUw5eU9zbjJEZnl1
|
||||
MDV5R2dzSzdTdVRGU3BnaHo4UlpPTnMKrfzwd8jHt3QQDlbKT2D8+yViNdVrtown
|
||||
ZhaE25Ltp0SVX3/ZpmXtvNktmBQHvTLYwtm8a7SC5knBcqhOQJ+1Ow==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg
|
||||
lastmodified: "2026-09-08T19:20:50Z"
|
||||
mac: ENC[AES256_GCM,data:TD0nq9+2SCHyXHMJmVKF/hWyZz/GHb+7DBrbkFf02fOgeltWreahYig2hV0FMTZLV9cm49GWBdYRYZXDyNvBNaixGu6ylJKpz0t5PG9uSinh4PGLV8HK6RFlFZ757Et22FSfWowerxgWLmJC+WUfqVRR+4KJWsMV1r2zrs443v4=,iv:WSSOXOVporZERqiueQaucYwUcen0PTWNenQJC0CzTO8=,tag:mAqTnAexg1F0y4Hcq8f6ug==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
@@ -1,97 +0,0 @@
|
||||
# 🌐 Traefik Deployments Environment Secrets configuration
|
||||
# This NixOS module manages secrets and environment variables for the unified apps in /traefik-deployments
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Load the encrypted secrets file
|
||||
sops.defaultSopsFile = ./secrets.yaml;
|
||||
sops.defaultSopsFormat = "yaml";
|
||||
|
||||
# Define the keys to decrypt from secrets.yaml (avoiding repeating the owner boilerplate)
|
||||
sops.secrets = lib.genAttrs [
|
||||
"learning_turso_db_url"
|
||||
"learning_turso_auth_token"
|
||||
"mongo_root_username"
|
||||
"mongo_root_password"
|
||||
"ollama_api_key"
|
||||
"postgres_user"
|
||||
"postgres_password"
|
||||
"postgres_db"
|
||||
] (name: { owner = "kiskaadee"; });
|
||||
|
||||
# Generate the unified environment file at runtime in /run/secrets/traefik-deployments.env
|
||||
sops.templates."traefik-deployments.env" = {
|
||||
owner = "kiskaadee";
|
||||
content = lib.generators.toKeyValue {} {
|
||||
# --- Core / Infrastructure Settings ---
|
||||
PROXY_NETWORK = "proxy-net";
|
||||
CERT_RESOLVER = "myresolver";
|
||||
DOMAIN_SUFFIX = "roadtotech.me";
|
||||
|
||||
# --- Dashboard & Landing ---
|
||||
DASHBOARD_DOMAIN = "dashboard.roadtotech.me";
|
||||
LANDING_DOMAIN = "roadtotech.me";
|
||||
|
||||
# --- Docs ---
|
||||
DOCS_DOMAIN = "docs.roadtotech.me";
|
||||
DOCS_PROJECT_PATH = "/home/kiskaadee/Brain";
|
||||
|
||||
# --- Excalidraw ---
|
||||
EXCALIDRAW_DOMAIN = "excalidraw.roadtotech.me";
|
||||
|
||||
# --- Gitea ---
|
||||
GITEA_DOMAIN = "gitea.roadtotech.me";
|
||||
GITEA_SSH_DOMAIN = "gitea.roadtotech.me";
|
||||
GITEA_SSH_PORT = "2223";
|
||||
GITEA_AUTH_MIDDLEWARE = "https-redirect@docker";
|
||||
|
||||
# --- Jellyfin ---
|
||||
JELLYFIN_SERVICE_NAME = "jellyfin";
|
||||
JELLYFIN_CONTAINER_NAME = "jellyfin";
|
||||
JELLYFIN_IMAGE_TAG = "latest";
|
||||
JELLYFIN_DOMAIN = "jellyfin.roadtotech.me";
|
||||
JELLYFIN_TZ = "UTC";
|
||||
JELLYFIN_PUID = "1000";
|
||||
JELLYFIN_PGID = "1000";
|
||||
JELLYFIN_MEDIA_PATH = "/media";
|
||||
JELLYFIN_HTTP_ENTRYPOINT = "web";
|
||||
JELLYFIN_HTTPS_ENTRYPOINT = "websecure";
|
||||
JELLYFIN_RATE_LIMIT_AVG = "100";
|
||||
JELLYFIN_RATE_LIMIT_BURST = "50";
|
||||
|
||||
# --- Learning Dashboard ---
|
||||
LEARNING_SERVICE_NAME = "learning-hub";
|
||||
LEARNING_DOMAIN = "learning.roadtotech.me";
|
||||
LEARNING_APP_PORT = "8000";
|
||||
LEARNING_SOCKET_PROXY_NETWORK = "socket-net";
|
||||
LEARNING_DOCKER_HOST = "tcp://socket-proxy:2375";
|
||||
TURSO_DATABASE_URL = config.sops.placeholder.learning_turso_db_url;
|
||||
TURSO_AUTH_TOKEN = config.sops.placeholder.learning_turso_auth_token;
|
||||
|
||||
# --- Mermaid ---
|
||||
MERMAID_DOMAIN = "mermaid.roadtotech.me";
|
||||
MERMAID_SERVICE_NAME = "mermaid";
|
||||
|
||||
# --- Minecraft ---
|
||||
MINECRAFT_DOMAIN = "minecraft.roadtotech.me";
|
||||
|
||||
# --- MongoDB ---
|
||||
MONGO_ROOT_USERNAME = config.sops.placeholder.mongo_root_username;
|
||||
MONGO_ROOT_PASSWORD = config.sops.placeholder.mongo_root_password;
|
||||
MONGO_DOMAIN = "mongodb.roadtotech.me";
|
||||
|
||||
# --- PostgreSQL ---
|
||||
POSTGRES_USER = config.sops.placeholder.postgres_user;
|
||||
POSTGRES_PASSWORD = config.sops.placeholder.postgres_password;
|
||||
POSTGRES_DB = config.sops.placeholder.postgres_db;
|
||||
POSTGRES_DOMAIN = "pgsql.roadtotech.me";
|
||||
|
||||
# --- Ollama ---
|
||||
OLLAMA_DOMAIN = "ollama.roadtotech.me";
|
||||
OLLAMA_API_KEY = config.sops.placeholder.ollama_api_key;
|
||||
OLLAMA_REPLICAS = "1";
|
||||
OLLAMA_DATA_VOLUME = "ollama_data";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
# ⚙️ Hardware-Agnostic Base System Configuration
|
||||
# This file contains common system configurations shared by all machines (desktop, laptop).
|
||||
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# Regional and Language settings
|
||||
time.timeZone = "America/Bogota";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
# Allow installation of unfree packages (e.g., Obsidian)
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Enable network management daemon
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# Enable virtualisation / Docker container daemon
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
# Sound daemon configuration using modern Pipewire backend
|
||||
services.pipewire = {
|
||||
enable = true;
|
||||
pulse.enable = true; # Enable legacy PulseAudio emulation wrapper
|
||||
};
|
||||
|
||||
# 🖨️ Printing & Scanning configuration (with Epson drivers & Avahi network discovery)
|
||||
services.printing = {
|
||||
enable = true;
|
||||
drivers = with pkgs; [
|
||||
epson-escpr
|
||||
epson-escpr2
|
||||
gutenprint
|
||||
gutenprintBin
|
||||
];
|
||||
};
|
||||
|
||||
# Enable mDNS / Zeroconf discovery for Wi-Fi printers
|
||||
services.avahi = {
|
||||
enable = true;
|
||||
nssmdns4 = true;
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
# SANE scanner support (includes Epson scanner backend)
|
||||
hardware.sane = {
|
||||
enable = true;
|
||||
extraBackends = [ pkgs.epsonscan2 ];
|
||||
};
|
||||
|
||||
# System-wide packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
cups-pk-helper
|
||||
system-config-printer
|
||||
simple-scan
|
||||
rclone
|
||||
sops
|
||||
age
|
||||
];
|
||||
|
||||
# SSH daemon settings for secure remote command execution
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
ports = [ 22 ];
|
||||
settings.PermitRootLogin = "no"; # Security: disable root ssh login
|
||||
};
|
||||
|
||||
# 📶 Bluetooth Configuration
|
||||
hardware.bluetooth = {
|
||||
enable = true;
|
||||
powerOnBoot = true; # Automatically power on the Bluetooth adapter at boot
|
||||
};
|
||||
services.blueman.enable = true; # Enable Blueman DBus/Applet service integrations
|
||||
|
||||
# 🚪 Greetd base configuration
|
||||
services.greetd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
default_session = {
|
||||
user = "kiskaadee";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Clean boot configuration for the greeter
|
||||
# Suppresses systemd diagnostic messages on tty1 so the greeter loads cleanly.
|
||||
systemd.services.greetd.serviceConfig = {
|
||||
Type = "idle";
|
||||
StandardInput = "tty";
|
||||
StandardOutput = "tty";
|
||||
StandardError = "journal";
|
||||
TTYReset = true;
|
||||
TTYVHangup = true;
|
||||
TTYVTDisallocate = true;
|
||||
};
|
||||
|
||||
# Global environment variables
|
||||
# NIXOS_OZONE_WL forces Electron / Chromium applications (like Discord or VSCode)
|
||||
# to natively execute under Wayland instead of fallback XWayland.
|
||||
environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
# 🎨 Graphical Environment System Module
|
||||
# Configures system-wide services and integrations for DankMaterialShell (DMS).
|
||||
|
||||
{inputs, pkgs, ...}:
|
||||
|
||||
{
|
||||
# Configure the DMS graphical helper/shell service daemon.
|
||||
# DMS handles background management, panels, and notifications.
|
||||
programs.dms-shell = {
|
||||
enable = true;
|
||||
|
||||
# Override standard nixpkgs package binary with the bleeding-edge flake output.
|
||||
package = inputs.dms.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||
|
||||
# Run the DMS daemon as a Systemd user service.
|
||||
# Automatically restarts the daemon whenever the NixOS configuration changes.
|
||||
systemd.enable = true;
|
||||
systemd.restartIfChanged = true;
|
||||
|
||||
# DMS System Options
|
||||
# Refer to documentation: https://danklinux.com/docs/dgop/
|
||||
enableSystemMonitoring = true; # Enables daemon hooks for gathering memory, CPU, and disk metrics
|
||||
enableDynamicTheming = true; # Automatically applies system-wide material palettes to shells and apps
|
||||
enableClipboardPaste = true; # Bridges terminal and Wayland clipboard buffers seamlessly
|
||||
};
|
||||
|
||||
# 🚪 Dank Material Shell Greeter (dank-greeter + greetd)
|
||||
# Uses niri as the compositor for rendering the login screen
|
||||
programs.dms-greeter = {
|
||||
enable = true;
|
||||
compositor.name = "niri";
|
||||
configHome = "/home/kiskaadee";
|
||||
};
|
||||
|
||||
# 📅 DankCalendar Daemon & UI
|
||||
# Provides calendar integration (Local, CalDAV, Google, Microsoft) for DMS
|
||||
programs.dank-calendar = {
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
systemd.target = "graphical-session.target";
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
{ inputs, pkgs, ... }:
|
||||
|
||||
let
|
||||
# Declaratively compile scripts as user utility packages using writeScriptBin
|
||||
bundleProject = pkgs.writeScriptBin "bundle-project" (builtins.readFile ./scripts/bundle_project.py);
|
||||
recordScript = pkgs.writeScriptBin "record" (builtins.readFile ./scripts/record.sh);
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
# Custom Flake injections: Google Antigravity CLI helper
|
||||
inputs.antigravity.packages.${pkgs.stdenv.hostPlatform.system}.google-antigravity-cli
|
||||
|
||||
# Local CLI & Workflow utilities
|
||||
bundleProject
|
||||
recordScript
|
||||
|
||||
# Media, Note-taking & Graphical Tools
|
||||
mpv # Fast, scriptable, keyboard-driven CLI media player
|
||||
gimp # GNU Image Manipulation Program for graphical assets
|
||||
imagemagick # Software suite to create, edit, compose, or convert bitmap images
|
||||
eyed3 # CLI tool and Python library for working with ID3 tags
|
||||
nautilus # Clean, modern GTK4 graphical file manager for GNOME
|
||||
yazi # Blazing fast console file manager written in Rust
|
||||
obsidian # Markdown-based personal knowledge wiki and note-taking app
|
||||
libreoffice # Comprehensive open-source office suite (Writer, Calc, Impress, Draw)
|
||||
|
||||
# Cloud CLI, Git Forge & Database Management
|
||||
tea # Gitea official command line client
|
||||
google-cloud-sdk # GCP administration utilities
|
||||
turso-cli # Management interface for Turso libSQL cloud databases
|
||||
postgresql # PostgreSQL client utilities (psql, pg_dump)
|
||||
pgcli # Command-line client for Postgres with auto-completion
|
||||
wget # Standard network file downloader
|
||||
zip # File archiving utility
|
||||
unzip # Extraction utility for .zip files
|
||||
unrar # Extraction utility for .rar files
|
||||
rsync # Efficient incremental file transfer tool
|
||||
aria2 # High-speed multi-protocol download utility
|
||||
|
||||
# API Testing & Development
|
||||
httpie # CLI alternative to curl for REST APIs
|
||||
bruno # Open-source git-friendly GUI REST client
|
||||
websocat # Command-line client for WebSockets (like netcat for ws://)
|
||||
grpcurl # Command-line tool for interacting with gRPC servers
|
||||
|
||||
# Network Diagnostics & Scanning
|
||||
bind.dnsutils # DNS lookup utilities (dig, nslookup, nsupdate, delv)
|
||||
openssh # OpenSSH client and connectivity tools
|
||||
sshfs # FUSE-based filesystem client for mounting remote directories over SSH
|
||||
nmap # Network exploration tool and security / port scanner
|
||||
arp-scan # Address Resolution Protocol packet scanner
|
||||
|
||||
# Python Tooling
|
||||
ruff # Extremely fast Python linter and formatter
|
||||
mypy # Static type checker for Python
|
||||
|
||||
# Rust Tooling
|
||||
cargo # Rust package manager
|
||||
rustc # Rust compiler
|
||||
rustfmt # Official Rust code formatter
|
||||
clippy # Official Rust linter
|
||||
rust-analyzer # Language server for IDE code intelligence
|
||||
gcc # GNU Compiler Collection (provides cc linker)
|
||||
|
||||
# Secrets Management
|
||||
rbw # Unofficial command line client for Bitwarden
|
||||
];
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
# 🖋️ Neovim CLI & IDE Editor Configuration
|
||||
# Shared across all host profiles (server, desktop, laptop).
|
||||
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true; # Make neovim the default `$EDITOR`
|
||||
viAlias = true; # Symlink `vi` to `nvim`
|
||||
vimAlias = true; # Symlink `vim` to `nvim`
|
||||
|
||||
## Core Editor Settings (Lua-based)
|
||||
initLua = builtins.readFile ./config/nvim/init.lua;
|
||||
|
||||
## Declarative Plugin Management
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# Color scheme loaded dynamically
|
||||
{
|
||||
plugin = catppuccin-nvim;
|
||||
type = "lua";
|
||||
config = builtins.readFile ./config/nvim/catppuccin.lua;
|
||||
}
|
||||
|
||||
# Advanced Syntax Highlighting for developer workflows (Python, Rust, Java, Nix, KDL)
|
||||
(nvim-treesitter.withPlugins (p: with p; [
|
||||
python
|
||||
rust
|
||||
nix
|
||||
lua
|
||||
java
|
||||
javascript
|
||||
typescript
|
||||
markdown
|
||||
kdl
|
||||
toml
|
||||
bash
|
||||
]))
|
||||
|
||||
# LSP Configuration & Language Servers
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
type = "lua";
|
||||
}
|
||||
|
||||
# DAP (Debug Adapter Protocol)
|
||||
{
|
||||
plugin = nvim-dap;
|
||||
}
|
||||
{
|
||||
plugin = nvim-dap-ui;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Declarative configuration files for Neovim (lsp.lua & dap.lua loaded dynamically via init.lua)
|
||||
home.file.".config/nvim/lsp.lua".source = ./config/nvim/lsp.lua;
|
||||
home.file.".config/nvim/dap.lua".source = ./config/nvim/dap.lua;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
# --- Word Deletion & Readline Keybindings ---
|
||||
if [[ -n "$BASH_VERSION" ]] && [[ "$-" == *i* ]]; then
|
||||
# Ctrl+W: Delete entire word under cursor (backward-word + kill-word)
|
||||
bind '"\C-w": "\eb\ed"' 2>/dev/null
|
||||
|
||||
# Ctrl+Delete: Forward word delete (matches Alacritty \e[3;5~)
|
||||
bind '"\e[3;5~": kill-word' 2>/dev/null
|
||||
|
||||
# Ctrl+Backspace / Alt+Backspace: Backward word delete (start to cursor)
|
||||
bind '"\e\x7f": backward-kill-word' 2>/dev/null
|
||||
bind '"\e\b": backward-kill-word' 2>/dev/null
|
||||
fi
|
||||
|
||||
# --- Visual Entry ---
|
||||
# Display system information dashboard upon opening interactive shells
|
||||
if [[ $- == *i* ]]; then
|
||||
fastfetch --logo none
|
||||
fi
|
||||
@@ -1,17 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
# Terminal Multiplexer (Tmux)
|
||||
# Allows maintaining persistent shell sessions, window splitting, and tabs.
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
extraConfig = builtins.readFile ./config/tmux.conf;
|
||||
};
|
||||
|
||||
# Cross-Shell Prompt (Starship)
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableBashIntegration = true; # Mount prompt configuration inside Bash shells
|
||||
settings = builtins.fromTOML (builtins.readFile ./config/starship.toml);
|
||||
};
|
||||
}
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# scripts/test - Automated test & invariant verification runner for Workstation Config
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
echo "🐚 Running ShellCheck across shell scripts..."
|
||||
find . -type f -name "*.sh" -not -path "./.git/*" -exec shellcheck -s bash {} +
|
||||
echo "✅ ShellCheck passed!"
|
||||
|
||||
echo "🌙 Checking Neovim Lua configuration (luacheck)..."
|
||||
if command -v luacheck &>/dev/null; then
|
||||
luacheck home/config/nvim --globals vim
|
||||
else
|
||||
nix-shell -p luaPackages.luacheck --run "luacheck home/config/nvim --globals vim"
|
||||
fi
|
||||
echo "✅ Lua checks passed!"
|
||||
|
||||
echo "🐍 Running Python linters & type analysis (Ruff & Pyright)..."
|
||||
if command -v ruff &>/dev/null && command -v pyright &>/dev/null; then
|
||||
ruff check --no-cache .
|
||||
ruff format --check .
|
||||
pyright .
|
||||
else
|
||||
nix-shell -p ruff pyright --run "ruff check --no-cache . && ruff format --check . && pyright ."
|
||||
fi
|
||||
echo "✅ Python checks passed!"
|
||||
|
||||
echo "❄️ Verifying NixOS flake & sandbox checks..."
|
||||
nix flake check -L
|
||||
|
||||
echo "✨ All checks and static analyses passed successfully!"
|
||||
@@ -0,0 +1,45 @@
|
||||
hello: ENC[AES256_GCM,data:oSNILLWbmrCgBOtDkn+HR0RyJRkI8HbPLzXyQrz/WO8+ekS0cpW46ybcw7sdzg==,iv:phN/JNw4X0wXdNlZCgZCoB+IW3S2MH0WERWM+ldCWog=,tag:QAmuj3dYOMH9uEWteU5Pgg==,type:str]
|
||||
example_key: ENC[AES256_GCM,data:RX50AQc6D7bXC5wfAw==,iv:9JeXuChb6OBy/VSOGLtpS/lpo4dQPuH2DHurUW43jT4=,tag:bbQS+CTbFgD7W7H/D41lBQ==,type:str]
|
||||
example_array:
|
||||
- ENC[AES256_GCM,data:ktZK7gXHOJhwCy9Wm10=,iv:FhC4o1MOBQr6ntaCIHXEkqUuLJ7Wx6iehqQl89L10SI=,tag:6a0H2oWrl06E/g9+PFNBvg==,type:str]
|
||||
- ENC[AES256_GCM,data:jmkTYzu8bac5zS6oWtM=,iv:JyJUfCntVrVifHJj/oqMLD7LvxS9X2zP+baD9zzTmVU=,tag:nuG7IR8BY91ONFl/Sc+OgA==,type:str]
|
||||
example_number: ENC[AES256_GCM,data:MlZBL1vRuOr6yw==,iv:BfdTRkJfwLFoiemLMsTItGLMQCv7O9mZ48pro+C6Big=,tag:95O4J/ebAEdwlIN1Uw1jEQ==,type:float]
|
||||
example_booleans:
|
||||
- ENC[AES256_GCM,data:Zcpsrg==,iv:kHoZxCs1GlGye9lHJzEo7KRtqMwYtj8YbMhWU3gH6yU=,tag:Gi0DLx9Wg3uR/MxiFT/8Nw==,type:bool]
|
||||
- ENC[AES256_GCM,data:Jnyq/0A=,iv:4ssfhoW8g4459tewk4BckRx7QwT5+vJsQl4ZgnahgMU=,tag:DaSJyPjpwMWSweigZhZ8DQ==,type:bool]
|
||||
github:
|
||||
gh_login_token: ENC[AES256_GCM,data:z89+EY5q0pWLTvl64heqKZ8iKgd0DeXyNTfnR2R7gsIGun0EaOXjOA==,iv:t+uduJFIIoTCo/QywYcFUSK5AwngS0WuCiSD0Ic6c3U=,tag:nACKzVlZsy3vRJIPDzkxDw==,type:str]
|
||||
gh_repo_token: ENC[AES256_GCM,data:STrQMWcGGi4WLnU52sPM3oJDpt7ttxMjGq8BM6JFR98n4He6QFfNaQ==,iv:G1naOIBKYlrDsP6/W867kQlCxZgrCTwx1uZZw+FUuE8=,tag:Z2C8/wmbsMhP5mIdmCoXag==,type:str]
|
||||
gitea:
|
||||
api_token: ENC[AES256_GCM,data:NiafimuiG2nDfcdybyI25NGt6pBfklfVb3G5MWUUhXKKJF3dDV0Ofw==,iv:qMdbxqZfQDvMkxsOEmQ7ZoQ3HTbSlmsRbaaSl/M8F3g=,tag:BIPDKHonpt/VBpLK21Qciw==,type:str]
|
||||
login_token: null
|
||||
runner_token: ENC[AES256_GCM,data:HrGHKQWCmkb008E5MaZfgcSGm4jVQZMRlOgPRc5V9w49Gzw2glMfeA==,iv:MfZCa4ixTAuIonZX10XVPjkSbWbfXDAbF/bK/E1eDgk=,tag:wsnXWy7kRuDsMSCrQyeHow==,type:str]
|
||||
cloudflare:
|
||||
account_name: ENC[AES256_GCM,data:G8e06ImdcZLV,iv:EOLE38zsrNrShd8jiQ6rsZ4eAFZ7RwZJfTEyw72LUzc=,tag:xo/RQt9MK/0DZL4u4DYkyA==,type:str]
|
||||
glob_api_key: ENC[AES256_GCM,data:sg43YThUiBEXk3S7afzEYLBTGESjDRtJOBHkPmRHqlrtASzxG5KH7cuozmS6k3S8mHCXHA==,iv:NtDW4930mML9vgz+1soXBU95IX8eMP98NVGHIllFRfE=,tag:kSLWY86hLC4k5lxVC0vEaw==,type:str]
|
||||
api_token: ENC[AES256_GCM,data:vlyxVVzZhzEw/3j2sL3lp1BX2TfuzNoV35EXbbxllEv/BAAfGqlQ9uXK2IMtbeXCNoBlhfw=,iv:uiGxP6vg3lXXKHS5EWs9GpXD+sOqgL3vnpA7AjcA4RY=,tag:EFj0hdBICeLuyO7aBIySxA==,type:str]
|
||||
account_id: ENC[AES256_GCM,data:7wLlngvwjIsB2OkDKpdAdigv3zaUjLFklCASDXztBK0=,iv:UDCIqypIC+CiU2l/B1QmibiLVtRlBYfetK6So14nv3E=,tag:UQx+TpW6q2PylBKaXZvGqw==,type:str]
|
||||
hostinger:
|
||||
api_token: ENC[AES256_GCM,data:Q0roDicxp5QrIZUs78/vwx4vZWKHDsY2Ww7W1qN6yvK6TzI5tfx2jaQxKyVMxnAq,iv:7x4oGcjXAr9Jusp/6JjjNr1qBvIrwvLjx1Kv9HoQhWk=,tag:0YwwGplUwy03f1HQh5nywQ==,type:str]
|
||||
openrouter:
|
||||
api_key: ENC[AES256_GCM,data:fSVxJEuFy4xRTHGQMe/GNVRpP9QiHGClVCdTnryv+tgq/2F2CC73X+V93am8Mgdvag0PpQdVULOIIvtacdaX9cTQxcT6QjHlng==,iv:8ia6KPnRbOXiJU8skb9eCTkbtpLWVTGy2B2Y8TuA1cg=,tag:TmSIQggoGoziuuUHX/trFg==,type:str]
|
||||
spaceship:
|
||||
corazoncp-domain:
|
||||
SPACESHIP_API_KEY: ENC[AES256_GCM,data:xgihxuht1d/BlMAUSsmclAaV5U6zrZg=,iv:pCgTh03ZfXuxOtDGTuTXwNJEfOHXIUzcQTh8ufVWb+4=,tag:SjP4ljM0K7rgXryiPJTVBw==,type:str]
|
||||
corazoncp-secret:
|
||||
SPACESHIP_API_SECRET: ENC[AES256_GCM,data:Elxq5OTilc21yhQnfJRFzKoXViKuQjXTWNvqb0t1DCt0VV1PKR66md3Md3LJn+vaP59u/nRWiJoEq5IfoxaoCQ==,iv:bBTj3EQMnB725+wegTxI3+8xhUQmlDbhKANaHjXBy8g=,tag:1f5T2s25PJFihuaYATNomw==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBoTWM4TVJwcGFkcjlTTHUz
|
||||
ajR1d053S3VMNEtDVDBVOEZnVnpwRWN5MHkwCk1zTVROcDZodWNBRFFVNzVSUG83
|
||||
WExNeWRZKzV0eUQvSTJPeEpiaUZYMzAKLS0tIFJibDIyRTJBVnhNWjJPQnJPeCtI
|
||||
Z3ZNa0xTUkFoYzdiUWFKMjVlQy9RdG8Kk12VHTYAxeNizQL7fEBkaO5a8gbyHmKr
|
||||
uDRpsV8weLjy6L6ap5sMo0yL5R8Tf0uy+/RXZKw9tU/s+Pu7qleZKA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg
|
||||
lastmodified: "2026-11-02T23:51:21Z"
|
||||
mac: ENC[AES256_GCM,data:XpUN8gKDXjgO8wd3lmzHj5bPK1d29f+K1LPqdpsdGZJ9lCqTPqshHdLrX7QE+uZfrgR+5wOs2Onppn/ZR196T3Ok0nAk4CKp7msHBJS49SF5ld9MEgWOSDwK9EwLsNYNHcMY/ehCaWZpmhsu/y10hYMGousmNKtMrcCGYhBht1E=,iv:u2r5GZfVxJkmxICuOiF7Yh89h7RMwOpmHWHPJnkauy0=,tag:BLyAyskMAuCVs+bZZXiwzA==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
# ⚙️ Core System Configuration
|
||||
# Foundational OS settings, bootloader, networking, users, and base system tools.
|
||||
|
||||
{ pkgs, inputs, ... }:
|
||||
|
||||
{
|
||||
# Nix settings & Flakes
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
|
||||
# Allow installation of unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Upstream fixes & package hash corrections
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
# Temporary upstream fix: AnyDesk vendor re-released 8.1.0 tarball in-place
|
||||
anydesk = prev.anydesk.overrideAttrs (old: {
|
||||
src = prev.fetchurl {
|
||||
inherit (old.src) url;
|
||||
hash = "sha256-zS5P2eyTHZY7cBW8mQ2Q6M0lXcx9VZZTtpG3Bb6u7IQ=";
|
||||
};
|
||||
});
|
||||
})
|
||||
];
|
||||
|
||||
# EFI bootloader configuration
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Host identity & networking
|
||||
networking.hostName = "laptop";
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# 🛡️ Dynamic Firewall for Trusted Home Wi-Fi
|
||||
# Automatically marks the Wi-Fi interface as fully trusted (accepting all incoming ports)
|
||||
# ONLY when connected to the trusted home Wi-Fi network ("VICTORIA"), removing the friction of
|
||||
# managing arbitrary development ports. Restores the strict default firewall immediately upon
|
||||
# disconnecting or connecting to any public / untrusted network.
|
||||
networking.firewall.extraCommands = ''
|
||||
iptables -N nixos-fw-home 2>/dev/null || true
|
||||
iptables -C nixos-fw -j nixos-fw-home 2>/dev/null || iptables -I nixos-fw 1 -j nixos-fw-home
|
||||
ip6tables -N nixos-fw-home 2>/dev/null || true
|
||||
ip6tables -C nixos-fw -j nixos-fw-home 2>/dev/null || ip6tables -I nixos-fw 1 -j nixos-fw-home
|
||||
'';
|
||||
|
||||
networking.networkmanager.dispatcherScripts = [
|
||||
{
|
||||
source = pkgs.writeShellScript "nm-trusted-wifi-firewall" ''
|
||||
IFACE="$1"
|
||||
ACTION="$2"
|
||||
TRUSTED_SSID="VICTORIA"
|
||||
|
||||
IPT="${pkgs.iptables}/bin/iptables"
|
||||
IP6T="${pkgs.iptables}/bin/ip6tables"
|
||||
LOGGER="${pkgs.util-linux}/bin/logger"
|
||||
|
||||
manage_chain() {
|
||||
local cmd="$1"
|
||||
$cmd -N nixos-fw-home 2>/dev/null || true
|
||||
$cmd -C nixos-fw -j nixos-fw-home 2>/dev/null || $cmd -I nixos-fw 1 -j nixos-fw-home
|
||||
}
|
||||
|
||||
manage_chain "$IPT"
|
||||
manage_chain "$IP6T"
|
||||
|
||||
if [ "$ACTION" = "up" ] && [ "$CONNECTION_ID" = "$TRUSTED_SSID" ]; then
|
||||
$IPT -F nixos-fw-home
|
||||
$IPT -A nixos-fw-home -i "$IFACE" -j ACCEPT
|
||||
|
||||
$IP6T -F nixos-fw-home
|
||||
$IP6T -A nixos-fw-home -i "$IFACE" -j ACCEPT
|
||||
|
||||
$LOGGER -t nm-firewall "Connected to trusted network $TRUSTED_SSID: trusted interface $IFACE (all incoming ports accepted)"
|
||||
elif [ "$ACTION" = "down" ] || [ -n "$CONNECTION_ID" -a "$CONNECTION_ID" != "$TRUSTED_SSID" ]; then
|
||||
$IPT -F nixos-fw-home
|
||||
$IP6T -F nixos-fw-home
|
||||
$LOGGER -t nm-firewall "Untrusted or disconnected network ($CONNECTION_ID): restored strict firewall"
|
||||
fi
|
||||
'';
|
||||
type = "basic";
|
||||
}
|
||||
];
|
||||
|
||||
# Regional and language settings
|
||||
time.timeZone = "America/Bogota";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
# Primary user account definition
|
||||
users.users.kiskaadee = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel" # Administrative access (sudo)
|
||||
"docker" # Container management without sudo
|
||||
"networkmanager" # Network configuration
|
||||
"lp" # Printer management
|
||||
"scanner" # Scanner access
|
||||
];
|
||||
};
|
||||
|
||||
# SSH daemon settings
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
ports = [ 22 ];
|
||||
settings.PermitRootLogin = "no";
|
||||
};
|
||||
|
||||
# Dynamic binary execution support (for unpatched binaries, language servers, VS Code server)
|
||||
programs.nix-ld = {
|
||||
enable = true;
|
||||
libraries = with pkgs; [
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
glib
|
||||
openssl
|
||||
];
|
||||
};
|
||||
|
||||
# 🧠 Memory & Swap Management
|
||||
# Compressed in-RAM swap prevents synchronous page thrashing and lockups under high memory pressure.
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# 🛡️ Early OOM Killer Daemon
|
||||
# Intervenes proactively before the kernel freezes, protecting compositor and core session services.
|
||||
services.earlyoom = {
|
||||
enable = true;
|
||||
enableNotifications = true;
|
||||
extraArgs = [
|
||||
"--avoid" "^(niri|dms|systemd|sshd)$"
|
||||
];
|
||||
};
|
||||
|
||||
# 🦠 ClamAV Antivirus Database Updater
|
||||
# Automatically keeps virus definitions updated in /var/lib/clamav via systemd timer
|
||||
# without running the continuous memory-heavy scanner daemon in RAM. Provides clamscan system-wide.
|
||||
services.clamav.updater.enable = true;
|
||||
|
||||
# System-wide administrative tools
|
||||
environment.systemPackages = with pkgs; [
|
||||
cups-pk-helper
|
||||
system-config-printer
|
||||
simple-scan
|
||||
rclone
|
||||
sops
|
||||
age
|
||||
];
|
||||
|
||||
# Compatibility state version
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# 💻 Laptop System Configuration Entrypoint
|
||||
# Composes the system modules for the mobile workstation.
|
||||
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./core.nix
|
||||
./hardware.nix
|
||||
./desktop.nix
|
||||
];
|
||||
}
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user