Compare commits
32 Commits
ead7e5a379
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2910dcb3ef | ||
|
|
8d62cffc8e | ||
|
|
7670f2fa94 | ||
|
|
b5c7024ea4 | ||
|
|
6d29835303 | ||
|
|
67119653b5 | ||
|
|
f95cf4a546 | ||
|
|
dc94b8fc44 | ||
|
|
b46e2a6269 | ||
|
|
fc62d7ab32 | ||
|
|
e0aa2b337e | ||
|
|
4fb24672bf | ||
|
|
81318b3fb1 | ||
|
|
ae1f68b105 | ||
|
|
b7a38d7634 | ||
|
|
6cd22f0448 | ||
|
|
9c73be46ac | ||
|
|
293f0a3096 | ||
|
|
d8606ad2ed | ||
|
|
7671ec686f | ||
|
|
5ed2ece05c | ||
|
|
2b1424cfd2 | ||
|
|
661629924e | ||
|
|
d7191f7a02 | ||
|
|
480c9a2a07 | ||
|
|
5e2e2ab29b | ||
|
|
b36c452c3a | ||
|
|
95c6cefd24 | ||
|
|
a8dda9d32d | ||
|
|
7a5f577806 | ||
|
|
a7482ee146 | ||
|
|
5382bf7251 |
@@ -14,3 +14,8 @@ trust_level = "trusted"
|
||||
[mcp_servers.nixos-mcp]
|
||||
command = "nixos-mcp"
|
||||
cwd = "/home/jawz/Development/NixOS"
|
||||
|
||||
[mcp_servers.nixos]
|
||||
command = "nix"
|
||||
args = ["run", "github:utensils/mcp-nixos", "--"]
|
||||
startup_timeout_sec = 300
|
||||
|
||||
@@ -5,20 +5,30 @@ on:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'scripts/**'
|
||||
- 'docs/**'
|
||||
- 'scripts/mcp-server/**'
|
||||
- 'parts/packages.nix'
|
||||
- 'flake.nix'
|
||||
- 'flake.lock'
|
||||
- '.gitea/workflows/mcp-tests.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'scripts/**'
|
||||
- 'docs/**'
|
||||
- 'scripts/mcp-server/**'
|
||||
- 'parts/packages.nix'
|
||||
- 'flake.nix'
|
||||
- 'flake.lock'
|
||||
- '.gitea/workflows/mcp-tests.yml'
|
||||
|
||||
jobs:
|
||||
mcp-tests:
|
||||
runs-on: nixos
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ github.workspace }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run MCP lint/format/tests via nix-shell
|
||||
run: ./scripts/mcp-server/run-tests.sh
|
||||
run: |
|
||||
nix run .#mcp-tests
|
||||
|
||||
230
README.org
230
README.org
@@ -6,198 +6,72 @@
|
||||
|
||||
* Overview
|
||||
|
||||
This repository contains my personal NixOS configuration flake, managing
|
||||
multiple hosts with a modular approach. Designed the configuration for a
|
||||
self-hosted infrastructure with services and development environments.
|
||||
This repository is a NixOS configuration flake with a local MCP server
|
||||
(`nixos-mcp`) that helps Codex CLI work with the repo’s documentation and
|
||||
maintenance workflows. The README focuses on how to use the MCP server and
|
||||
how the repo is structured.
|
||||
|
||||
* Architecture
|
||||
* MCP Server (nixos-mcp)
|
||||
|
||||
** Hosts
|
||||
- =workstation= :: Main development machine with GNOME desktop
|
||||
- =server= :: Primary server with containerized services
|
||||
- =miniserver= :: Secondary server for additional services
|
||||
- =galaxy= :: Minimal configuration host
|
||||
- =emacs= :: Development VM for Emacs configuration
|
||||
** What it is
|
||||
Local-only MCP server that exposes repo documentation helpers over stdio so
|
||||
Codex CLI can read the constitution, playbooks, and reference map without
|
||||
manual navigation.
|
||||
|
||||
** Key Features
|
||||
- Modular configuration system
|
||||
- SOPS-based secrets management
|
||||
- Container orchestration with Podman
|
||||
- Automated builds and caching
|
||||
- Multi-language development environments
|
||||
- Self-hosted service stack
|
||||
** Tool Catalog
|
||||
- =show-constitution= :: Open =docs/constitution.md=
|
||||
- =list-playbooks= :: List =docs/playbooks/=
|
||||
- =show-reference= :: Open =docs/reference/index.md=
|
||||
- =search-docs= :: Search the docs set
|
||||
- =list-mcp-tasks= :: Show MCP tasks from =specs/002-mcp-server/tasks.md=
|
||||
- =sync-docs= :: Check tool catalog vs. docs anchors
|
||||
|
||||
* Quick Start
|
||||
|
||||
** Prerequisites
|
||||
- NixOS 23.05 or later
|
||||
- SOPS configured with age keys
|
||||
- SSH keys for remote builds
|
||||
|
||||
** Initial Setup
|
||||
** Quick Start (new users)
|
||||
#+BEGIN_SRC bash
|
||||
# Clone the repository git clone <repository-url> /home/jawz/Development/NixOS
|
||||
cd /home/jawz/Development/NixOS
|
||||
# Enter the MCP dev shell (includes codex + nixos-mcp)
|
||||
nix develop .#mcp
|
||||
|
||||
# Install dependencies nix flake update
|
||||
|
||||
# Build and switch to configuration sudo nixos-rebuild switch --flake
|
||||
.#<hostname>
|
||||
# Run the MCP server (stdio mode)
|
||||
nixos-mcp
|
||||
#+END_SRC
|
||||
Configure Codex CLI to use a local stdio MCP endpoint and allowlist
|
||||
=nixos-mcp= in =.codex/requirements.toml=. The dev shell sets
|
||||
=CODEX_HOME=.codex= for a repo-local Codex config.
|
||||
|
||||
** Development Environment
|
||||
#+BEGIN_SRC bash
|
||||
# Enter development shell for specific language nix develop .#<language>
|
||||
** Reference
|
||||
Detailed invocation notes live in =docs/reference/mcp-server.md=.
|
||||
|
||||
# Available languages: python, rust, go, haskell, javascript, julia, zig, sh,
|
||||
cc, nix
|
||||
#+END_SRC
|
||||
* Repository Structure
|
||||
|
||||
* Configuration Structure
|
||||
** Docs and Guidance
|
||||
- =docs/constitution.md= :: AI constitution (authoritative rules)
|
||||
- =docs/reference/index.md= :: Reference map
|
||||
- =docs/reference/mcp-server.md= :: MCP server reference
|
||||
- =docs/playbooks/= :: Repeatable workflows
|
||||
- =specs/002-mcp-server/= :: MCP feature plan + tasks
|
||||
|
||||
** Core Configuration
|
||||
- =config/base.nix= :: Common system configuration
|
||||
- =config/jawz.nix= :: User and SSH configuration
|
||||
- =config/stylix.nix= :: Theming configuration
|
||||
- =config/schemes.nix= :: Color scheme definitions
|
||||
** MCP Server
|
||||
- =scripts/mcp-server/= :: Python MCP server implementation, tests, and CLI
|
||||
- =modules/dev/mcp.nix= :: Dev shell and optional global install
|
||||
|
||||
** Host Configurations
|
||||
- =hosts/<hostname>/configuration.nix= :: Host-specific settings
|
||||
- =hosts/<hostname>/hardware-configuration.nix= :: Hardware-specific config
|
||||
- =hosts/<hostname>/toggles.nix= :: Feature toggles
|
||||
** Flake Parts
|
||||
- =parts/core.nix= :: Shared library + base composition
|
||||
- =parts/hosts.nix= :: Host definitions
|
||||
- =parts/packages.nix= :: Package outputs
|
||||
- =parts/devshells.nix= :: Dev shells (including MCP)
|
||||
|
||||
** Modules
|
||||
- =modules/apps/= :: Application packages and configurations
|
||||
- =modules/dev/= :: Development environment modules
|
||||
- =modules/servers/= :: Self-hosted service configurations
|
||||
- =modules/services/= :: System service configurations
|
||||
- =modules/scripts/= :: Custom scripts and utilities
|
||||
- =modules/shell/= :: Shell and terminal configurations
|
||||
* Flake Inputs (high level)
|
||||
|
||||
* Services
|
||||
|
||||
** Core Services
|
||||
- PostgreSQL 17 :: Database backend
|
||||
- Nginx :: Reverse proxy and web server
|
||||
- Podman :: Container runtime
|
||||
- Syncthing :: File synchronization
|
||||
- WireGuard :: VPN connectivity
|
||||
|
||||
** Self-Hosted Applications
|
||||
- Nextcloud :: File sharing and collaboration
|
||||
- Gitea :: Git repository hosting
|
||||
- Jellyfin :: Media server
|
||||
- Plex :: Media streaming
|
||||
- Sonarr/Radarr/Lidarr :: Media management
|
||||
- Vaultwarden :: Password manager
|
||||
- Homepage :: Service dashboard
|
||||
- And more...
|
||||
|
||||
* Development
|
||||
|
||||
** Available Development Shells
|
||||
The configuration provides development shells for my favorite programming
|
||||
languages:
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
# Python development nix develop .#python
|
||||
|
||||
# Rust development nix develop .#rust
|
||||
|
||||
# Go development nix develop .#go
|
||||
|
||||
# JavaScript/Node.js development nix develop .#javascript
|
||||
|
||||
# Haskell development nix develop .#haskell
|
||||
|
||||
# Julia development nix develop .#julia
|
||||
|
||||
# Zig development nix develop .#zig
|
||||
|
||||
# Shell scripting nix develop .#sh
|
||||
|
||||
# C/C++ development nix develop .#cc
|
||||
|
||||
# Nix development nix develop .#nix
|
||||
#+END_SRC
|
||||
|
||||
** Adding New Modules
|
||||
1. Create module file in appropriate directory under =modules/=
|
||||
2. Add module to =modules/modules.nix= if needed
|
||||
3. Enable module in host configuration or toggles
|
||||
|
||||
** Adding New Hosts
|
||||
1. Create host directory under =hosts/<hostname>/
|
||||
2. Add =configuration.nix= and =hardware-configuration.nix=
|
||||
3. Add host to =flake.nix= outputs
|
||||
4. Create =toggles.nix= for feature management
|
||||
|
||||
* Secrets Management
|
||||
|
||||
** SOPS Configuration
|
||||
Manage secrets using SOPS with age encryption:
|
||||
|
||||
- =secrets/secrets.yaml= :: Main secrets file
|
||||
- =secrets/keys.yaml= :: SSH and encryption keys
|
||||
- =secrets/env.yaml= :: Environment variables
|
||||
- =secrets/wireguard.yaml= :: VPN configuration
|
||||
- =secrets/certs.yaml= :: SSL certificates
|
||||
|
||||
** Adding New Secrets
|
||||
#+BEGIN_SRC bash
|
||||
# Edit secrets file sops secrets/secrets.yaml
|
||||
|
||||
# Add new secret sops -i -a 'new-secret: "value"' secrets/secrets.yaml
|
||||
#+END_SRC
|
||||
|
||||
* CI/CD
|
||||
|
||||
** GitHub Actions
|
||||
The repository includes automated workflows:
|
||||
|
||||
- =weekly-build-cache.yml= :: Weekly builds and cache updates
|
||||
- =build-schemes.yml= :: Color scheme builds
|
||||
|
||||
** Build Cache
|
||||
Builds are automatically cached using Atticd for faster rebuilds.
|
||||
|
||||
|
||||
* Customization
|
||||
|
||||
** Theming
|
||||
The configuration uses Stylix for theming. Define color schemes in
|
||||
=config/schemes.nix= and can set them via the =config/stylix.nix= file.
|
||||
|
||||
** Adding New Services
|
||||
1. Create service module in =modules/servers/=
|
||||
2. Add service configuration
|
||||
3. Enable service in host toggles
|
||||
4. Add to homepage if needed
|
||||
|
||||
** Custom Scripts
|
||||
Scripts are in =modules/scripts/= and toggle them per host.
|
||||
|
||||
* Troubleshooting
|
||||
|
||||
** Common Issues
|
||||
|
||||
*** Build Failures
|
||||
- Check flake inputs are up to date: =nix flake update=
|
||||
- Verify all required secrets are present
|
||||
- Check host-specific configuration
|
||||
|
||||
*** Service Issues
|
||||
- Check service status: =systemctl status <service>=
|
||||
- View logs: =journalctl -u <service>=
|
||||
- Verify firewall rules
|
||||
|
||||
*** Development Environment
|
||||
- Rebuild development shell: =nix develop .#<language>=
|
||||
- Check available packages: =nix search nixpkgs <package>=
|
||||
|
||||
** Getting Help
|
||||
- Check NixOS documentation
|
||||
- Review module documentation
|
||||
** Core Inputs
|
||||
- =nixpkgs= (25.11) and =nixpkgs-small= (25.11-small)
|
||||
- =nixpkgs-unstable= (rolling)
|
||||
- =flake-parts= (structure)
|
||||
- =home-manager= (user configs)
|
||||
- =stylix= (theming)
|
||||
- =sops-nix= (secrets integration)
|
||||
- =nur=, =nix-gaming=, =hyprland= (extra packages)
|
||||
- Content inputs: =wallpapers=, =fonts=, =qbit_manage=
|
||||
- Repo inputs: =jawz-scripts=, =prem2resolve=, =lidarr-mb-gap=
|
||||
- Check service-specific documentation
|
||||
|
||||
* Maintenance
|
||||
|
||||
@@ -116,5 +116,28 @@ in
|
||||
base0F = "#dc143c"; # crimson
|
||||
};
|
||||
};
|
||||
punk = mkScheme {
|
||||
color = "red";
|
||||
polarity = "light";
|
||||
image = "${wallpapers}/punk.jpeg";
|
||||
base16Scheme = {
|
||||
base00 = "#f7f3ee";
|
||||
base01 = "#efe6dc";
|
||||
base02 = "#e1d3c6";
|
||||
base03 = "#c8b2a0";
|
||||
base04 = "#a18673";
|
||||
base05 = "#6e5646";
|
||||
base06 = "#3f2f28";
|
||||
base07 = "#1a1512";
|
||||
base08 = "#c7423a";
|
||||
base09 = "#d28b61";
|
||||
base0A = "#c9a24c";
|
||||
base0B = "#7d8b6a";
|
||||
base0C = "#5f8f8a";
|
||||
base0D = "#4f6a86";
|
||||
base0E = "#8a5b6a";
|
||||
base0F = "#8b5a3c";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ let
|
||||
schemesFile = import ./schemes.nix {
|
||||
inherit pkgs inputs;
|
||||
};
|
||||
scheme = schemesFile.schemes.space;
|
||||
scheme = schemesFile.schemes.punk;
|
||||
cfg = config.my.stylix;
|
||||
gnomeEnabled = config.services.desktopManager.gnome.enable;
|
||||
in
|
||||
|
||||
@@ -46,8 +46,8 @@ config.services = {
|
||||
- VPS enrollment flow: The vps host generates its own key on first boot, then operators enroll the public key, re-encrypt secrets, and redeploy. Follow `docs/playbooks/enroll-vps.md`.
|
||||
|
||||
## Module Categories and Active Hosts
|
||||
- Module categories: apps, dev, scripts, servers, services, shell, websites, network, users, nix, patches. Factories sit in `modules/factories/` and are imported explicitly.
|
||||
- Active hosts: `workstation`, `server`, `miniserver`, `galaxy`, `emacs`. Host roles and secure status are defined in `hosts/<name>/configuration.nix` and toggles in `hosts/<name>/toggles.nix`.
|
||||
- Module categories: apps, dev, scripts, servers, services, shell, websites, network, users, nix. Factories sit in `modules/factories/` and are imported explicitly; patch artifacts live at the repo root in `patches/`.
|
||||
- Active hosts: `workstation`, `server`, `miniserver`, `galaxy`, `emacs`, `vps`. Host roles and secure status are defined in `hosts/<name>/configuration.nix` and toggles in `hosts/<name>/toggles.nix`.
|
||||
|
||||
## Precedence and Conflict Resolution
|
||||
- Precedence: This constitution is authoritative for AI. Human docs must be updated to match. If conflicts are found, align human docs to the constitution and log the resolution in `specs/001-ai-docs/research.md`.
|
||||
|
||||
25
docs/playbooks/add-wireguard-peer.md
Normal file
25
docs/playbooks/add-wireguard-peer.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Playbook: Add WireGuard Peer (Friend or Guest)
|
||||
|
||||
## When to use
|
||||
- Adding a new WireGuard peer in the friends (10.8.0.0/24) or guests (10.9.0.0/24) subnet.
|
||||
- Updating firewall rules to allow access to specific ports for that peer.
|
||||
|
||||
## Inputs
|
||||
- Peer name (e.g., `friend5`, `guest2`)
|
||||
- Peer public key (WireGuard)
|
||||
- Peer IP address (e.g., `10.8.0.6` or `10.9.0.3`)
|
||||
- Access scope (ports/services the peer should reach)
|
||||
|
||||
## Steps
|
||||
1. Add the peer IP to `my.ips` in `modules/modules.nix`.
|
||||
2. Add the peer to the VPS WireGuard peers list in `modules/services/wireguard.nix`.
|
||||
3. If the peer is a guest/friend, ensure `allowedIPs` includes the relevant subnets in `hosts/server/configuration.nix`.
|
||||
4. Add or adjust VPS firewall rules in `hosts/vps/configuration.nix` (`networking.firewall.extraForwardRules`) to allow the requested ports.
|
||||
5. Rebuild both hosts:
|
||||
- `nixos-rebuild switch --flake .#vps`
|
||||
- `nixos-rebuild switch --flake .#server`
|
||||
|
||||
## Verification
|
||||
- On VPS: `sudo wg show`
|
||||
- On VPS: `sudo nft list ruleset | rg -n "<peer ip>|<port>"`
|
||||
- From peer: confirm access to allowed endpoints (HTTP/TCP/ICMP as defined).
|
||||
@@ -11,13 +11,14 @@
|
||||
- network → `modules/network/` (networking rules, firewall helpers)
|
||||
- users → `modules/users/` (user-related options)
|
||||
- nix → `modules/nix/` (Nix configuration and helpers)
|
||||
- patches → `patches/` (patch artifacts referenced by modules)
|
||||
- factories → `modules/factories/` (`mkserver.nix`, `mkscript.nix` shared helpers)
|
||||
## Root Directories
|
||||
- patches → `patches/` (patch artifacts referenced by modules)
|
||||
|
||||
## Auto-Import Rules
|
||||
- Source: `modules/modules.nix` uses `inputs.self.lib.autoImport` to load `.nix` files from module directories.
|
||||
- Filter: Excludes `librewolf.nix`; all other `.nix` files in target dirs are loaded automatically.
|
||||
- Implication: Place new modules in the correct category directory with a `.nix` filename; no manual import wiring required unless adding a new factory.
|
||||
- Implication: Place new modules in the correct category directory with a `.nix` filename; no manual import wiring required unless adding a new factory. Patch artifacts under `patches/` are not auto-imported.
|
||||
|
||||
## Hosts and Roles
|
||||
- Configs: `hosts/<name>/configuration.nix` with toggles in `hosts/<name>/toggles.nix`.
|
||||
@@ -61,7 +62,7 @@
|
||||
- MCP server reference: `docs/reference/mcp-server.md` (tool catalog, `nixos-mcp` wrapper, invocation, sync-docs)
|
||||
|
||||
## Quick Audit Checklist
|
||||
- Module coverage: All categories (apps, dev, scripts, servers, services, shell, websites, network, users, nix, patches) have corresponding entries and auto-import rules.
|
||||
- Module coverage: All categories (apps, dev, scripts, servers, services, shell, websites, network, users, nix) have corresponding entries and auto-import rules; `patches/` is documented as a root directory.
|
||||
- Host coverage: Active hosts listed with roles and secureHost status; `mainServer` noted.
|
||||
- Proxy rules: `enableProxy` usage, proxy helper selection, and `my.ips` mappings documented.
|
||||
- Secrets map: Every secrets file and secureHost gating captured; new secret types aligned to file purposes.
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
;;neotree ; a project drawer, like NERDTree for vim
|
||||
ophints ; highlight the region an operation acts on
|
||||
(popup +defaults) ; tame sudden yet inevitable temporary windows
|
||||
(smooth-scroll +interpolate) ; So smooth you won't believe it's not butter
|
||||
;;tabs ; a tab bar for Emacs
|
||||
(treemacs +lsp) ; a project drawer, like neotree but cooler
|
||||
;;unicode ; extended unicode support for various languages
|
||||
@@ -64,6 +65,7 @@
|
||||
;;parinfer ; turn lisp into python, sort of
|
||||
rotate-text ; cycle region at point between text candidates
|
||||
snippets ; my elves. They type so I don't have to
|
||||
(whitespace +guess +trim) ; a butler for your whitespace
|
||||
;;word-wrap ; soft wrapping with language-aware indent
|
||||
|
||||
:emacs
|
||||
@@ -71,6 +73,7 @@
|
||||
electric ; smarter, keyword-based electric-indent
|
||||
eww ; the internet is gross
|
||||
ibuffer ; interactive buffer management
|
||||
tramp ; remote files at your arthritic fingertips
|
||||
(undo +tree) ; persistent, smarter undo for your inevitable mistakes
|
||||
vc ; version-control and Emacs, sitting in a tree
|
||||
|
||||
@@ -96,21 +99,24 @@
|
||||
;;ein ; tame Jupyter notebooks with emacs
|
||||
(eval +overlay) ; run code, run (also, repls)
|
||||
(lookup +dictionary + offline) ; navigate your code and its documentation
|
||||
llm ; when I said you needed friends, I didn't mean...
|
||||
(lsp +peek) ; M-x vscode
|
||||
magit ; a git porcelain for Emacs
|
||||
;;make ; run make tasks from Emacs
|
||||
;;pass ; password manager for nerds
|
||||
;;pdf ; pdf enhancements
|
||||
;;prodigy ; FIXME managing external services & code builders
|
||||
;;terraform ; infrastructure as code
|
||||
(terraform +lsp) ; infrastructure as code
|
||||
tmux ; an API for interacting with tmux
|
||||
;; tree-sitter ; syntax and parsing, sitting in a tree...
|
||||
upload ; map local to remote projects via ssh/ftp
|
||||
|
||||
:os
|
||||
;;(:if (featurep :system 'macos) macos) ; improve compatibility with macOS tty ; improve the terminal Emacs experience
|
||||
tty ; improve the terminal Emacs experience
|
||||
|
||||
:lang
|
||||
;;ada ; In strong typing we (blindly) trust
|
||||
;;agda ; types of types of types of types...
|
||||
;;beancount ; mind the GAAP
|
||||
(cc +lsp) ; C > C++ == 1
|
||||
@@ -139,6 +145,7 @@
|
||||
;;hy ; readability of scheme w/ speed of python
|
||||
;;idris ; a language you can depend on
|
||||
(json +lsp) ; At least it ain't XML
|
||||
;;janet ; Fun fact: Janet is me!
|
||||
;;(java +lsp) ; the poster child for carpal tunnel syndrome
|
||||
(javascript +lsp) ; all(hope(abandon(ye(who(enter(here))))))
|
||||
(julia +lsp) ; a better, faster MATLAB
|
||||
|
||||
@@ -49,15 +49,9 @@
|
||||
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
|
||||
;(unpin! t)
|
||||
|
||||
;; (package! nixos-options) ;; enable when migrating to nixos
|
||||
;; (package! quick-preview) ;; preview files with sushi
|
||||
|
||||
|
||||
;; (package! codeium :recipe (:host github :repo "Exafunction/codeium.el"))
|
||||
(package! config-general-mode)
|
||||
(package! dired-open)
|
||||
(package! dired-subtree)
|
||||
;; (package! doom-modeline-now-playing)
|
||||
(package! expand-region)
|
||||
(package! ini-mode)
|
||||
(package! insert-esv) ;; bible passages
|
||||
(package! olivetti) ;; writing mode centering text, looks like word
|
||||
@@ -68,11 +62,14 @@
|
||||
(package! peep-dired) ;; kind of cool but never could make it work
|
||||
(package! php-cs-fixer)
|
||||
(package! systemd)
|
||||
;; :recipe (:host github :repo "tecosaur/ox-chameleon"))
|
||||
;; (package! 2048-game)
|
||||
;; (package! academic-phrases)
|
||||
;; (package! caddyfile-mode)
|
||||
;; (package! clippy)
|
||||
;; (package! codeium :recipe (:host github :repo "Exafunction/codeium.el"))
|
||||
;; (package! crontab-mode) ;; crontab colors
|
||||
;; (package! doom-modeline-now-playing)
|
||||
;; (package! evil-tutor) ;; vim tutorial
|
||||
;; (package! ewal) ;; theme colors based on pywal
|
||||
;; (package! ewal-doom-themes)
|
||||
@@ -81,16 +78,14 @@
|
||||
;; (package! flycheck-aspell)
|
||||
;; (package! ivy-posframe)
|
||||
;; (package! mw-thesaurus)
|
||||
;; (package! nixos-options) ;; enable when migrating to nixos
|
||||
;; (package! org-appear) ;; couldn't get it to work
|
||||
;; (package! org-recur) ;; works but I want to keep org vanilla
|
||||
;; (package! ox-chameleon
|
||||
;; :recipe (:host github :repo "tecosaur/ox-chameleon"))
|
||||
;; (package! quick-preview) ;; preview files with sushi
|
||||
;; (package! renpy)
|
||||
;; (package! resize-window)
|
||||
;; (package! tldr)
|
||||
;; (package! typit) ;; type speed test
|
||||
;; (package! vimgolf) ;; vim puzzles
|
||||
;; (package! wc-mode) ;; displays character count of buffer
|
||||
|
||||
(package! expand-region)
|
||||
(package! gptel :recipe (:nonrecursive t))
|
||||
|
||||
8
flake.lock
generated
8
flake.lock
generated
@@ -1331,11 +1331,11 @@
|
||||
"wallpapers": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1759463031,
|
||||
"narHash": "sha256-9goyp+g9N4+9PA9V2QerTsxlVy9MA4LXufJaruj2MMs=",
|
||||
"lastModified": 1770517108,
|
||||
"narHash": "sha256-QYvx6j7r1ItxaaKN/wI0nGB6r5aWG46zfcoXCTOgK18=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "0212af5b70347f0721cfe88c25e1efb77b645a2d",
|
||||
"revCount": 2,
|
||||
"rev": "dcb86c4c592b8cf838a0fd6d139254619cbbd869",
|
||||
"revCount": 3,
|
||||
"type": "git",
|
||||
"url": "https://git.lebubu.org/jawz/wallpapers.git"
|
||||
},
|
||||
|
||||
@@ -78,6 +78,7 @@ in
|
||||
endpoint = "${config.my.ips.vps}:51820";
|
||||
allowedIPs = [
|
||||
"${config.my.ips.wg-vps}/32"
|
||||
config.my.subnets.wg-homelab
|
||||
config.my.subnets.wg-friends
|
||||
config.my.subnets.wg-guests
|
||||
];
|
||||
@@ -121,7 +122,7 @@ in
|
||||
config.my.ips.vps
|
||||
"[${config.my.ips.vps}]:3456"
|
||||
];
|
||||
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMvtTURGBtAFXxxfzMJVoNJrtWLykOloJ5XYjxGh1OUx";
|
||||
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPp0wAuZXk96OyA/+2YpQalokS9lZdacjJqY9zN8IScP";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -67,7 +67,6 @@ in
|
||||
"maloja"
|
||||
"mealie"
|
||||
"metube"
|
||||
"microbin"
|
||||
"multi-scrobbler"
|
||||
"paperless"
|
||||
"plex"
|
||||
@@ -85,7 +84,6 @@ in
|
||||
]
|
||||
// enableList mkEnabledIp [
|
||||
"audiobookshelf"
|
||||
"isso"
|
||||
"keycloak"
|
||||
"linkwarden"
|
||||
"oauth2-proxy"
|
||||
|
||||
@@ -12,6 +12,7 @@ let
|
||||
homeServer = config.my.ips.wg-server;
|
||||
wgFriend1 = config.my.ips.wg-friend1;
|
||||
wgGuest1 = config.my.ips.wg-guest1;
|
||||
wgGuest2 = config.my.ips.wg-guest2;
|
||||
};
|
||||
subnets = {
|
||||
wgFriends = config.my.subnets.wg-friends;
|
||||
@@ -36,24 +37,32 @@ let
|
||||
synapseClient = toString config.my.servers.synapse.port;
|
||||
syncplay = toString config.my.servers.syncplay.port;
|
||||
stash = toString config.my.servers.stash.port;
|
||||
jellyfin = toString config.my.servers.jellyfin.port;
|
||||
audiobookshelf = toString config.my.servers.audiobookshelf.port;
|
||||
kavita = toString config.my.servers.kavita.port;
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./nginx-nextcloud.nix
|
||||
../../config/base.nix
|
||||
];
|
||||
my = import ./toggles.nix { inherit config inputs; } // {
|
||||
secureHost = true;
|
||||
users.nixremote = {
|
||||
enable = true;
|
||||
authorizedKeys = inputs.self.lib.getSshKeys [
|
||||
"nixworkstation"
|
||||
"nixserver"
|
||||
"nixminiserver"
|
||||
];
|
||||
my =
|
||||
import ./toggles.nix {
|
||||
inherit config inputs lib;
|
||||
}
|
||||
// {
|
||||
secureHost = true;
|
||||
users.nixremote = {
|
||||
enable = true;
|
||||
authorizedKeys = inputs.self.lib.getSshKeys [
|
||||
"nixworkstation"
|
||||
"nixserver"
|
||||
"nixminiserver"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
sops.age = {
|
||||
generateKey = true;
|
||||
keyFile = "/var/lib/sops-nix/key.txt";
|
||||
@@ -101,9 +110,11 @@ in
|
||||
|
||||
iifname "${wgInterface}" ip saddr ${subnets.wgFriends} ip daddr ${ips.homeServer}/32 icmp type echo-request accept
|
||||
iifname "${wgInterface}" ip saddr ${ips.wgFriend1}/32 ip daddr ${ips.homeServer}/32 tcp dport ${portsStr.stash} accept
|
||||
iifname "${wgInterface}" ip saddr ${ips.wgGuest1}/32 ip daddr ${ips.homeServer}/32 tcp dport ${portsStr.stash} accept
|
||||
iifname "${wgInterface}" ip saddr ${subnets.wgGuests} ip daddr ${ips.homeServer}/32 tcp dport { ${portsStr.stash}, ${portsStr.jellyfin}, ${portsStr.audiobookshelf}, ${portsStr.kavita} } accept
|
||||
iifname "${wgInterface}" ip saddr ${subnets.wgGuests} ip daddr ${ips.homeServer}/32 icmp type echo-request accept
|
||||
|
||||
iifname "${wgInterface}" ip saddr ${subnets.wgHomelab} ip daddr ${ips.homeServer}/32 accept
|
||||
|
||||
iifname "${wgInterface}" ip saddr ${subnets.wgFriends} oifname "${externalInterface}" accept
|
||||
iifname "${wgInterface}" ip saddr ${subnets.wgGuests} oifname "${externalInterface}" accept
|
||||
|
||||
@@ -131,7 +142,7 @@ in
|
||||
"d /var/www/html 2775 deploy www-data -"
|
||||
"d /var/www/html/portfolio 2775 deploy www-data -"
|
||||
"d /var/www/html/blog 2775 deploy www-data -"
|
||||
"d /var/www/html/lidarr-mb-gap 2775 deploy www-data -"
|
||||
"d /var/www/html/lidarr-mb-gap 2775 lidarr-reports lidarr-reports -"
|
||||
];
|
||||
services = {
|
||||
smartd.enable = lib.mkForce false;
|
||||
@@ -144,7 +155,12 @@ in
|
||||
www-data = { };
|
||||
};
|
||||
users = {
|
||||
nginx.extraGroups = [ "www-data" ];
|
||||
nginx = lib.mkIf config.my.secureHost {
|
||||
extraGroups = [
|
||||
"www-data"
|
||||
"lidarr-reports"
|
||||
];
|
||||
};
|
||||
deploy = {
|
||||
isSystemUser = true;
|
||||
group = "deploy";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
@@ -33,11 +34,17 @@
|
||||
};
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/f222513b-ded1-49fa-b591-20ce86a2fe7f";
|
||||
device = lib.mkForce (
|
||||
if config.my.build.baseImage then
|
||||
"/dev/sda"
|
||||
else
|
||||
"/dev/disk/by-uuid/f222513b-ded1-49fa-b591-20ce86a2fe7f"
|
||||
);
|
||||
fsType = "ext4";
|
||||
};
|
||||
swapDevices = [
|
||||
{ device = "/dev/disk/by-uuid/f1408ea6-59a0-11ed-bc9d-525400000001"; }
|
||||
swapDevices = lib.mkMerge [
|
||||
[ { device = "/dev/disk/by-uuid/f1408ea6-59a0-11ed-bc9d-525400000001"; } ]
|
||||
(lib.mkIf config.my.build.baseImage [ { device = "/dev/sdb"; } ])
|
||||
];
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
|
||||
116
hosts/vps/nginx-nextcloud.nix
Normal file
116
hosts/vps/nginx-nextcloud.nix
Normal file
@@ -0,0 +1,116 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.my.servers.nextcloud;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf (cfg.enableProxy && config.my.enableProxy && config.my.secureHost) {
|
||||
services.nginx.virtualHosts.${cfg.host} = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
http2 = true;
|
||||
default = true;
|
||||
serverAliases = [ "cloud.rotehaare.art" ];
|
||||
extraConfig = ''
|
||||
index index.php index.html /index.php$request_uri;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header X-Robots-Tag "noindex, nofollow" always;
|
||||
add_header X-Permitted-Cross-Domain-Policies none always;
|
||||
add_header X-Frame-Options SAMEORIGIN always;
|
||||
add_header Referrer-Policy no-referrer always;
|
||||
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
|
||||
'';
|
||||
locations = {
|
||||
"= /robots.txt" = {
|
||||
priority = 100;
|
||||
extraConfig = ''
|
||||
allow all;
|
||||
access_log off;
|
||||
'';
|
||||
};
|
||||
"= /" = {
|
||||
priority = 100;
|
||||
proxyPass = cfg.local;
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
if ( $http_user_agent ~ ^DavClnt ) {
|
||||
return 302 /remote.php/webdav/$is_args$args;
|
||||
}
|
||||
'';
|
||||
};
|
||||
"= /.well-known/carddav" = {
|
||||
priority = 210;
|
||||
extraConfig = ''
|
||||
return 301 /remote.php/dav/;
|
||||
'';
|
||||
};
|
||||
"= /.well-known/caldav" = {
|
||||
priority = 210;
|
||||
extraConfig = ''
|
||||
return 301 /remote.php/dav/;
|
||||
'';
|
||||
};
|
||||
"~ ^/\\.well-known/(?!acme-challenge|pki-validation)" = {
|
||||
priority = 210;
|
||||
extraConfig = ''
|
||||
return 301 /index.php$request_uri;
|
||||
'';
|
||||
};
|
||||
"^~ /.well-known" = {
|
||||
priority = 210;
|
||||
extraConfig = ''
|
||||
try_files $uri $uri/ =404;
|
||||
'';
|
||||
};
|
||||
"~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/)" = {
|
||||
priority = 450;
|
||||
extraConfig = ''
|
||||
return 404;
|
||||
'';
|
||||
};
|
||||
"~ ^/(?:\\.|autotest|occ|issue|indie|db_|console)" = {
|
||||
priority = 450;
|
||||
extraConfig = ''
|
||||
return 404;
|
||||
'';
|
||||
};
|
||||
"~ \\.php(?:$|/)" = {
|
||||
priority = 500;
|
||||
proxyPass = cfg.local;
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode(_arm64)?\/proxy) /index.php$request_uri;
|
||||
'';
|
||||
};
|
||||
"~ \\.(?:css|js|mjs|svg|gif|ico|jpg|jpeg|png|webp|wasm|tflite|map|html|ttf|bcmap|mp4|webm|ogg|flac)$" =
|
||||
{
|
||||
proxyPass = cfg.local;
|
||||
extraConfig = ''
|
||||
expires 6M;
|
||||
access_log off;
|
||||
'';
|
||||
};
|
||||
"~ ^\\/(?:updater|ocs-provider)(?:$|\\/)" = {
|
||||
proxyPass = cfg.local;
|
||||
extraConfig = ''
|
||||
try_files $uri/ =404;
|
||||
index index.php;
|
||||
'';
|
||||
};
|
||||
"/remote" = {
|
||||
priority = 1500;
|
||||
extraConfig = ''
|
||||
return 301 /remote.php$request_uri;
|
||||
'';
|
||||
};
|
||||
"/" = {
|
||||
priority = 1600;
|
||||
proxyPass = cfg.local;
|
||||
proxyWebsockets = true;
|
||||
extraConfig = ''
|
||||
try_files $uri $uri/ /index.php$request_uri;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,64 +1,86 @@
|
||||
{ config, inputs }:
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
}:
|
||||
let
|
||||
inherit (inputs.self.lib)
|
||||
enableList
|
||||
mkEnabled
|
||||
mkEnabledWithProxy
|
||||
mkEnabledWithUsers
|
||||
;
|
||||
wgServerIp = config.my.ips.wg-server;
|
||||
mkEnabledProxyIp = inputs.self.lib.mkEnabledProxyIp wgServerIp;
|
||||
in
|
||||
{
|
||||
enableProxy = true;
|
||||
enableContainers = true;
|
||||
apps.dictionaries.enable = true;
|
||||
apps.dictionaries.users = "jawz";
|
||||
services = enableList mkEnabled [
|
||||
"network"
|
||||
"wireguard"
|
||||
];
|
||||
shell = enableList mkEnabledWithUsers [
|
||||
"multimedia"
|
||||
"tools"
|
||||
];
|
||||
dev = enableList mkEnabledWithUsers [
|
||||
"nix"
|
||||
"sh"
|
||||
];
|
||||
websites = {
|
||||
portfolio.enableProxy = true;
|
||||
lidarrMbReport.enableProxy = true;
|
||||
};
|
||||
servers = {
|
||||
nextcloud = {
|
||||
mkEnabledProxySocketIp = name: {
|
||||
inherit name;
|
||||
value = {
|
||||
enableProxy = true;
|
||||
enableSocket = true;
|
||||
ip = wgServerIp;
|
||||
};
|
||||
}
|
||||
// enableList mkEnabledProxyIp [
|
||||
"audiobookshelf"
|
||||
"bazarr"
|
||||
"collabora"
|
||||
"gitea"
|
||||
"homepage"
|
||||
"isso"
|
||||
"jellyfin"
|
||||
"kavita"
|
||||
"keycloak"
|
||||
"lidarr"
|
||||
"linkwarden"
|
||||
"maloja"
|
||||
"mealie"
|
||||
"metube"
|
||||
"microbin"
|
||||
"multi-scrobbler"
|
||||
"oauth2-proxy"
|
||||
"plausible"
|
||||
"plex"
|
||||
"prowlarr"
|
||||
"radarr"
|
||||
"sonarr"
|
||||
"vaultwarden"
|
||||
"yamtrack"
|
||||
];
|
||||
}
|
||||
};
|
||||
baseToggles = {
|
||||
services = enableList mkEnabled [
|
||||
"network"
|
||||
"wireguard"
|
||||
];
|
||||
shell = enableList mkEnabledWithUsers [
|
||||
"multimedia"
|
||||
"tools"
|
||||
];
|
||||
dev = enableList mkEnabledWithUsers [
|
||||
"nix"
|
||||
"sh"
|
||||
];
|
||||
apps.dictionaries = {
|
||||
enable = true;
|
||||
users = "jawz";
|
||||
};
|
||||
};
|
||||
secureToggles = {
|
||||
enableProxy = true;
|
||||
enableContainers = true;
|
||||
websites = {
|
||||
portfolio.enableProxy = true;
|
||||
lidarrMbReport.enableProxy = true;
|
||||
};
|
||||
servers =
|
||||
enableList mkEnabledWithProxy [
|
||||
"isso"
|
||||
"microbin"
|
||||
]
|
||||
// enableList mkEnabledProxySocketIp [
|
||||
"audiobookshelf"
|
||||
"collabora"
|
||||
"jellyfin"
|
||||
"nextcloud"
|
||||
"plausible"
|
||||
"plex"
|
||||
]
|
||||
// enableList mkEnabledProxyIp [
|
||||
"atticd"
|
||||
"bazarr"
|
||||
"gitea"
|
||||
"homepage"
|
||||
"kavita"
|
||||
"keycloak"
|
||||
"lidarr"
|
||||
"linkwarden"
|
||||
"maloja"
|
||||
"mealie"
|
||||
"metube"
|
||||
"multi-scrobbler"
|
||||
"oauth2-proxy"
|
||||
"prowlarr"
|
||||
"radarr"
|
||||
"sonarr"
|
||||
"vaultwarden"
|
||||
"yamtrack"
|
||||
];
|
||||
};
|
||||
in
|
||||
lib.mkMerge [
|
||||
baseToggles
|
||||
(lib.mkIf config.my.secureHost secureToggles)
|
||||
]
|
||||
|
||||
@@ -30,7 +30,7 @@ in
|
||||
};
|
||||
localhost6 = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "::1";
|
||||
default = "[::1]";
|
||||
description = "The localhost ipv6 address.";
|
||||
};
|
||||
secureHost = lib.mkOption {
|
||||
@@ -53,11 +53,15 @@ in
|
||||
vps = "45.79.25.87";
|
||||
wg-vps = "10.77.0.1";
|
||||
wg-server = "10.77.0.2";
|
||||
wg-galaxy = "10.77.0.3";
|
||||
wg-phone = "10.77.0.4";
|
||||
wg-guest1 = "10.9.0.2";
|
||||
wg-guest2 = "10.9.0.3";
|
||||
wg-friend1 = "10.8.0.2";
|
||||
wg-friend2 = "10.8.0.3";
|
||||
wg-friend3 = "10.8.0.4";
|
||||
wg-friend4 = "10.8.0.5";
|
||||
wg-friend5 = "10.8.0.6";
|
||||
};
|
||||
description = "Set of IP's for all my computers.";
|
||||
};
|
||||
@@ -126,6 +130,11 @@ in
|
||||
};
|
||||
enableContainers = lib.mkEnableOption "container services (Docker/Podman)";
|
||||
enableProxy = lib.mkEnableOption "nginx reverse proxy for services";
|
||||
build.baseImage = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable base image settings for this host build.";
|
||||
};
|
||||
toggleUsers = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.either lib.types.str (lib.types.listOf lib.types.str));
|
||||
default = {
|
||||
@@ -213,7 +222,6 @@ in
|
||||
config.my.servers.go-vod.enable
|
||||
config.my.servers.tranga.enable
|
||||
config.my.servers.drpp.enable
|
||||
config.my.servers.plex-discord-bot.enable
|
||||
]);
|
||||
message = "Container services are enabled but enableContainers is false";
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ let
|
||||
"drpp"
|
||||
"metube"
|
||||
"multi-scrobbler"
|
||||
"plex-discord-bot"
|
||||
];
|
||||
nativeServicesWithOpenFirewall = inputs.self.lib.getServicesWithNativeFirewall config firewallBlacklist;
|
||||
servicesConfig = lib.listToAttrs (
|
||||
|
||||
@@ -21,7 +21,7 @@ in
|
||||
virtualisation.oci-containers.containers = lib.mkIf enable {
|
||||
flame = lib.mkIf cfg.enable {
|
||||
autoStart = true;
|
||||
image = "pawelmalak/flame";
|
||||
image = "pawelmalak/flame:latest";
|
||||
ports = [ "${toString cfg.port}:${toString cfg.port}" ];
|
||||
volumes = [
|
||||
"${config.my.containerData}/flame:/app/data"
|
||||
@@ -36,7 +36,7 @@ in
|
||||
};
|
||||
flame-nsfw = lib.mkIf cfgS.enable {
|
||||
autoStart = true;
|
||||
image = "pawelmalak/flame";
|
||||
image = "pawelmalak/flame:latest";
|
||||
ports = [ "${toString cfgS.port}:${toString cfg.port}" ];
|
||||
volumes = [ "${config.my.containerData}/flame-nsfw:/app/data" ];
|
||||
environmentFiles = [ config.sops.secrets.flame.path ];
|
||||
|
||||
@@ -11,7 +11,7 @@ in
|
||||
options.my.servers.lidarr = setup.mkOptions "lidarr" "music" 8686;
|
||||
config.virtualisation.oci-containers.containers.lidarr = lib.mkIf cfg.enable {
|
||||
autoStart = true;
|
||||
image = "linuxserver/lidarr:version-3.0.1.4866";
|
||||
image = "linuxserver/lidarr:latest";
|
||||
ports = [ "${toString cfg.port}:${toString cfg.port}" ];
|
||||
environment = {
|
||||
TZ = config.my.timeZone;
|
||||
|
||||
@@ -12,7 +12,7 @@ in
|
||||
config = lib.mkIf (cfg.enable && config.my.secureHost) {
|
||||
sops.secrets.maloja.sopsFile = ../../secrets/env.yaml;
|
||||
virtualisation.oci-containers.containers.maloja = {
|
||||
image = "krateng/maloja:3.2.4";
|
||||
image = "krateng/maloja:latest";
|
||||
ports = [ "${toString cfg.port}:${toString cfg.port}" ];
|
||||
environmentFiles = [ config.sops.secrets.maloja.path ];
|
||||
environment = {
|
||||
|
||||
@@ -10,7 +10,7 @@ in
|
||||
{
|
||||
options.my.servers.metube = setup.mkOptions "metube" "bajameesta" 8881;
|
||||
config.virtualisation.oci-containers.containers.metube = lib.mkIf cfg.enable {
|
||||
image = "ghcr.io/alexta69/metube:2026.01.02";
|
||||
image = "ghcr.io/alexta69/metube:latest";
|
||||
ports = [ "${toString cfg.port}:8081" ];
|
||||
volumes = [
|
||||
"${config.my.containerData}/metube:/downloads"
|
||||
|
||||
@@ -12,7 +12,7 @@ in
|
||||
config = lib.mkIf (cfg.enable && config.my.secureHost) {
|
||||
sops.secrets.multi-scrobbler.sopsFile = ../../secrets/env.yaml;
|
||||
virtualisation.oci-containers.containers.multi-scrobbler = {
|
||||
image = "foxxmd/multi-scrobbler:0.10.0";
|
||||
image = "foxxmd/multi-scrobbler:latest";
|
||||
ports = [ "${toString cfg.port}:${toString cfg.port}" ];
|
||||
environmentFiles = [ config.sops.secrets.multi-scrobbler.path ];
|
||||
environment = {
|
||||
|
||||
@@ -188,7 +188,7 @@ in
|
||||
virtualisation.oci-containers.containers = {
|
||||
go-vod = lib.mkIf config.my.servers.go-vod.enable {
|
||||
autoStart = true;
|
||||
image = "radialapps/go-vod";
|
||||
image = "radialapps/go-vod:latest";
|
||||
environment = {
|
||||
TZ = config.my.timeZone;
|
||||
NEXTCLOUD_HOST = "https://${config.services.nextcloud.hostName}";
|
||||
@@ -256,78 +256,51 @@ in
|
||||
};
|
||||
};
|
||||
})
|
||||
(lib.mkIf (cfg.enableProxy && config.my.enableProxy && config.networking.hostName == "vps") {
|
||||
services.nginx.virtualHosts = {
|
||||
"${cfg.host}" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
http2 = true;
|
||||
default = true;
|
||||
serverAliases = [ "cloud.rotehaare.art" ];
|
||||
extraConfig = ''
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
'';
|
||||
locations = {
|
||||
"/" = {
|
||||
proxyPass = cfg.local;
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
(lib.mkIf (cfgC.enableProxy && config.my.enableProxy) {
|
||||
services.nginx.virtualHosts.${cfgC.host} = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
http2 = true;
|
||||
locations = {
|
||||
# static files
|
||||
"^~ /browser" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonProxyConfig;
|
||||
};
|
||||
};
|
||||
"${cfgC.host}" = lib.mkIf cfgC.enableProxy {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
http2 = true;
|
||||
locations = {
|
||||
# static files
|
||||
"^~ /browser" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonProxyConfig;
|
||||
};
|
||||
# Legacy static files (for compatibility)
|
||||
"^~ /loleaflet" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonProxyConfig;
|
||||
};
|
||||
# WOPI discovery URL
|
||||
"^~ /hosting/discovery" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonProxyConfig;
|
||||
};
|
||||
# Capabilities
|
||||
"^~ /hosting/capabilities" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonProxyConfig;
|
||||
};
|
||||
# download, presentation, image upload and websocket
|
||||
"~ ^/cool" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonWebsocketConfig;
|
||||
};
|
||||
# Legacy websocket (for compatibility)
|
||||
"~ ^/lool" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonWebsocketConfig;
|
||||
};
|
||||
# Admin Console websocket
|
||||
"^~ /cool/adminws" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonWebsocketConfig;
|
||||
};
|
||||
# Legacy Admin Console websocket (for compatibility)
|
||||
"^~ /lool/adminws" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonWebsocketConfig;
|
||||
};
|
||||
# Legacy static files (for compatibility)
|
||||
"^~ /loleaflet" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonProxyConfig;
|
||||
};
|
||||
# WOPI discovery URL
|
||||
"^~ /hosting/discovery" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonProxyConfig;
|
||||
};
|
||||
# Capabilities
|
||||
"^~ /hosting/capabilities" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonProxyConfig;
|
||||
};
|
||||
# download, presentation, image upload and websocket
|
||||
"~ ^/cool" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonWebsocketConfig;
|
||||
};
|
||||
# Legacy websocket (for compatibility)
|
||||
"~ ^/lool" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonWebsocketConfig;
|
||||
};
|
||||
# Admin Console websocket
|
||||
"^~ /cool/adminws" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonWebsocketConfig;
|
||||
};
|
||||
# Legacy Admin Console websocket (for compatibility)
|
||||
"^~ /lool/adminws" = {
|
||||
proxyPass = cfgC.local;
|
||||
extraConfig = commonWebsocketConfig;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
setup = import ../factories/mkserver.nix { inherit lib config; };
|
||||
cfg = config.my.servers.plex-discord-bot;
|
||||
name = "plex-discord-bot";
|
||||
in
|
||||
{
|
||||
options.my.servers.plex-discord-bot = setup.mkOptions name name 0;
|
||||
config.virtualisation.oci-containers.containers.plex-discord-bot = lib.mkIf cfg.enable {
|
||||
image = "ghcr.io/phin05/discord-rich-presence-plex:latest";
|
||||
environment = {
|
||||
DRPP_UID = toString config.users.users.jawz.uid;
|
||||
DRPP_GID = toString config.users.groups.users.gid;
|
||||
};
|
||||
volumes = [
|
||||
"${config.my.containerData}/drpp:/app/data"
|
||||
"/run/user/${toString config.users.users.jawz.uid}:/run/app"
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -75,7 +75,6 @@ in
|
||||
inherit (cfg) port;
|
||||
bind_addresses = [
|
||||
config.my.localhost
|
||||
config.my.localhost6
|
||||
config.my.ips.server
|
||||
config.my.ips.wg-server
|
||||
];
|
||||
|
||||
@@ -12,9 +12,9 @@ in
|
||||
config = lib.mkIf (cfg.enable && config.my.servers.postgres.enable && config.my.secureHost) {
|
||||
sops.secrets.yamtrack.sopsFile = ../../secrets/env.yaml;
|
||||
virtualisation.oci-containers.containers = {
|
||||
yamtrack-redis.image = "redis:7-alpine";
|
||||
yamtrack-redis.image = "redis:latest";
|
||||
yamtrack = {
|
||||
image = "ghcr.io/fuzzygrim/yamtrack";
|
||||
image = "ghcr.io/fuzzygrim/yamtrack:latest";
|
||||
ports = [ "${toString cfg.port}:8000" ];
|
||||
dependsOn = [ "yamtrack-redis" ];
|
||||
environmentFiles = [ config.sops.secrets.yamtrack.path ];
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
stripCidr = cidr: cidr |> lib.splitString "/" |> builtins.head;
|
||||
wgListenIps = config.my.wgInterfaces |> builtins.attrValues;
|
||||
wgListenAddrs = wgListenIps |> builtins.map (ip: "${stripCidr ip}:53");
|
||||
in
|
||||
{
|
||||
options.my.services.network.enable = lib.mkEnableOption "network configuration and services";
|
||||
config = lib.mkIf config.my.services.network.enable {
|
||||
networking = {
|
||||
enableIPv6 = true;
|
||||
firewall.enable = true;
|
||||
firewall = {
|
||||
enable = true;
|
||||
interfaces = lib.mkIf config.my.services.wireguard.enable {
|
||||
wg0 = {
|
||||
allowedTCPPorts = [ 53 ];
|
||||
allowedUDPPorts = [ 53 ];
|
||||
};
|
||||
};
|
||||
};
|
||||
dhcpcd.extraConfig = "nohook resolv.conf";
|
||||
networkmanager = {
|
||||
enable = true;
|
||||
@@ -19,6 +32,16 @@
|
||||
settings = {
|
||||
ipv6_servers = true;
|
||||
require_dnssec = true;
|
||||
log_level = 4;
|
||||
listen_addresses = [
|
||||
"${config.my.localhost}:53"
|
||||
"${config.my.localhost6}:53"
|
||||
]
|
||||
++ lib.optionals config.my.services.wireguard.enable wgListenAddrs;
|
||||
query_log = {
|
||||
file = "/var/lib/dnscrypt-proxy/query.log";
|
||||
format = "tsv";
|
||||
};
|
||||
sources.public-resolvers = {
|
||||
urls = [
|
||||
"https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md"
|
||||
|
||||
@@ -27,6 +27,14 @@ in
|
||||
publicKey = "OUiqluRaS4hmGvLJ3csQrnIM3Zzet50gsqtTABaUkH4=";
|
||||
allowedIPs = [ "${config.my.ips.wg-server}/32" ];
|
||||
}
|
||||
{
|
||||
publicKey = "BwN4uCkMd6eAS5Ugld0oXnA16IhgEEQF8mOJ3+vHliA=";
|
||||
allowedIPs = [ "${config.my.ips.wg-galaxy}/32" ];
|
||||
}
|
||||
{
|
||||
publicKey = "R1xUFOuboQf/yy8ShiXqoCPaPcH3Cn0n4PAWB2rgHTs=";
|
||||
allowedIPs = [ "${config.my.ips.wg-phone}/32" ];
|
||||
}
|
||||
{
|
||||
publicKey = "rFgT6TXzRazK6GMazMNGjtOvzAAPST0LvCfN7QXsLho=";
|
||||
allowedIPs = [ "${config.my.ips.wg-friend1}/32" ];
|
||||
@@ -43,6 +51,18 @@ in
|
||||
publicKey = "yg+2miZCrx89znFaUlU/le/7UIPgEAMY74fZfEwz8g4=";
|
||||
allowedIPs = [ "${config.my.ips.wg-friend4}/32" ];
|
||||
}
|
||||
{
|
||||
publicKey = "u4/6ZYO7lUJZ9QmSlFPUaadq25gwDljjhsfgs/p2amc=";
|
||||
allowedIPs = [ "${config.my.ips.wg-friend5}/32" ];
|
||||
}
|
||||
{
|
||||
publicKey = "GawtOvsZ75avelIri5CjGoPXd8AFpi9qlZ6dSsqUISE=";
|
||||
allowedIPs = [ "${config.my.ips.wg-guest1}/32" ];
|
||||
}
|
||||
{
|
||||
publicKey = "NvhUnErIb0/hi+Hui/o5l5Pq4ZysFVIn1VBPsjoTeCk=";
|
||||
allowedIPs = [ "${config.my.ips.wg-guest2}/32" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -26,11 +26,36 @@
|
||||
exec ${mcpPython}/bin/python -m mcp_server.server
|
||||
'';
|
||||
};
|
||||
vpsLinodeConfig = inputs.self.nixosConfigurations.vps.extendModules {
|
||||
modules = [
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
my.secureHost = lib.mkForce false;
|
||||
my.build.baseImage = true;
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
mcpTests = pkgs.writeShellApplication {
|
||||
name = "mcp-tests";
|
||||
runtimeInputs = with pkgs.python3Packages; [
|
||||
black
|
||||
click
|
||||
mypy
|
||||
pytest
|
||||
ruff
|
||||
];
|
||||
text = ''
|
||||
exec bash ${inputs.self}/scripts/mcp-server/run-tests.sh "$@"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
packages = (inputs.jawz-scripts.packages.${system} or { }) // {
|
||||
emacs-vm = inputs.self.nixosConfigurations.emacs.config.system.build.vm;
|
||||
vps-linode = inputs.self.nixosConfigurations.vps.config.system.build.images.linode;
|
||||
vps-linode = vpsLinodeConfig.config.system.build.images.linode;
|
||||
mcp-tests = mcpTests;
|
||||
nixos-mcp = nixosMcp;
|
||||
nixos-mcp-server = mcpServerPkg;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,16 @@ set -euo pipefail
|
||||
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$here"
|
||||
|
||||
cache_root="${TMPDIR:-/tmp}/mcp-tests-cache"
|
||||
mkdir -p "$cache_root"
|
||||
export HOME="${TMPDIR:-/tmp}/mcp-tests-home"
|
||||
mkdir -p "$HOME"
|
||||
export XDG_CACHE_HOME="$cache_root/xdg"
|
||||
export RUFF_CACHE_DIR="$cache_root/ruff"
|
||||
export MYPY_CACHE_DIR="$cache_root/mypy"
|
||||
export PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} -o cache_dir=$cache_root/pytest"
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
|
||||
fix=false
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = "--fix" ]; then
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
### Reference Map
|
||||
- **Role**: Index mapping core concerns to repo paths for navigation and validation.
|
||||
- **Key Fields**: category (apps, dev, scripts, servers, services, shell, network, users, nix, patches), hosts list (emacs, server, workstation, miniserver, galaxy), secrets files, proxy rules, auto-import rules, stylix/schemes, audit checklist entries, navigation links to constitution/playbooks.
|
||||
- **Key Fields**: category (apps, dev, scripts, servers, services, shell, network, users, nix), root paths (patches), hosts list (emacs, server, workstation, miniserver, galaxy, vps), secrets files, proxy rules, auto-import rules, stylix/schemes, audit checklist entries, navigation links to constitution/playbooks.
|
||||
- **Relationships**: Anchors citations used by Constitution and Playbooks.
|
||||
|
||||
## Constraints and States
|
||||
|
||||
@@ -29,3 +29,8 @@
|
||||
- **Decision**: Gate SOPS configuration behind `config.my.secureHost` so non-secure hosts skip secret loading.
|
||||
- **Rationale**: Aligns `config/base.nix` behavior with the constitution’s secureHost rules and avoids secret dependency on non-secure hosts.
|
||||
- **Alternatives considered**: (a) Leave SOPS enabled on all hosts (rejected: violates secureHost contract); (b) Duplicate SOPS logic per host (rejected: increases drift risk).
|
||||
|
||||
## Decision 7 (2026-02-07): Module categories and patches location; active hosts update
|
||||
- **Decision**: Treat `patches/` as a root-level directory (not a module category) and update active hosts to include `vps`.
|
||||
- **Rationale**: Repo structure places patches at the root and hosts include `vps`; documentation must reflect actual paths and host inventory.
|
||||
- **Alternatives considered**: (a) Move `patches/` under `modules/` (rejected: would change repo layout); (b) Keep `vps` undocumented (rejected: causes host list drift).
|
||||
|
||||
@@ -89,6 +89,6 @@ An AI or contributor can update the constitution and use-case docs when repo rul
|
||||
### Measurable Outcomes
|
||||
|
||||
- **SC-001**: An AI with only these docs can describe the correct steps and file locations to add a new server module in under 2 minutes of reading time, matching existing patterns.
|
||||
- **SC-002**: The constitution explicitly enumerates 100% of current module categories (apps, dev, scripts, servers, services, shell, network, users, nix, patches) and active hosts (emacs, server, workstation) with their roles.
|
||||
- **SC-002**: The constitution explicitly enumerates 100% of current module categories (apps, dev, scripts, servers, services, shell, network, users, nix), documents the root `patches/` directory, and lists active hosts (emacs, server, workstation, miniserver, galaxy, vps) with their roles.
|
||||
- **SC-003**: Guidance includes the full secrets file map (certs/env/gallery/homepage/keys/wireguard/secrets) and secureHost behavior with no omissions when audited against the repository.
|
||||
- **SC-004**: Playbook locations and required fields are discoverable via the documented index in ≤2 navigation steps from the top of the spec.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
- Apply nftables/NixOS firewall rules derived from the iptables reference
|
||||
- Enable wireguard on VPS and expose port
|
||||
- Add service users and admin SSH keys
|
||||
- Update VPS public IP to `45.33.0.228` in SSH configuration
|
||||
- Update VPS public IP to `45.79.25.87` in SSH configuration
|
||||
- Update host server VPN client to target the new VPS
|
||||
|
||||
4. Provide and review legacy proxy config snapshot:
|
||||
@@ -82,7 +82,7 @@
|
||||
- **T002**: verify this section exists in `/home/jawz/Development/NixOS/specs/004-vps-migration/quickstart.md`
|
||||
- **T003**: `rg -n "mainServer|enableProxy" hosts/server/toggles.nix modules/modules.nix`
|
||||
- **T004**: `rg -n "wireguard|wg0|services.wireguard" modules/services/wireguard.nix hosts/vps/configuration.nix`
|
||||
- **T005**: `rg -n "vps|45.33.0.228|programs.ssh" config/jawz.nix modules/modules.nix`
|
||||
- **T005**: `rg -n "vps|45.79.25.87|programs.ssh" config/jawz.nix modules/modules.nix`
|
||||
- **T006**: `rg -n "/etc/caddy/Caddyfile.d" sudo_hist jawz_hist`
|
||||
- **T007**: `rg -n 'mainServer = "vps"' hosts/server/toggles.nix modules/modules.nix`
|
||||
- **T008**: `rg -n "enableProxy = true" hosts/vps/toggles.nix hosts/vps/configuration.nix hosts/server/toggles.nix`
|
||||
|
||||
@@ -46,7 +46,7 @@ I need you to create the service users and groups for deploy and lidarr-reports.
|
||||
in those, I need you to add ./secrets/ssh/ed25519_deploy.pub to authorized_keys for the user deploy
|
||||
and for lidarr-reports ed25519_lidarr-reports.pub
|
||||
|
||||
6. similar to every other host, add ssh login authorized_keys for workstation, server, deacero, galaxy and check if Im missing one. Because this will replace the ssh vps on the ssh config, you need to replace the existing vps ip with 45.33.0.228. 7. change the configuration on the host server, so that its wireguard session, connects to this server (i think will ve done automagically when the ip changes right?) 8. Ive added sudo_hist and jawz_hist, which are a dump of the histfile of this server, just check if there is a configuration that Im missing, something I did on there that I missed, and add it to the clarification list, so when I run clarify I tell you if I want that or not, granted lots of those commands are trial and error, so I think I have everything. 9. I have setup a plausible server, write the steps necesary to migrate it, I dont know.
|
||||
6. similar to every other host, add ssh login authorized_keys for workstation, server, deacero, galaxy and check if Im missing one. Because this will replace the ssh vps on the ssh config, you need to replace the existing vps ip with 45.79.25.87. 7. change the configuration on the host server, so that its wireguard session, connects to this server (i think will ve done automagically when the ip changes right?) 8. Ive added sudo_hist and jawz_hist, which are a dump of the histfile of this server, just check if there is a configuration that Im missing, something I did on there that I missed, and add it to the clarification list, so when I run clarify I tell you if I want that or not, granted lots of those commands are trial and error, so I think I have everything. 9. I have setup a plausible server, write the steps necesary to migrate it, I dont know.
|
||||
|
||||
10. add verification steps for every task we did, when youre done and"
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ Deliver MVP as User Story 1 (primary host reverse proxy + keep services on host
|
||||
- [x] T017 [US3] Configure sshd port and auth settings in hosts/vps/configuration.nix to match: Port 3456, PermitRootLogin no, PasswordAuthentication no
|
||||
- [x] T018 [US3] Harden remote rebuild access by switching to a non-root SSH user for rebuilds (nixremote) and requiring sudo for nixos-rebuild in hosts/vps/configuration.nix and modules/users/nixremote.nix
|
||||
- [x] T019 [US3] Restrict SSH access for remote rebuilds by limiting allowed users/keys for nixremote (update inputs.self.lib.getSshKeys list in hosts/vps/configuration.nix)
|
||||
- [x] T020 [US3] Update VPS IP to 45.33.0.228 in modules/modules.nix and config/jawz.nix SSH host entry
|
||||
- [x] T020 [US3] Update VPS IP to 45.79.25.87 in modules/modules.nix and config/jawz.nix SSH host entry
|
||||
- [x] T021 [US3] Update host server wireguard client configuration in hosts/server/configuration.nix to target the new VPS endpoint
|
||||
|
||||
## Phase 6: User Story 4 (P3) - Migration gaps and verification
|
||||
|
||||
Reference in New Issue
Block a user