Compare commits

...
666 Commits
Author SHA1 Message Date
Alexander Heldt 9d837f7fbd Update rv flake input 2026-11-25 17:30:00 +01:00
Alexander Heldt ad36d245cc Update ct flake input 2026-11-25 17:29:46 +01:00
Alexander Heldt 045e8e292a pinwheel: Read rv's teams from a secret
rv watches a second team now. Both are listed in the work-rv-teams
secret and read through rv's teamsFile, so the work module does not
name the organisation.
2026-11-25 17:25:32 +01:00
Alexander Heldt fabe57023d pinwheel: Open rv's notifications in the work Firefox profile
rv opens its web UI with $BROWSER, and the browser script sends links to
ff-work only when started under ~/code/work. The rv service ran from the
home directory, so a middle-click on a review notification opened the
UI in ff-alex. Run the service from ~/code/work instead.
2026-11-25 16:21:38 +01:00
Alexander Heldt bebeaeb2e1 pinwheel: Skip worktrees that conflict in wt sync
gt restack stops at a merge conflict mid-rebase, so wt sync left that
worktree half rebased. It now aborts the restack with `gt abort --force`
(without --force it waits for a confirmation prompt), leaving the
worktree as it was, carries on with the rest, and lists the conflicted
worktrees apart from those that failed for other reasons. Restacks run
with --no-interactive so a prompt cannot stall the loop.
2026-11-25 15:30:28 +01:00
Alexander Heldt 9f45ebfb0c Update rv flake input 2026-11-25 09:53:58 +01:00
Alexander Heldt 593f8e6602 pinwheel: Show what the branch changes in .envrc, not its diff from main
The prompt showed `git diff main -- .envrc`, so a branch made before
main changed .envrc showed main's new lines as removed, as if the
branch deleted them. It now shows the branch's own changes, from where
it branched off main, and lists the commits that changed .envrc on main
since then.
2026-11-25 09:25:47 +01:00
Alexander Heldt 19fb6dcf67 pinwheel: Ask before allowing a worktree's .envrc that differs from main's
wt allowed a new worktree's .envrc only when it matched the primary
checkout's, and left it blocked otherwise. A branch based on an older
main has an older .envrc, so its worktree stayed blocked, `direnv exec`
failed, no .bsp/pants.json was written and Metals set up scala-cli
instead. The warning saying so scrolled away when a review started
Emacs.

It now compares with main's .envrc: the same content is allowed as
before, and different content is shown as a diff with a y/N prompt
before anything else runs. Comparing with main rather than the primary's
working copy also stops wt allowing content that was never approved in
the primary.
2026-11-25 08:51:24 +01:00
Alexander Heldt 75591b8bb6 pinwheel: Add rv, the review request watcher
rv (alex/rv on gitea) watches GitHub for pull requests that request a
review from me or from my team at work, notifies on each,
and lists them in a web UI on 127.0.0.1:7778 that opens a review in its
own worktree with Emacs. programs.rv runs `rv serve` as a systemd user
service with the work GitHub token, on the same condition as the other
GitHub-backed work tools.
2026-11-24 18:03:24 +01:00
Alexander Heldt 0e6e7bec8d pinwheel: Prune deleted worktrees in wt sync
A worktree whose directory was deleted by hand stays registered in git,
so `wt sync` ran `gt restack` in a directory that no longer existed and
reported the worktree as failed. It now runs `git worktree prune` before
going through the worktrees, which drops only entries whose directory
is gone.
2026-11-24 17:29:46 +01:00
Alexander Heldt 2fefe711b5 pinwheel: Write .bsp/pants.json in new worktrees
`.bsp/` is gitignored, so a worktree started without the Pants BSP
connection file. Metals then found no build server, ran `scala-cli
setup-ide` and compiled the whole repo as one Scala 3 project with no
third-party dependencies, so go to definition found nothing and
semanticdb never appeared.

When the primary checkout has `.bsp/pants.json`, `wt` now runs `pants
experimental-bsp` in each worktree it adds, in that worktree's devshell
and without starting a pantsd. The runner script it writes records the
devshell's PATH and the checkout's log path, so it is generated rather
than copied from the primary. When direnv cannot load, as when the
`.envrc` differs from the primary's, `wt` says what to run instead.
2026-11-24 17:22:45 +01:00
Alexander Heldt 1eb0b84bd2 pinwheel: Add wt --help and reject unknown wt options
An unknown option such as `-b` or `--help` was taken as a branch name
and passed on to `git worktree add`, which read it as its own option:
`--help` printed git's usage and `-b` failed asking for a value. `wt`
now prints its own usage for `-h`/`--help`, moved there from the
comment at the top of the file, and rejects any other option.
2026-11-24 10:33:11 +01:00
Alexander Heldt bc13103bf2 pinwheel: Run wt sync from the primary checkout
In a worktree, `gt sync` deletes a merged current branch by first
switching to main, which git refuses while the primary has main checked
out. `wt sync` now runs `gt sync` in the primary, which leaves a merged
branch checked out in a worktree alone.

Worktrees whose PR is merged are no longer restacked. They stay until
removed with `wt rm`, so a session in one can still be resumed. The
merged PRs are read from gt's `.graphite_pr_info` cache, which `gt sync`
has just refreshed; gt has no command that lists them.
2026-11-24 10:27:39 +01:00
Alexander Heldt 69ab490919 pinwheel: Add wt sync to restack every worktree
`gt sync` skips branches checked out in another worktree, so a stack
living in one stays on the old main. `wt sync` runs `gt sync`, then
`gt restack` in each worktree not on main. A conflict in one worktree
leaves it mid-rebase and does not stop the others; the failed
worktrees are listed at the end and the exit status is 1.
2026-11-23 08:14:32 +01:00
Alexander Heldt 5d3629715d pinwheel: Add wt for git worktrees beside the primary checkout
`wt <branch>` goes to the worktree holding a branch, creating one in
`<primary>.worktrees/<branch>` if needed; `wt -c` starts a new
Graphite-tracked branch off main in its own worktree; `wt rm` removes
one and keeps the branch.

A new worktree gets `direnv allow` only when its `.envrc` matches the
primary's. In backend it also gets a `.pants.rc` pinning `find_links`
to the primary's `dist/`: `pants.toml` sets it to the checkout's own
path, which put the path into every `requirements.pex` cache key and
made each worktree rebuild them. No lockfile resolves from it.
2026-11-22 18:25:33 +01:00
Alexander Heldt 566d09ffb3 Update ndp flake input 2026-11-22 15:53:42 +01:00
Alexander Heldt 27ba636ce8 Update dagbok flake input 2026-11-20 11:30:41 +01:00
Alexander Heldt 91d6fe4eec Update dagbok flake input 2026-11-20 10:31:03 +01:00
Alexander Heldt f840d76ac2 Update ct flake input 2026-11-20 10:30:53 +01:00
Alexander Heldt 09be69bfea Update ndp flake input 2026-11-20 10:27:50 +01:00
Alexander Heldt b55b960549 pinwheel: Give ndp an Anthropic API key for asking an LLM 2026-11-20 10:27:50 +01:00
Alexander Heldt c908e1356d manatee: Remove solo-referee module and flake input 2026-11-20 08:56:34 +01:00
Alexander Heldt 14d6277b71 Update ndp flake input 2026-11-17 16:47:41 +01:00
Alexander Heldt 13a5c2b4b4 Update dagbok flake input 2026-11-17 14:55:46 +01:00
Alexander Heldt d4d9f5c5aa pinwheel: Turn off code-action hints with refactor-indications
Eglot 1.25 moved code actions to the `refactor` package and made
`eglot-code-action-indications` an obsolete alias for
`refactor-indications`. The alias is set before eglot loads, so the
setting no longer applies and the `refactor` default comes back. Its
eldoc hint then takes the one-line echo area, hiding the hover
signature.
2026-11-17 14:25:42 +01:00
Alexander Heldt 391b08b225 Update ndp flake input 2026-11-17 10:38:18 +01:00
Alexander Heldt 11e7385f02 pinwheel: Fix webcam breaking after resume from hibernation
Hibernation powers off the Lattice USBIO bridge that the ov08x40
sensor and Intel CVS sit behind. usbio has no reset_resume callback,
so on restore the USB core unbinds and rebinds it, which re-creates
the sensor and CVS I2C clients. The new clients lack the fwnode graph
that ipu-bridge built at boot, and ipu-bridge never rebuilds it, so
the camera stays dead until a cold boot.

Patch usbio to redo the bridge handshake in reset_resume instead of
being rebound, and patch gpio-usbio to restore its pin configuration
and output values after such a reset. Both are built from the kernel
source and installed under updates/, sharing the build recipe with
the patched ipu6-isys module.
2026-11-17 10:36:46 +01:00
Alexander Heldt 5e1047f28a Update ndp flake input 2026-11-17 10:36:46 +01:00
Alexander Heldt 008ffd529a pinwheel: Install picard plugin replaygain2 from a pinned source 2026-11-17 09:07:05 +01:00
Alexander Heldt 10e7157e3f Update ndp flake input 2026-11-16 22:14:11 +01:00
Alexander Heldt a702333b8c pinwheel: Scale picard by 1.5 with QT_SCREEN_SCALE_FACTORS 2026-11-16 22:13:41 +01:00
Alexander Heldt fbe9d10fd9 pinwheel: Add picard with the replaygain2 plugin 2026-11-16 22:03:18 +01:00
Alexander Heldt 31ecedfda3 Update ct flake input 2026-11-16 09:04:42 +01:00
Alexander Heldt efbf76a268 Update dagbok flake input 2026-11-16 09:04:32 +01:00
Alexander Heldt 70c437c5f4 Update ct flake input 2026-11-15 21:42:40 +01:00
Alexander Heldt 1f90f07583 Update dagbok flake input 2026-11-15 21:28:30 +01:00
Alexander Heldt 99413dfc02 Update dagbok flake input 2026-11-15 21:18:01 +01:00
Alexander Heldt 503777d0e4 Update ndp flake input 2026-11-15 21:04:07 +01:00
Alexander Heldt be1afd6386 Update dagbok flake input 2026-11-15 15:50:10 +01:00
Alexander Heldt 31a84ff975 Update ndp flake input 2026-11-15 15:49:49 +01:00
Alexander Heldt 42247d2ccd pinwheel: Name the exit node in the tailscale connect notification
The notification shows the exit node's hostname, followed by its city
and country when tailscale knows the node's location.
2026-11-15 15:49:20 +01:00
Alexander Heldt b5a1bdb36f pinwheel: Hibernate instead of suspend when the battery is low
Adds a swap file to hold the hibernation image. The low battery timer and
UPower's critical action now hibernate, and SUPER+SHIFT+x uses
`suspend-then-hibernate` so a suspended laptop hibernates before the
battery runs out.
2026-11-15 15:08:35 +01:00
Alexander Heldt 94f98120cc backwards: Replace tailscale-qs with the official tailscale systray
The `tailscale-qs` extension's node list could not be opened. The
official `tailscale systray` shows the nodes and exit nodes, with the
AppIndicator extension providing a tray in GNOME. The systray never
retries if no tray exists when it starts, so it waits for one first.
2026-11-13 19:42:38 +01:00
Alexander Heldt 7b9231fae6 backwards: Add a raw touchpad bridge for the K400 Plus
The K400 Plus firmware turns two-finger swipes into whole wheel ticks, so
every scroll jumps a fixed distance. A trimmed copy of k400-raw's touchpad
mode switches the touchpad to raw HID++ reporting and exposes it as a
native multitouch touchpad, which GNOME scrolls smoothly.
2026-11-13 19:02:11 +01:00
Alexander Heldt a5bf40eb13 pinwheel: Autoload every dagbok command the README lists 2026-11-13 10:20:06 +01:00
Alexander Heldt 8328157778 pinwheel: Autoload dagbok-refresh instead of the removed dagbok-reload 2026-11-13 10:20:06 +01:00
Alexander Heldt 19770ff258 Update puppy-tracker flake input 2026-11-13 09:14:40 +00:00
Alexander Heldt 71e0d3ad85 manatee: Send Galleriet and disk SMART alerts only to the Pixel
Only the fridge door and water leak alerts need to reach both phones.
2026-11-13 09:14:34 +00:00
Alexander Heldt 7e27822dbc Update dagbok flake input 2026-11-13 10:14:00 +01:00
Alexander Heldt e031163100 Update ndp flake input 2026-11-13 10:14:00 +01:00
Alexander Heldt d7231bec8b pinwheel: Autoload dagbok-year instead of the removed dagbok-open-date 2026-11-13 10:14:00 +01:00
Alexander Heldt 260a3e8a91 Update ct flake input 2026-11-13 10:14:00 +01:00
Alexander Heldt e143f9c00f Update dagbok flake input 2026-11-13 10:14:00 +01:00
Alexander Heldt 24942b532c Update ndp flake input 2026-11-13 10:14:00 +01:00
Alexander Heldt cc73f6bfe8 pinwheel: Toggle the work VPN from waybar without sudo 2026-11-13 10:14:00 +01:00
Alexander Heldt dd8238b3c1 manatee: Alert when Galleriet is above 23°C and notify both phones
Add a `binary_sensor.galleriet_too_warm` template sensor and an alert
that repeats hourly while it's on. Send all Home Assistant
notifications through a `phones` notify group so they reach both the
Pixel and the iPhone, with a critical alert on iOS for water leaks.
2026-11-11 08:57:51 +00:00
Alexander Heldt 490f16ab62 pinwheel: Pass shift+enter and other modified keys through tmux 2026-11-09 14:47:37 +01:00
Alexander Heldt a14ab23497 Update dagbok flake input 2026-11-09 12:46:17 +00:00
Alexander Heldt 2e5d6a638a Update dagbok flake input 2026-11-09 13:17:21 +01:00
Alexander Heldt 799ed089df Update ndp flake input 2026-11-09 13:14:27 +01:00
Alexander Heldt 3ca3c36a8d pinwheel: Show ndp in the waybar music status 2026-11-09 08:42:40 +01:00
Alexander Heldt 73ea89fd01 Update ndp flake input 2026-11-09 07:54:36 +01:00
Alexander Heldt a548a7978b Update ndp flake input 2026-11-08 19:26:10 +01:00
Alexander Heldt d3b3ff9a7b Update ndp flake input 2026-11-08 19:10:01 +01:00
Alexander Heldt eeecb7efc0 manatee: Configure lbsync from an agenix secret 2026-11-08 18:49:48 +01:00
Alexander Heldt 5983a2d821 Update ndp flake input 2026-11-08 18:49:48 +01:00
Alexander Heldt bcfd1f3602 manatee: Run the lbsync Navidrome plugin 2026-11-08 15:49:02 +01:00
Alexander Heldt 1a35a5ba2a Update ndp flake input 2026-11-08 15:49:02 +01:00
Alexander Heldt b9211e2767 pinwheel: Control ndp with the media keys 2026-11-08 15:23:34 +01:00
Alexander Heldt 57fb4835b6 pinwheel: Add ndp, a terminal player for Navidrome
The player's config is generated by its home-manager module; the Navidrome
password stays in an agenix secret that the config reads at startup.
2026-11-08 15:20:00 +01:00
Alexander Heldt 22c5319398 manatee: Add an SSH key for reaching tadpole
Add `alex.manatee-tadpole`, a passphrase-protected key, with a `tadpole`
host entry in manatee's SSH config. tadpole authorizes it next to the
key from pinwheel.
2026-11-07 18:33:06 +00:00
Alexander Heldt 31b55aea1d tadpole: Redirect www.heldtenkelt.se to heldtenkelt.se
www gets its own ACME certificate so that a problem with it can't block
the certificate for heldtenkelt.se.
2026-11-07 15:05:12 +00:00
Alexander Heldt 00d58b9cf8 tadpole: Host heldtenkelt.se
Add the heldtenkelt.se-site flake as an input and serve it with nginx
on tadpole, with its own ACME certificate.
2026-11-07 14:59:33 +00:00
Alexander Heldt 019110b1b4 Update dagbok flake input 2026-11-07 14:35:25 +00:00
Alexander Heldt 8f838752b8 Update dagbok flake input 2026-11-05 14:52:09 +00:00
Alexander Heldt 46c487332f Update dagbok flake input 2026-11-05 08:27:48 +00:00
Alexander Heldt cac5a2b1ef Update ct flake input 2026-11-05 08:46:24 +01:00
Alexander Heldt 49fb9a2c69 Update dagbok flake input 2026-11-05 07:45:16 +00:00
Alexander Heldt 5f6fe7df39 Update dagbok flake input 2026-11-03 14:33:01 +01:00
Alexander Heldt f6fdb33a6e pinwheel: Make tmux pane borders visible
The borders used the terminal background color since the switch to
the grayscale palette, which hid them against the panes. Draw them in
the dim gray used for inactive window names instead.
2026-11-03 14:27:56 +01:00
Alexander Heldt 35f75bb6c7 Update dagbok flake input 2026-11-03 14:22:55 +01:00
Alexander Heldt 2db18e425e pinwheel: Restore claude and emacs panes with tmux-resurrect 2026-11-03 14:22:55 +01:00
Alexander Heldt 914f86db85 pinwheel: Increase foot font size to 17 2026-11-03 14:21:39 +01:00
Alexander Heldt 1034ede3d4 pinwheel: Save and restore tmux sessions with resurrect and continuum 2026-11-03 13:46:56 +01:00
Alexander Heldt 5662ac7055 pinwheel: Fix intermittent webcam failure from IPU6 isys oops
On 7.3 the in-tree IPU6 isys driver can be runtime-suspended while
isys_probe() is still running, before it has set drvdata. The suspend
callback then dereferences a NULL isys, oopses, and psys never probes,
so /dev/ipu-psys0 is missing and the camera HAL fails with "Failed to
open PSYS".

Patch the isys runtime PM callbacks to return early when drvdata is
not set yet. The patched module is built on its own from the kernel
source and installed under updates/, so it overrides the in-tree one
without having to rebuild the whole kernel.
2026-11-03 13:46:56 +01:00
Alexander Heldt 6c4f99d772 pinwheel: Make claude settings writable with nix as defaults 2026-11-03 12:05:53 +01:00
Alexander Heldt 9f48601cbe pinwheel: Rename Emacs theme to sodium 2026-11-03 10:18:40 +01:00
Alexander Heldt 70ab4a27e7 pinwheel: Match tig colors to theme and show added lines in green 2026-11-03 10:05:27 +01:00
Alexander Heldt 1bb3bb7d30 Update ct flake input 2026-11-03 09:50:15 +01:00
Alexander Heldt 9afcbdb3a3 pinwheel: Show green as a muted green in terminals 2026-11-03 09:48:52 +01:00
Alexander Heldt 0cfd42e55a pinwheel: Brighten terminal background and soften text color 2026-11-03 09:28:12 +01:00
Alexander Heldt 9305627a02 pinwheel: Use amber instead of red for decorative Emacs faces 2026-11-03 09:28:12 +01:00
Alexander Heldt cfce92cdc0 pinwheel: Replace purple color scheme with grayscale and amber
Terminals, tmux and Emacs share a grayscale palette with amber
accents instead of Dracula, and the desktop bars and menus use a
matching gray background.
2026-11-03 09:28:12 +01:00
Alexander Heldt 3f319e182f pinwheel: Tint work Firefox toolbars instead of outlining the window 2026-11-03 09:28:12 +01:00
Alexander Heldt edf22641fb pinwheel: Outline work Firefox window instead of tab tops 2026-11-03 09:28:12 +01:00
Alexander Heldt 0c2be0fd29 pinwheel: Restore rounded corners on Firefox tabs 2026-11-03 09:28:12 +01:00
Alexander Heldt 34997adb1b Update dagbok flake input 2026-11-03 08:26:55 +00:00
Alexander Heldt 4026b7e92e manatee: Wait for ZFS mounts before starting sandboxed /mnt/media services 2026-11-02 10:55:35 +00:00
Alexander Heldt adb5d96d88 Update ct flake input 2026-11-02 11:54:26 +01:00
Alexander Heldt 2d99a181ad Update dagbok flake input 2026-11-02 10:19:05 +01:00
Alexander Heldt 1a9a5876b0 pinwheel: Unpin tailscale 2026-11-02 10:08:06 +01:00
Alexander Heldt 84a6eb218b pinwheel: Remove rounded corners from Firefox tabs 2026-11-02 10:07:11 +01:00
Alexander Heldt c547ed8d31 pinwheel: Disable Firefox "Smart Window" 2026-11-02 10:06:04 +01:00
Alexander Heldt 069a68c1e5 Update flake inputs 2026-11-02 08:10:31 +00:00
Alexander Heldt c0b9468e7b Update dagbok flake input 2026-11-02 08:02:32 +00:00
Alexander Heldt 296db9f211 Update schema flake input 2026-11-02 07:40:20 +00:00
Alexander Heldt 362db5510d tadpole: Drop removed DOMAIN setting from gitea 2026-11-02 08:33:31 +01:00
Alexander Heldt 65ea283827 Update flake inputs 2026-11-02 07:23:31 +00:00
Alexander Heldt 18df705f9d manatee: Reload Plejd when its BLE link goes stale
pyplejd keeps using a dead BLE client ("Service Discovery has not been
performed yet") instead of reconnecting, which left the Plejd lights
unreachable for two days. Fire system log events and let an automation
reload the integration when that warning shows up.

Also add systemd to bt-reset's PATH so its `systemctl` calls work.
2026-11-02 07:22:57 +00:00
Alexander Heldt d1c6b5f957 pinwheel: Configure ct through its Home Manager module 2026-10-29 11:45:02 +01:00
Alexander Heldt 6542e1b90c pinwheel/manatee: Drop tmux r reload binding in favour of R from tmux-sensible 2026-10-29 08:45:28 +01:00
Alexander Heldt 8f24781588 Update ct flake input 2026-10-28 15:10:23 +01:00
Alexander Heldt 470c6a00f8 pinwheel: Add ct for side threads in Claude Code sessions
Install ct from its flake, with its config, a tmux menu on prefix T and a user service for the web UI. Also keep Claude Code transcripts for ten years instead of 30 days, since threads are meant to be revisited.
2026-10-27 14:49:43 +01:00
Alexander Heldt 4380fada9d pinwheel: Add screenshot annotation with satty
Shift-prefixed screenshot bindings pipe the capture to satty, and notifications use a short timeout so they are not captured.
2026-10-27 09:59:09 +01:00
Alexander Heldt 4fe2e6a409 pinwheel: Copy to clipboard via OSC 52 in Emacs so it works over SSH 2026-10-26 15:41:53 +01:00
Alexander Heldt cf08957d58 pinwheel: Add Emacs command to copy file path with line number 2026-10-26 15:41:53 +01:00
Alexander Heldt b095ec1148 Update dagbok flake input 2026-10-26 14:41:27 +00:00
Alexander Heldt 0a3794cb29 Update dagbok flake input 2026-10-26 12:50:52 +00:00
Alexander HeldtandClaude Opus 5.5 5888c8e975 manatee: Alert on kitchen water leak
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 07:37:24 +00:00
Alexander Heldt f592fa3790 Update dagbok flake input 2026-10-23 12:00:14 +02:00
Alexander Heldt 658fb7f0e2 pinwheel: Lock instead of suspend on lid close
Have logind ignore the lid switch and suspend/hibernate keys so the
machine stays reachable over SSH with the lid closed. SUPER + SHIFT + x
remains the way to suspend; closing the lid now only locks the screen.
2026-10-22 19:37:42 +02:00
Alexander Heldt 155cd7d3e4 pinwheel: Fix webcam frame drops and raise resolution to 1080p
With the default 6 icamerasrc buffers the camera HAL ran out of pending
requests and dropped every fourth sensor frame, capping output at ~22.5 fps.
Using 10 buffers keeps the request queue fed and restores 30 fps.
2026-10-22 19:37:42 +02:00
Alexander Heldt eb590a986e Update dagbok flake input 2026-10-22 17:37:20 +00:00
Alexander Heldt d9f0d25efc Update dagbok flake input 2026-10-21 08:36:30 +02:00
Alexander Heldt d07912a8a7 backwards/pinwheel: Add SSH key for backwards to access pinwheel
Pinwheel's sshd had no way to accept keys from other hosts. Give it the
same `authorizedKeysCommand` setup as backwards and manatee, and authorize
a new `alex.backwards-pinwheel` key that backwards uses for `ssh pinwheel`.
2026-10-20 21:59:21 +02:00
Alexander Heldt 0f3a40fb1c backwards: Disable rtw88 power saving 2026-10-20 21:20:31 +02:00
Alexander Heldt 369affc7e7 backwards: Disable i915 display power saving 2026-10-20 21:20:31 +02:00
Alexander Heldt 72a14b04b4 backwards: Enable Steam and let it use the 8BitDo pad
`hid_nintendo` claims the pad when it is in Nintendo Switch mode, which
leaves Steam unable to reach it through hidraw. Blacklist the module and
tag the device with `uaccess` so Steam can open it.
2026-10-20 21:20:31 +02:00
Alexander Heldt 4a1e3356b0 backwards: Replace nix-gc-env with nh clean
`nix.gc` run as root cannot prune generations under
`~/.local/state/nix/profiles` (NixOS/nix#8508), and `nix-gc-env` only
looks in `/nix/var/nix/profiles`. Home-manager generations therefore
accumulated since August 2024 and filled the disk.

`nh clean all` enumerates users and walks their per-user profiles too.
It replaces `nix.gc.automatic`, which cannot be enabled alongside it.
2026-10-20 21:20:31 +02:00
Alexander Heldt 42e6d2e12f backwards/manatee/tadpole: Clean /tmp on boot
Only `pinwheel` set this. Elsewhere files in `/tmp` survived reboots,
and leftover `nh` build result symlinks there kept acting as GC roots,
pinning store paths that should have been collected.
2026-10-20 21:20:31 +02:00
Alexander Heldt f0920d4935 backwards: Add tailscale-qs GNOME extension for switching exit nodes 2026-10-20 21:20:31 +02:00
Alexander Heldt 165d3fc1a5 Update dagbok flake input 2026-10-20 14:01:47 +02:00
Alexander Heldt 2f731adb7b Update schema flake input 2026-10-20 09:04:31 +00:00
Alexander Heldt 40bb9e1b08 Update dagbok flake input 2026-10-20 09:04:17 +00:00
Alexander Heldt 9d6222576f Update dagbok flake input 2026-10-15 11:52:40 +00:00
Alexander Heldt 12d42c9993 manatee: Remove stale restic locks before each backup 2026-10-15 13:38:44 +02:00
Alexander Heldt d369baa176 Update dagbok flake input 2026-10-13 12:47:11 +00:00
Alexander Heldt 84c45f58f3 Update dagbok flake input 2026-10-13 09:50:12 +00:00
Alexander Heldt bf16ce10e5 Update whib-frontend flake input 2026-10-13 11:48:14 +02:00
Alexander Heldt 31a85fdb1d Update dagbok flake input 2026-10-13 07:55:28 +00:00
Alexander Heldt bd5f876657 pinwheel: Add dagbok Emacs client
Built from the dagbok flake's Emacs overlay, reading the shared token
from agenix.
2026-10-12 16:31:14 +02:00
Alexander Heldt ed6d4020d4 manatee: Add dagbok
Served at dagbok.ppp.pm through nginx from 127.0.0.1:8093, with its token
from agenix, a Hetzner DNS-01 certificate, a dynamic DNS record and a
state backup snapshot.
2026-10-12 16:31:14 +02:00
Alexander Heldt 36bb877a81 Update schema flake input 2026-10-12 14:18:36 +00:00
Alexander Heldt 5ef3865aff Update schema and puppy-tracker flake inputs 2026-10-04 18:24:42 +00:00
Alexander Heldt 6d4244b606 manatee: Drop the schema/puppy-tracker link and its secret
The link was removed from both apps, so the commented-out config for it
and the shared schema-puppy-token secret go too.
2026-10-04 18:18:08 +00:00
Alexander Heldt 28a75751db manatee: Back up SQLite databases of DynamicUser services
/var/lib/<name> is a symlink into /var/lib/private for those, so find
stopped at the link and the state dump never copied their databases
(schema, puppy-tracker, todo, …). Follow it with find -H.
2026-10-04 16:36:33 +00:00
Alexander Heldt 8ad7dd91c8 manatee: Cap ZFS ARC at 4 GiB 2026-10-04 16:36:33 +00:00
Alexander Heldt cab8ae02d6 pinwheel: Give the webcam v4l2loopback device more buffers 2026-10-02 09:45:20 +02:00
Alexander Heldt d5970e07f9 pinwheel: Route browser links to work firefox profile from work checkouts 2026-10-02 09:16:32 +02:00
Alexander Heldt 5a9e9fc790 pinwheel: Open gcloud links in work firefox profile 2026-10-02 08:59:12 +02:00
Alexander Heldt affa19cc33 pinwheel: Use alt instead of ctrl for atuin numeric shortcuts 2026-10-02 08:55:17 +02:00
Alexander Heldt e3370e32c4 pinwheel: Skip local network access checks for work domains in firefox 2026-10-02 08:54:52 +02:00
Alexander Heldt d80056572b pinwheel: Read atuin key from age secret, keep up arrow for zsh history 2026-10-01 08:56:55 +02:00
Alexander Heldt bb390db2d9 manatee: Disable atuin open registration 2026-10-01 08:56:55 +02:00
Alexander Heldt 239964d29d pinwheel: Add atuin, syncing to manatee 2026-10-01 08:34:32 +02:00
Alexander Heldt 43c77b7673 manatee: Add self-hosted atuin sync server 2026-10-01 08:34:32 +02:00
Alexander Heldt 95f8f6ac4c Update whib flake inputs 2026-09-30 17:48:39 +00:00
Alexander HeldtandClaude Opus 5.5 15cb5cccf0 test-vm: Serve whib-frontend with nginx
The WHIB frontend module no longer runs a container or has a `port`
option. Forward host port 8081 to nginx in the VM instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 17:46:06 +00:00
Alexander Heldt 86c1688847 pinwheel: Use empty strings for ai attribution settings 2026-09-30 10:00:14 +02:00
Alexander Heldt 03075526e2 Update puppy-tracker flake input 2026-09-30 07:49:25 +00:00
Alexander Heldt f3b70efeb0 manatee: Fetch schema from gitea
Point the schema input at its repo instead of a local path, so the
config builds from anywhere.
2026-09-30 07:48:39 +00:00
Alexander Heldt 65f983673c manatee: Add schema
The household weekly plan at schema.ppp.pm: its module, certificate,
DNS record, backup and secrets. The link to puppy-tracker is prepared
but commented out until puppy-tracker with the integration feed is
deployed.
2026-09-30 07:33:57 +00:00
Alexander Heldt a71d622f6c romm: Let the database container own its data directory
tmpfiles re-applied root:root to /var/lib/romm/db on every switch. A
MariaDB running as uid 999 then could not delete tc.log on shutdown,
so the next start took it for a crash and failed recovery with "Bad
magic header in tc log".
2026-09-30 07:33:57 +00:00
Alexander Heldt 1a65d5586d certs: Use lego v5 flag names
lego v5 renamed --dns.propagation-wait to --dns.propagation.wait and
--dns-timeout to --dns.timeout, and exits on the old names, so ordering
or renewing any certificate failed. The six identical cert blocks are
now one definition applied to each domain.
2026-09-30 07:33:57 +00:00
Alexander Heldt 32063a3f14 pinwheel: Disable commit and PR attribution in ai settings 2026-09-30 09:32:21 +02:00
Alexander Heldt cc190a5aa8 pinwheel: Open graphite links in work firefox profile 2026-09-30 09:30:46 +02:00
Alexander Heldt 6a35c4ca4a pinwheel: Add encrypted naviterm config 2026-09-30 08:50:47 +02:00
Alexander Heldt 0f8ac38fa1 pinwheel: Set alex as tailscale operator 2026-09-30 08:42:58 +02:00
Alexander Heldt 1e5dbf7047 pinwheel: Add naviterm config secret, fix syncthing dir ownership 2026-09-29 16:42:47 +02:00
Alexander Heldt 2f016fa5f2 pinwheel: Swap to new machine 2026-09-29 16:41:55 +02:00
Alexander Heldt 4caf5d0bfe pinwheel: Fix swapped ai shell aliases, default to personal account 2026-09-29 15:08:34 +02:00
Alexander Heldt 4508678307 pinwheel: fix ~/code/work ownership, drop custom secret paths
systemd-tmpfiles now ensures ~/code and ~/code/work are owned by
alex, since agenix previously created ~/code/work as root when the
work secrets pointed there directly.

Also drop the custom path= on work-gitconfig, work-github-token, and
work-go-private so they use agenix's default secret path instead of
living under ~/code/work.
2026-09-29 09:20:18 +02:00
Alexander Heldt 1d05a7f45b pinwheel: enable IPU6 MIPI webcam (ov08x40)
Adds hardware.ipu6 for the built-in MIPI camera, plus two overlay
fixes needed for it to actually work on this hardware:

- Pin icamerasrc-ipu6epmtl to the same release tag already used by
  ipu6-camera-bins/ipu6-camera-hal (20250923_ov02e). The version
  nixpkgs currently pulls is an Intel internal IoT/Panther-Lake
  validation build whose device table only lists external USB
  AR0234 test sensors, never the real ov08x40, so the camera never
  gets selected.

- Patch ipu6-camera-hal's hardcoded IVSC/CVS entity name from
  "Intel IVSC CSI" (the out-of-tree ivsc driver's name) to "Intel
  CVS" (the mainlined intel_cvs driver's name). The mismatch broke
  I2C bus address resolution for the sensor, which cascaded into
  wrong stream configs and black/missing video.
2026-09-29 08:25:37 +02:00
Alexander Heldt f93c9e95c4 Update flake inputs 2026-09-25 19:37:29 +02:00
Alexander Heldt 0c2a579d59 flake: Move nh input to nix-community org
viperML/nh was moved to nix-community/nh and the old repo deleted, so
the pinned URL 404s on any re-fetch. The pinned commit still exists in
the new repo, so keep the exact rev and only change the owner.
2026-09-23 12:07:41 +02:00
Alexander Heldt 0584fc9f2c waybar: Pin battery module to BAT0
Bluetooth HID devices (e.g. a mouse) appearing as power_supply
entries in sysfs make waybar's Battery::refreshBatteries() throw
an uncaught exception and abort. Restricting to BAT0 avoids
enumerating those devices.
2026-09-01 10:07:07 +02:00
Alexander Heldt 8104af12fb hyprland: Fix mouse binds, hl.bindm does not exist
Hyprland's lua API only registers hl.bind; there is no separate
hl.bindm. The settings.bindm key rendered as a literal hl.bindm(...)
call, which errored with "attempt to call a nil value" at runtime.
Fold the mouse binds into settings.bind with { mouse = true }, per
the wiki's own example config.
2026-08-26 14:14:07 +02:00
Alexander Heldt 3233c88f0f hyprland: Migrate config to Lua, bump back to current
Hyprland 0.56.x dropped the hyprlang (.conf) config backend in favor
of Lua-only config. Switch configType to "lua" and rewrite monitors,
workspace/window rules, binds, env vars, and autostart using the new
hl.* dispatcher API. Un-pin the hyprland flake input (back to current,
following root nixpkgs) now that the config no longer depends on the
old hyprlang backend.

Every module that injects Hyprland keybinds (foot, wezterm, bemenu,
music, light, sound, screenshot, physlock, hyprlock) is converted to
the same Lua bind syntax, since the config is all-or-nothing per
configType. hyprlock's swayidle dpms toggle and the hyprland-monitors
hotplug script's hyprctl dispatch calls are updated to the new
hl.dsp.* expression syntax the same way.

One behavior change: hl.workspace_rule keeps only the last monitor set
per workspace (unlike hyprlang's rule list), so workspaces that used
to declare two candidate monitors now declare one static default;
the hyprland-monitors service still re-dispatches the correct monitor
on startup and hotplug.
2026-08-26 14:08:28 +02:00
Alexander Heldt 50721fa07c flake: Pin hyprland to pre-0.56.0 rev, keep own nixpkgs
Hyprland 0.56.0 dropped the hyprlang (.conf) config backend entirely
in favor of a Lua-only config, breaking the deployed hyprland.conf on
pinwheel. Pin back to 79bc0ca (last hyprlang-supporting build) until
the config is migrated to Lua.

Also drop hyprland's nixpkgs.follows override: building the old
Hyprland rev against the current (newer) root nixpkgs caused a
libstdc++ ABI mismatch between the cached hyprtoolkit binary and a
freshly-compiled hyprland-guiutils.
2026-08-26 12:54:43 +02:00
Alexander Heldt e63f00131d Update flake inputs 2026-08-18 09:39:02 +00:00
Alexander Heldt 6dc2da6792 Update todo flake input 2026-08-18 09:32:39 +00:00
Alexander Heldt 288b50dbe9 flake: Flip todo input to git.ppp.pm gitea host 2026-08-16 14:34:57 +00:00
Alexander Heldt 9b85886e9c manatee: Back up service state (databases etc.) via restic 2026-08-16 14:23:51 +00:00
Alexander Heldt 2fb22dbbdc backwards: Remove syncthing, repoint pinwheel folders to manatee 2026-08-16 13:48:10 +00:00
Alexander Heldt 00d9746dc3 manatee: Sync personal, work and phone-gps, peer phone to org 2026-08-16 13:41:52 +00:00
Alexander Heldt 9cd681b947 backwards: Pin firefox legacy configPath 2026-08-16 14:19:59 +02:00
Alexander Heldt f21d07029f pinwheel: Manage claude settings through nix 2026-08-16 14:19:58 +02:00
Alexander Heldt 8dec65213e tadpole: Use programs.ssh.settings 2026-08-16 14:19:58 +02:00
Alexander Heldt 5c4da51905 backwards: Use programs.ssh.settings 2026-08-16 14:19:58 +02:00
Alexander Heldt fe2c4e06ff pinwheel: Use programs.ssh.settings 2026-08-16 14:19:58 +02:00
Alexander Heldt 8c59b8c542 pinwheel: Pin firefox legacy configPath 2026-08-16 14:19:58 +02:00
Alexander Heldt ad7b890f28 pinwheel: Use beamPackages.erlang 2026-08-16 14:19:58 +02:00
Alexander Heldt 8b3f8fbb2d pinwheel: Enable programs.fuse for sshfs 2026-08-16 14:19:58 +02:00
Alexander Heldt e5aa0c0ec1 backwards/manatee: Move restic backup to mantee 2026-08-16 14:02:33 +02:00
Alexander Heldt f6e611fd96 manatee: Add support for pdfs in komga-reader 2026-08-16 07:41:45 +00:00
Alexander Heldt dd36f91cf5 manatee: add self-hosted todo app
Wire the offline-first todo app (github: local /home/alex/code/todo) into
manatee, following the app-module convention:

- flake input `todo` (local git checkout for now; gitea URL commented) with
  nixpkgs following.
- hosts/manatee/modules/todo: mod.todo option importing the app's NixOS module;
  runs on 127.0.0.1:8091, secureCookies, token from agenix; the host owns the
  nginx vhost (todo.ppp.pm, forceSSL + useACMEHost) and homepage card.
- mod.todo.enable = true.
- certs: todo.ppp.pm DNS-01 cert via hetzner.
- home-assistant DNS updater: add `todo` to the Hetzner subdomain list.
- secrets: todo-token.age (encrypted access token) + recipients in secrets.nix.
2026-08-13 12:36:18 +00:00
Alexander Heldt 03226f0ff0 manatee: Add wl-clipboard 2026-07-26 07:36:05 +00:00
Alexander Heldt ffd2ec7abe manatee: Add claude 2026-07-26 07:35:53 +00:00
Alexander Heldt 54deca1540 Update solo-referee flake input 2026-07-26 07:34:21 +00:00
Alexander Heldt 67aff9c51a manatee: Guard podman containers against crash-looping
Add a start-limit (5 restarts / 5 min) to the romm, romm-db, romm-redis
and homeassistant podman services so a failing container enters a
`failed` state instead of retrying forever. A slow crash-loop (~5s per
attempt) stays under systemd's default 5-starts-per-10s limit, so a
longer window is needed to catch it.
2026-07-26 07:32:16 +00:00
Alexander Heldt f439f5a878 Update puppy-tracker flake input 2026-07-24 15:19:12 +00:00
Alexander Heldt 47d0ff9e57 Update puppy-tracker flake input 2026-07-24 12:31:14 +00:00
Alexander Heldt a3f1ce24e0 manatee: Add solo-referee module 2026-07-24 12:26:33 +00:00
Alexander Heldt 823cb169d1 pinwheel: Set hyprland config variant 2026-07-23 10:56:37 +02:00
Alexander Heldt 1600812a17 pinwheel: set ASKPASS
And cache the git signing key
2026-07-23 10:56:01 +02:00
Alexander Heldt 803d027037 pinwheel: Fix emacs startup
And don't force the async path, wait at least 0.1sec for terminal to
answer with capabilities. Using the async path broke the answer and
inserted 4 spaces in the beginning of the buffer
2026-07-23 10:55:00 +02:00
Alexander Heldt ab509b3262 pinwheel/tadpole: Rename alex.pinwheel-tadpole-ed25519 2026-07-21 09:38:35 +02:00
Alexander Heldt 5b84b97ce3 Update puppy-tracker flake input 2026-07-21 07:20:31 +00:00
Alexander Heldt d5bb60d698 pinwheel: Remove bitwarden gui client 2026-07-21 08:58:55 +02:00
Alexander Heldt cc3a08d5bd Update flake inputs 2026-07-21 08:58:53 +02:00
Alexander Heldt 41e2ce88b8 pinwheel: Add ai module
With work/personal claude configs
2026-07-21 08:58:52 +02:00
Alexander Heldt 42b3dbc5e1 pinwheel: Ensure hyprland monitor detection works on start 2026-07-21 08:58:50 +02:00
Alexander Heldt d507684e82 manatee: Add tmux module 2026-07-17 09:15:46 +00:00
Alexander Heldt 028609ea99 Update puppy-tracker flake input 2026-07-13 06:16:35 +00:00
Alexander Heldt 4681f38952 Update puppy-tracker flake input 2026-07-09 19:51:51 +00:00
Alexander Heldt 6eac767c17 Update puppy-tracker flake input 2026-07-09 20:35:48 +02:00
Alexander Heldt bde46c091d manatee: Add puppy-tracker behind virtual host puppy.ppp.pm 2026-07-09 20:34:43 +02:00
Alexander Heldt 235fcd6893 manatee: Add invite code secret for puppy-tracker 2026-07-09 20:34:12 +02:00
Alexander Heldt 08664a0700 manatee: Add ability to specify public url for homepage card 2026-07-09 20:33:22 +02:00
Alexander Heldt 1c785cfbbc manatee: Add puppy.ppp.pm sub-domain
With cert and ip update
2026-07-09 16:59:13 +00:00
Alexander Heldt a93f39db00 Update puppy-tracker flake input 2026-07-04 09:27:46 +00:00
Alexander Heldt 07cb239535 Update puppy-tracker flake input 2026-07-04 09:21:06 +00:00
Alexander Heldt 18eaf3b69a manatee: Fix komga-reading-stats secret permissions 2026-06-25 14:28:28 +00:00
Alexander Heldt 8801793df2 Update flake inputs 2026-06-25 14:28:15 +00:00
Alexander Heldt 9294b79cf6 Update flake inputs 2026-06-21 18:08:50 +00:00
Alexander Heldt f4b4d0bb10 Update flake inputs 2026-06-21 17:59:25 +00:00
Alexander Heldt 1a41ad66b6 manatee: Add puppy-tracker module 2026-06-21 17:50:51 +00:00
Alexander Heldt 19816d2763 Update flake inputs (and add puppy-tracker) 2026-06-21 17:50:51 +00:00
Alexander Heldt 4ae1d138a7 pinwheel/tadpole: Add ed25519 ssh key 2026-06-17 08:35:07 +02:00
Alexander Heldt 354d965b34 Update whib-frontend flake input 2026-06-03 12:59:11 +02:00
Alexander Heldt 4a4c7555e3 tadpole: Scope authorized_keys_command to alex
The command was hijacking auth for all users, including `gitea`, which
broke `git push` over SSH — `gitea`'s `authorized_keys` (with the
`gitea serv` command restriction) was being bypassed, and sshd would
try to exec the raw `git-receive-pack` instead.

Pass `%u` to the command and short-circuit unless the requested user
is `alex`, so other users fall back to their own `~/.ssh/authorized_keys`.
2026-06-03 12:58:08 +02:00
Alexander Heldt e4bc3932e1 pinwheel: Use opensshs ssh-agent for SSH
As gnomes gcr-ssh-agent stalls RSA signing
2026-06-03 12:58:07 +02:00
Alexander Heldt 24b5ed350a pinwheel: Load direnv ZSH on devshell load 2026-06-03 12:58:05 +02:00
Alexander Heldt a6b41dbe4e pinwheel: Pin tailscale version 2026-06-03 12:58:04 +02:00
Alexander Heldt 5c0916f239 pinwheel: Fix ts LSP package location 2026-06-03 12:58:02 +02:00
Alexander Heldt c52ed524c2 pinwheel: Fix hyprland lock input 2026-06-03 12:58:01 +02:00
Alexander Heldt 3f9a033189 Update whib-backend flake input 2026-06-03 10:25:19 +00:00
Alexander Heldt 8c4d6d130f manatee: Update monitoring in home-assistant
- Add all disks to smartd
- Generate home-assistant config in nix
- Add metrics for all HDDs
2026-05-30 16:54:40 +00:00
Alexander Heldt c83e1d0b8e manatee: Update ssh module
- current naming
- set defaults to off
2026-05-30 16:45:27 +00:00
Alexander Heldt 12774cf31a manatee: Make romm network creation idempotent 2026-05-30 16:44:30 +00:00
Alexander Heldt 9a6957580d Update flake inputs 2026-05-20 09:26:39 +02:00
Alexander Heldt ce30426208 manatee: Add romm module 2026-05-17 13:25:01 +00:00
Alexander Heldt 26bf7ee8c7 manatee: Disable immich 2026-05-17 13:25:01 +00:00
Alexander Heldt f69882663c manatee: Fix permissions for komga-reading-stats 2026-05-17 13:25:01 +00:00
Alexander Heldt 2058475560 pinwheel: Update .ssh/config on build 2026-05-05 12:53:44 +02:00
Alexander Heldt 612399e07c pinwheel: Update work-gitconfig with new email 2026-04-23 15:44:47 +02:00
Alexander Heldt c9cfb7f8cf Update flake inputs 2026-04-23 15:44:25 +02:00
Alexander Heldt 4b2b6c5ccf pinwheel: Remove eglot-booster from emacs
As it was outdated and failed UTF-8 encoding
2026-04-14 09:29:46 +02:00
Alexander Heldt 837b58eea4 manatee: Set correct user on komga-reading-stats secrets 2026-03-22 19:10:46 +01:00
Alexander Heldt 5d9f97024d manatee: Fix komga-reading-stats secret permissions 2026-03-22 19:01:49 +01:00
Alexander Heldt 92ee577e02 Update flake inputs 2026-03-22 18:51:59 +01:00
Alexander Heldt d36fc3914b manatee: Add komga-reading-stats 2026-03-22 18:48:51 +01:00
Alexander Heldt f063d7c878 Add input komga-reading-stats 2026-03-22 18:45:30 +01:00
Alexander Heldt 7c19106937 manatee: Add secrets for komga-reading-stats 2026-03-22 18:45:05 +01:00
Alexander Heldt bf7272f44f pinwheel: Install slack for work 2026-03-22 18:36:07 +01:00
Alexander Heldt 71173d0490 pinwheel: Ignore .direnv in intellij 2026-03-22 18:35:42 +01:00
Alexander Heldt 8aeb60fff7 Pin nh version 2026-03-19 13:05:51 +01:00
Alexander Heldt 4cbf2cf44e pinwheel: Replace light with brightnessctl 2026-03-19 11:09:15 +01:00
Alexander Heldt 3bc3a22e71 Update flake inputs 2026-03-19 11:03:15 +01:00
Alexander Heldt 2e32fafff9 pinwheel: Add opencode and claude 2026-03-19 11:02:27 +01:00
Alexander Heldt cf2920e9ad pinwheel: Fix cursor escape codes in tmux 2026-03-19 11:02:27 +01:00
Alexander Heldt e4560e88b4 pinwheel: Ensure opencode has access to interactive bash 2026-03-19 11:02:27 +01:00
Alexander Heldt 9a70c3206d pinwheel: Use GUI key manager for ssh 2026-03-19 11:02:27 +01:00
Alexander Heldt 58df802bad pinwheel: Assign default workspaces to monitor(s) 2026-03-19 11:02:27 +01:00
Alexander Heldt 2f5fb158df pinwheel: Batch workspace monitor assignments atomically
Use hyprctl --batch to send all workspace rules and moves in a
single IPC call, avoiding races that caused workspaces to end up
on the wrong monitor.
2026-03-19 11:02:27 +01:00
Alexander Heldt 72bbbe02c0 pinwheel: Start Hyprland with uwsm 2026-03-19 11:02:26 +01:00
Alexander Heldt 640ccb7120 pinwheel: Always clean up swayidle after hyprlock exits
Use ; instead of && so pkill swayidle runs regardless of hyprlock's
exit status, preventing leaked swayidle processes from blanking screens.
2026-03-19 11:02:26 +01:00
Alexander Heldt 113ee7e067 pinwheel: Pause all players on screen lock
Use playerctl -a to pause all active media players instead of only
targeting spotify.
2026-03-19 11:02:26 +01:00
Alexander Heldt cfa88c45ad pinwheel: Move workspaces to monitor on hotplug
Workspace rules alone only affect future workspace creation. Add
moveworkspacetomonitor dispatches so existing workspaces are moved
to the correct monitor when an external display is connected.
2026-03-19 11:02:26 +01:00
Alexander Heldt 0da01c5070 pinwheel: Replace swaylock with hyprlock
Fixes black internal screen after unlocking with external monitor
disconnected, and occasional Hyprland crashes on lock.
2026-03-19 11:02:26 +01:00
Alexander Heldt 7c3a5c675d manatee: Remove calibre-web module 2026-03-07 12:10:30 +00:00
Alexander Heldt 3e386d92b5 manatee: nixfmt 2026-03-07 12:08:01 +00:00
Alexander Heldt 962ecf62dd manatee: Add komga-bookmanager service 2026-03-07 12:07:05 +00:00
Alexander Heldt 5f2f3c37eb Add komga-bookmanager input 2026-03-07 12:05:41 +00:00
Alexander Heldt 32e0d3ffe9 Update komga-comictracker input 2026-03-07 12:05:07 +00:00
Alexander Heldt 9dc92198e9 manatee: Expose komga publicly via komga.ppp.pm 2026-03-02 21:41:41 +01:00
Alexander Heldt 64d0e9b85b manatee: Add services homepage with auto-discovery
Add a homepage module that generates a static landing page served on
port 9999 via nginx. Each service module registers itself via the shared
mod.homepage.services option, so enabling a module automatically adds
it to the page.
2026-02-28 22:03:12 +01:00
Alexander Heldt d311719c41 backwards: Continued attempt to fix audio output 2026-02-17 21:35:51 +01:00
Alexander Heldt 1460d63c0c manatee: Add web based reader for komga 2026-02-17 20:25:11 +00:00
Alexander Heldt c920dfde15 manatee: Add bluetooth reset handling 2026-02-15 15:33:02 +01:00
Alexander Heldt 2abc1d505f backwards: Use NetworkManager for wifi 2026-02-15 15:10:48 +01:00
Alexander Heldt fd3aa8a936 backwards: Try to fix audio output 2026-02-15 15:10:19 +01:00
Alexander Heldt e31344c2a6 Update komga-comictracker input 2026-02-14 15:36:44 +01:00
Alexander Heldt dd8269a40e manatee: Update komga-comictracker to not use notifications 2026-02-14 11:38:44 +01:00
Alexander Heldt 8e7c00ae57 Update komga-comictracker input 2026-02-14 11:37:56 +01:00
Alexander Heldt 52932181be manatee: Fix komga-comicbooktracker credentials file permissions 2026-02-14 11:18:51 +01:00
Alexander Heldt 348f350244 pinwheel: Fix eglot code action indicator in emacs 2026-02-14 11:08:52 +01:00
Alexander Heldt 2531259628 pinwheel: Unpin nh from local nixpkgs to use cached builds 2026-02-14 11:08:44 +01:00
Alexander Heldt 8aad46cf58 pinwheel: Disable use of ssh defaults (as they're inlined) 2026-02-14 11:05:51 +01:00
Alexander Heldt 61ab1d17ab pinwheel: Fix pants use of system 2026-02-14 11:05:51 +01:00
Alexander Heldt b6e7008a53 manatee: Add komga-comicbooktracker 2026-02-14 10:54:01 +01:00
Alexander Heldt 69469791bf pinwheel: Fix window focus in hyprland 2026-02-14 10:38:48 +01:00
Alexander Heldt b2b6f6f128 Use pkgs.nixfmt instead of pkgs.nixfmt-rfc-style 2026-02-14 10:38:48 +01:00
Alexander Heldt d426548a48 pinwheel: Install copilot in intellij 2026-02-14 10:38:48 +01:00
Alexander Heldt 65ece23f80 pinwheel: Remove trackpad from battery monitor 2026-02-14 10:12:15 +01:00
Alexander Heldt 75d23a3923 pinwheel: Use flat mouse acceleration profile 2026-02-14 10:12:15 +01:00
Alexander Heldt 34f29e833a pinwheel: Add dynamic hyprland monitor hotplug handler 2026-02-14 10:12:13 +01:00
Alexander Heldt e00baefcc6 pinwheel: Simplify whib development 2026-02-14 10:10:34 +01:00
Alexander Heldt 9a13aca7ef pinwheel: Fix openvpn config 2026-02-14 10:10:10 +01:00
Alexander Heldt dd94a08b84 Update flake inputs 2026-02-14 10:06:39 +01:00
Alexander Heldt d2c717aeef manatee: Add OpenCL hardware support
To improve jellyfin transcoding
2026-02-08 19:12:51 +00:00
Alexander Heldt eb9142addb manatee: Add swapfile 2026-02-08 19:12:32 +00:00
Alexander Heldt b384c73ee8 Update flake inputs 2026-02-08 19:12:23 +00:00
Alexander Heldt 261c32d1f2 pinwheel/backwards/tadpole: Remove codeberg.org 2026-01-10 13:32:03 +01:00
Alexander Heldt e268305c95 pinwheel: Fix hyprland "smart borders" 2026-01-09 16:15:57 +01:00
Alexander Heldt 83153ceaa3 pinwheel: Use hyprland nixos module 2026-01-09 16:15:20 +01:00
Alexander Heldt 8e21804aef manatee: Update machine IP for ha.ppp.pm 2026-01-07 14:24:39 +00:00
Alexander Heldt ccf5b2bb57 pinwheel: Update idea after updated flake inputs 2026-01-07 14:33:17 +01:00
Alexander Heldt 2e96946096 pinwheel: Update hyprland after updated inputs 2026-01-07 14:32:38 +01:00
Alexander Heldt 4ee80c23ce Update flake inputs 2026-01-07 14:31:49 +01:00
Alexander Heldt adb7ff2d52 manatee: Open jellyfin port 2026-01-06 17:05:02 +00:00
Alexander Heldt d237d08d08 manatee: Ensure local traffic works next to VPN 2026-01-06 17:04:53 +00:00
Alexander Heldt 164b486d28 backwards: Fix gnome settings 2026-01-05 18:00:57 +01:00
Alexander Heldt d7dc9529ae backwards: Adjust to updated nixpkgs 2026-01-05 17:47:16 +01:00
Alexander Heldt bd7f1a3b1a manatee: Add home-assistant module 2026-01-05 17:44:30 +01:00
Alexander Heldt 9339af5ca6 manatee: Add secret for Hetzner DNS API key 2026-01-05 17:44:29 +01:00
Alexander Heldt 1c94c8c6c0 manatee: Open port 443 for nginx 2026-01-05 17:44:28 +01:00
Alexander Heldt eebbc22070 manatee: Remove books.ppp.pm virtual host 2026-01-05 17:44:27 +01:00
Alexander Heldt ba50bae2d4 manatee: Add komga module 2026-01-05 17:44:25 +01:00
Alexander Heldt 6475fec914 tadpole: Fix gitea oauth2 issuer URL
To have a trailing slash, which is expected of pre gitea 1.25
`tailscale` integrations
2026-01-04 19:31:28 +01:00
Alexander Heldt 9f15ea8637 pinwheel: Clean up fzf module 2026-01-03 16:42:09 +01:00
Alexander Heldt 97a57554f6 pinwheel/manatee/backwards: Adjust for updated nixpkgs 2026-01-03 16:41:41 +01:00
Alexander Heldt e4c959f0ed Update flake inputs 2025-12-27 11:13:56 +01:00
Alexander Heldt 62e546fdd3 pinwheel: Fix screen flickering 2025-12-27 11:09:15 +01:00
Alexander Heldt 0f1b968f90 pinwheel: Add unzip 2025-12-27 11:09:15 +01:00
Alexander Heldt be0b1cff6b pinwheel: Use networkmanager instead of connman
As it seems to work better with work vpn
2025-12-27 11:09:15 +01:00
Alexander Heldt 14f6b83680 Remove andromeda secrets 2025-12-27 11:09:15 +01:00
Alexander Heldt 280d584ee9 pinwheel: Update work-vpn script 2025-12-27 11:09:15 +01:00
Alexander Heldt 7482288509 manatee: Add new vdev to zpool 2025-11-22 11:42:34 +01:00
Alexander Heldt a4fba28a2f pinwheel: Fix GOPATH for go 2025-11-08 23:13:04 +01:00
Alexander Heldt 1bda7c411d pinwheel: Configure flycheck for emacs 2025-11-08 23:12:16 +01:00
Alexander Heldt 948e9a7dbe pinwheel: Remove eldoc-box from emacs 2025-11-08 22:57:23 +01:00
Alexander Heldt 074eaa0cea pinwheel: Remove knowledge of andromeda 2025-11-02 21:37:02 +01:00
Alexander Heldt 21d3fa48f7 test-vm: Increase disk size 2025-11-02 21:34:50 +01:00
Alexander Heldt a984ed0bb2 pinwheel: Enable gleam in emacs 2025-10-29 20:15:21 +01:00
Alexander Heldt 0d1a330878 pinwheel: Add gleam module 2025-10-29 20:14:08 +01:00
Alexander Heldt 92dfb60450 manatee: Add navidrome module 2025-10-26 20:34:52 +00:00
Alexander Heldt be1b614c67 Update whib-frontend input 2025-10-26 21:21:28 +01:00
Alexander Heldt b5aa0d5a3a tadpole: Update whib backend host 2025-10-26 21:12:59 +01:00
Alexander Heldt b30fd2de59 tadpole: Add whib-frontend service 2025-10-26 16:24:29 +01:00
Alexander Heldt feb63abb84 test-vm: Add whib-frontend module 2025-10-26 15:24:21 +01:00
Alexander Heldt 725e60eba5 Add whib-frontend input 2025-10-26 15:23:47 +01:00
Alexander Heldt 1e7b0750e0 manatee: Set EDITOR to be vim 2025-10-26 12:56:53 +01:00
Alexander Heldt 8f9b1e2c56 pinwheel: Set cursor theme 2025-10-20 18:48:34 +02:00
Alexander Heldt ba6d63b662 pinwheel: Update music and use naviterm 2025-10-20 18:47:46 +02:00
Alexander Heldt 959dfffba4 Add flake input for naviterm 2025-10-20 18:42:22 +02:00
Alexander Heldt fafcd96d43 pinwheel: Disable resolved.dnssec
As it breaks tailscale <-> openvpn

> At the time of September 2023, systemd upstream advise to disable DNSSEC
> by default as the current code is not robust enough to deal with
> “in the wild” non-compliant servers, which will usually give you a
> broken bad experience in addition of insecure.
2025-10-19 14:39:05 +02:00
Alexander Heldt b463c50596 pinwheel: Remove unused update-systemd-resolved 2025-10-19 14:37:45 +02:00
Alexander Heldt a187e83b41 pinwheel: Re-enable systemd-resolved
As `openvpn` is broken without it running (segfaults)
2025-10-19 11:50:19 +02:00
Alexander Heldt f0d260d0c1 Update flake inputs 2025-10-19 11:50:06 +02:00
Alexander Heldt c465784d8a pinwheel: Replace hyprland monitor script with auto-center-* 2025-10-15 16:25:56 +02:00
Alexander Heldt 89762d4578 Update flake inputs 2025-10-15 15:25:49 +02:00
Alexander Heldt b10e08fa54 Update flake inputs 2025-10-13 14:44:49 +00:00
Alexander Heldt 942c5453b2 pinwheel: Fix go ENV variables 2025-10-07 14:35:37 +02:00
Alexander Heldt aada581109 Update flake inputs 2025-10-06 21:08:48 +02:00
Alexander Heldt 30d0071441 pinwheel: Use latest intellij for work 2025-10-06 20:29:38 +02:00
Alexander Heldt c33268bce0 pinwheel: Add vlc 2025-10-06 20:26:42 +02:00
Alexander Heldt 2798abefb3 backwards: Add nethack 2025-07-10 16:48:43 +02:00
Alexander Heldt 4eda3a216c backwards: Add sshfs 2025-07-10 16:48:27 +02:00
Alexander Heldt 6d293d6050 pinwheel/backwards: Remove ttrpg syncthing share 2025-07-10 16:33:44 +02:00
Alexander Heldt e5ae1ea3b2 syncthing: Update phone ID 2025-07-10 16:21:03 +02:00
Alexander Heldt 734366005a manatee: Bump upload limit for calibre-web 2025-07-10 14:11:38 +00:00
Alexander Heldt 3f9dfbd8c6 manatee: Add virtual host for calibre-web 2025-07-10 14:11:38 +00:00
Alexander Heldt cf11b02c6b pinwheel: Remove unsafe beekeeper-studio 2025-07-10 16:09:40 +02:00
Alexander Heldt d28318ad21 Update flake inputs 2025-07-10 16:07:42 +02:00
Alexander Heldt 4f478515ea manatee/backwards: Move calibre-web module to manatee 2025-05-18 20:13:10 +02:00
Alexander Heldt d4814e0bd3 pinwheel/manatee: Share org via syncthing 2025-05-18 17:36:37 +02:00
Alexander Heldt 4e68621abd manatee: Add syncthing ID to shared syncthing module 2025-05-18 15:12:52 +00:00
Alexander Heldt 56e70cd2d4 manatee: Use secrets for syncthing cert/key 2025-05-18 17:09:39 +02:00
Alexander Heldt 76a0172cc7 manatee: Add secrets for syncthing cert/key 2025-05-18 17:09:38 +02:00
Alexander Heldt c41da74c78 manatee: Add syncthing module 2025-05-18 15:05:37 +00:00
Alexander Heldt 9adf2965c9 manatee: Add public directory in sync ZFS dataset 2025-05-18 16:33:03 +02:00
Alexander Heldt 295d72699c manatee: Add sync ZFS dataset 2025-05-18 16:32:46 +02:00
Alexander Heldt d88ee19bcc manatee: Add nginx module 2025-05-18 16:08:22 +02:00
Alexander Heldt 6750ab24af backwards: Enable hardware acceleration 2025-05-14 19:50:23 +02:00
Alexander Heldt d02a337643 manatee: Enable ZFS auto scrub 2025-05-09 21:55:47 +02:00
Alexander Heldt e7911337ed manatee: Enable smartd for harddrives 2025-05-09 21:54:32 +02:00
Alexander Heldt f08739efc3 pinwheel: Fix ssh hostname for manatee 2025-05-09 21:40:14 +02:00
Alexander Heldt 1e88d5c188 backwards: Add ssh keys for manatee 2025-05-09 21:39:57 +02:00
Alexander Heldt 7de3141e46 manatee: Add backwards to authorized ssh keys 2025-05-09 21:33:49 +02:00
Alexander Heldt 7077ac9264 backwards/manatee: Add secrets for ssh keys 2025-05-09 21:31:49 +02:00
Alexander Heldt c49159f8bc manatee: Add enable option to jellyfin module 2025-05-09 21:26:22 +02:00
Alexander Heldt e6246e7230 manatee: Add immich module 2025-05-09 21:26:21 +02:00
Alexander Heldt 85e821f99f manatee: Add public directory in cameras ZFS dataset 2025-05-06 16:48:46 +00:00
Alexander Heldt 790ca44feb manatee: Add cameras ZFS dataset 2025-05-06 16:32:48 +00:00
Alexander Heldt 94c52193df backwards: Do not backup reading-material to the cloud 2025-05-04 14:35:44 +02:00
Alexander Heldt ff67e0bad2 backwards: Fix wrong secret name of restic-password 2025-05-04 14:29:39 +02:00
Alexander Heldt 06d32e5e81 pinwheel/backwards: Adjust reading-material sync through syncthing
Move `books` and into `reading-material`
2025-05-04 14:25:09 +02:00
Alexander Heldt 7a741a57b2 pinwheel: Adjust colors.background to match dracula themes 2025-05-04 12:24:34 +02:00
Alexander Heldt e0b46fbca0 pinwheel: Fix zsh.initContent attribute definition 2025-05-03 17:32:28 +02:00
Alexander Heldt 5d951caf2f backwards: Fix pulseaudio attribute definition 2025-05-03 17:29:41 +02:00
Alexander Heldt 64d97b6b9e Update flake input 2025-05-03 15:26:58 +00:00
Alexander Heldt 8806b854dc backwards: Remove audiobookshelf module 2025-05-03 16:50:15 +02:00
Alexander Heldt 593271c404 manatee: Add audiobookshelf module 2025-05-03 16:49:22 +02:00
Alexander Heldt a6e6dd6656 backwards: Remove transmission module 2025-05-03 16:29:16 +02:00
Alexander Heldt 1245a0c4f7 backwards: Remove jellyfin module 2025-05-03 16:28:25 +02:00
Alexander Heldt 996691aeec manatee: Add jellyfin module 2025-05-03 16:26:43 +02:00
Alexander Heldt 4545349913 manatee: Add transmission module 2025-05-03 12:50:35 +02:00
Alexander Heldt c57e60e781 manatee: Add storage group that owns /mnt/media/public 2025-05-03 12:45:14 +02:00
Alexander Heldt 1798af695e manatee: Add tailscale module 2025-05-02 16:03:46 +02:00
Alexander Heldt 365e56925e manatee: Add host manatee 2025-05-02 12:07:28 +02:00
Alexander Heldt 016ab1e2e0 manatee: Add secrets for ssh machine (root) key 2025-05-02 12:07:26 +02:00
Alexander Heldt 62ee537dc9 manatee: Add secrets for ssh key to git.ppp.pm 2025-05-02 12:04:45 +02:00
Alexander Heldt db5aa01e44 Add disco to inputs 2025-05-02 12:00:41 +02:00
Alexander Heldt 86803092c1 pinwheel: Add ssh key for manatee 2025-05-02 12:00:37 +02:00
Alexander Heldt 94ec22bd9a manatee: Add manatee to secrets 2025-05-02 11:53:01 +02:00
Alexander Heldt 4b003f6993 pinwheel/backwards: Share reading-material through syncthing 2025-03-25 20:46:16 +01:00
Alexander Heldt 5bd7fa1b2a backwards: Share reading-material with phone and tablet 2025-03-25 20:29:18 +01:00
Alexander Heldt af25f1c1c1 Add tablet to shared syncthing devices 2025-03-25 20:22:40 +01:00
Alexander Heldt f305640227 pinwheel: Use updated attribute name for pulseaudio 2025-03-25 20:19:40 +01:00
Alexander Heldt 914ab347d6 backwards: Fix firefox binary paths 2025-03-25 20:18:43 +01:00
Alexander Heldt ac7017a30b pinwheel: Fix firefox binary paths 2025-03-02 11:31:43 +01:00
Alexander Heldt c4adc1c1eb Update flake inputs 2025-03-02 11:31:33 +01:00
Alexander Heldt 65b297302e Update WHIB input 2025-02-08 12:00:19 +01:00
Alexander Heldt 0de1d03521 backwards: Fix retroarch 2025-02-02 12:02:54 +01:00
Alexander Heldt 08eaa717bc Update flake inputs 2025-02-02 11:37:13 +01:00
Alexander Heldt 3de7d1245c tadpole/test-vm: Update WHIB service
- Update `WHIB` input
- Update secrets to reflect changes in input
2025-02-02 11:05:59 +01:00
Alexander Heldt cd821f62bd pinwheel: Fix style of notifications 2025-01-11 20:16:21 +01:00
Alexander Heldt 8dfcbc3dbe tadpole: Use port 3001 for gitea 2025-01-03 12:39:41 +01:00
Alexander Heldt b9cf6a5baa tadpole: Assert that nginx is running when using ppp.pm-site 2025-01-03 11:29:29 +01:00
Alexander Heldt 42133b96c8 tadpole: Assert that nginx is running when using gitea 2025-01-03 11:29:29 +01:00
Alexander Heldt d91dc9be11 tadpole: Add WHIB backend 2025-01-03 11:29:29 +01:00
Alexander Heldt b32f0edab9 tadpole: Add secrets for whib service 2025-01-03 11:29:29 +01:00
Alexander Heldt 2bf315e8d3 test-vm: Add WHIB backend 2025-01-03 11:29:29 +01:00
Alexander Heldt 10d4adef8d Update README with documentation about the test-vm 2024-12-20 13:05:45 +01:00
Alexander Heldt 6c4e3901c3 test-vm: Echo help message for shutdown alias 2024-12-20 13:05:23 +01:00
Alexander Heldt ee23f27c71 test-vm: Resize terminal to host terminal size 2024-12-20 12:12:16 +01:00
Alexander Heldt c9170a90ad test-vm: Add alias of shutting down the VM 2024-12-20 12:12:16 +01:00
Alexander Heldt d868cdf8c8 test-vm: Auto login a user and assume its sudo 2024-12-20 12:12:16 +01:00
Alexander Heldt 312ef71403 test-vm: Increase disk size 2024-12-20 12:12:16 +01:00
Alexander Heldt c999da30da pinwheel: Don't override go version 2024-12-20 12:11:33 +01:00
Alexander Heldt a9f4a4ba0e pinwheel: Fix fonts 2024-12-20 12:11:19 +01:00
Alexander Heldt 78fc6ce26f Update flake inputs 2024-12-20 12:11:10 +01:00
Alexander Heldt b7552554aa pinwheel: Add volume sharing for vms 2024-11-28 18:26:28 +01:00
Alexander Heldt c9bdd235bd config-manager: Fix --update 2024-11-28 18:25:55 +01:00
Alexander Heldt 7fa36efa0d pinwheel: Fix hyprland "smart gaps" 2024-11-28 18:25:38 +01:00
Alexander Heldt 8cfa9c00e0 Update flake inputs 2024-11-28 18:25:27 +01:00
Alexander Heldt fb33c4b265 pinwheel: Update work github token 2024-11-25 08:47:50 +01:00
Alexander Heldt 7f5f4901c2 pinwheel: Set intellij version to 2024.2.4 in for work 2024-11-24 19:08:59 +01:00
Alexander Heldt fdaf1ead2a pinwheel: Indent js code in emacs with spaces 2024-11-21 08:55:25 +01:00
Alexander Heldt fb26dccf6f pinwheel: Add pants for work 2024-11-02 14:18:28 +01:00
Alexander Heldt 3fb8b3bc23 Update flake inputs 2024-11-02 14:11:33 +01:00
Alexander Heldt 073ca46c52 backwards: Close transmission firewall ports 2024-10-25 08:57:27 +02:00
Alexander Heldt 6f8f7b1816 pinhweel: Fix noto font 2024-10-25 08:55:56 +02:00
Alexander Heldt 622f5a367d Update flake inputs 2024-10-25 08:55:42 +02:00
Alexander Heldt f3dcf8c014 tadpole: Fix gitea reverse proxy host 2024-10-13 20:49:24 +02:00
Alexander Heldt 3cb993e7b7 Update flake inputs 2024-10-13 12:45:51 +02:00
Alexander Heldt f69d6dab55 backwards: Add moonlight 2024-10-02 17:05:22 +02:00
Alexander Heldt 047815b646 pinwheel: Don't override graphite version 2024-09-30 08:08:56 +02:00
Alexander Heldt 1d7b563377 pinwheel: Increase swapfile size to 48GiB 2024-09-25 15:35:13 +02:00
Alexander Heldt 1d1df30e3d Update flake inputs 2024-09-24 10:51:27 +02:00
Alexander Heldt eaf5f62d49 backwards: Add bitwarden-desktop 2024-09-24 10:35:38 +02:00
Alexander Heldt d6a653ab73 backwards: Add firefox 2024-09-22 19:02:40 +02:00
Alexander Heldt 48a5b52ace backwards: Add PCSX2 to games 2024-09-22 19:02:18 +02:00
Alexander Heldt ed6052790f pinwheel: Use eglot for python in emacs 2024-09-17 21:28:14 +02:00
Alexander Heldt 3ff689b8a7 backwards: Use secretsFile for networking.wireless 2024-09-17 21:17:42 +02:00
Alexander Heldt aa78454e66 backwards: Enable jellyseerr for jellyfin 2024-09-17 21:11:31 +02:00
Alexander Heldt 119f83bda5 backwards: Enable radarr for jellyfin 2024-09-17 21:11:31 +02:00
Alexander Heldt 4d46b666d9 backwards: Enable sonarr for jellyfin 2024-09-17 21:11:31 +02:00
Alexander Heldt f76422d959 backwards: Enable prowlarr for jellyfin 2024-09-17 21:11:31 +02:00
Alexander Heldt 6d06ef497a backwards: Add reverse proxy for jellyfin 2024-09-17 21:11:31 +02:00
Alexander Heldt 0e96e602f3 tadpole: Remove unneeded assertion of existing certs for gitea 2024-09-17 21:11:31 +02:00
Alexander Heldt de79758aab backwards: Add reverse proxy for transmission 2024-09-17 21:11:31 +02:00
Alexander Heldt 56e749ce68 backwards: Add nginx module 2024-09-17 21:11:31 +02:00
Alexander Heldt 0d93e162ab tadpole: Clean up nginx and certs modules 2024-09-17 21:11:31 +02:00
Alexander Heldt fb6834db74 tadpole: Change default email for certs 2024-09-17 21:11:31 +02:00
Alexander Heldt 5a00bdf1ed Update flake inputs 2024-09-17 21:11:31 +02:00
Alexander Heldt 53c43c5a3a pinwheel: Remove retroarch 2024-09-17 21:11:31 +02:00
Alexander Heldt f732cec662 pinwheel: Remove mullvad 2024-09-17 21:11:31 +02:00
Alexander Heldt 465d263cf7 pinwheel: Increase waybar module intervals 2024-09-17 21:11:31 +02:00
Alexander Heldt 1808013e53 pinwheel: Add tailscale module to waybar 2024-09-17 21:11:31 +02:00
Alexander Heldt 92f6ba3231 pinwheel: Add secret for preferred tailscale exit node 2024-09-17 21:11:31 +02:00
Alexander Heldt 443c188999 pinwheel: Add swapfile 2024-09-17 21:11:31 +02:00
Alexander Heldt 909f061d45 pinwheel: Remove URL preference for gitlab in git 2024-09-17 21:11:31 +02:00
Alexander Heldt c7aa73be47 Update url for pppdotpm-site input 2024-09-17 21:11:31 +02:00
Alexander Heldt e2e060c1bc tadpole: Add match block for git.ppp.pm in ssh 2024-09-17 21:11:31 +02:00
Alexander Heldt 3b9d5d9e15 tadpole: Add secrets for git.ppp.pm 2024-09-17 21:11:31 +02:00
Alexander Heldt 3aaaac832a backwards: Add match block for git.ppp.pm in ssh 2024-09-05 18:44:19 +02:00
Alexander Heldt ea625e0fdb backwards: Add secrets for git.ppp.pm 2024-09-05 18:26:47 +02:00
Alexander Heldt 70b68b31bb pinwheel: Don't format files named "secrets.nix" in emacs 2024-09-05 18:20:46 +02:00
Alexander Heldt fcfe6af9dc pinwheel: Add grpcurl to work module 2024-09-05 12:40:00 +02:00
Alexander Heldt 5c48c28b8e pinwheel: Move postman to work module 2024-09-05 12:39:44 +02:00
Alexander Heldt 7a34c503d0 Update flake inputs 2024-09-04 21:15:37 +02:00
Alexander Heldt 4724ee02f5 pinwheel: Add nixfmt to nix module 2024-09-02 22:36:16 +02:00
Alexander Heldt f233621dc9 pinwheel: Format nix files on save in emacs 2024-09-02 21:59:10 +02:00
Alexander Heldt 39fbfeedec pinwheel: Remove nil from nix module 2024-09-02 21:59:10 +02:00
Alexander Heldt 6c0daa64ac pinwheel: Use nixd in emacs 2024-09-02 21:59:10 +02:00
Alexander Heldt 9c2d1954ed Apply nixfmt 2024-09-02 21:55:41 +02:00
Alexander Heldt 7fbe065033 Add dev shell with nixfmt 2024-09-02 21:07:34 +02:00
Alexander Heldt 7c90a11c79 Remove unused self reference in flake.nix 2024-09-02 20:42:12 +02:00
Alexander Heldt e4b4946e8d pinwheel: Remove pants.nix from work module 2024-09-02 20:41:42 +02:00
Alexander Heldt 6f24c233db sombrero: remove host sombrero 2024-09-02 20:29:48 +02:00
Alexander Heldt 7b962c2aa0 backwards: Enable calibre-web module 2024-09-01 17:53:36 +02:00
Alexander Heldt ce43ca04bb backwards: Add calibre-web module 2024-09-01 17:51:44 +02:00
Alexander Heldt 3eb5285350 backwards: Enable audiobookshelf module 2024-09-01 12:20:36 +02:00
Alexander Heldt c5a794d88d backwards: Add audiobookshelf module 2024-09-01 12:20:36 +02:00
Alexander Heldt a81dc40774 backwards: Backup sync to cloud with restic 2024-09-01 10:34:05 +02:00
Alexander Heldt 9379559534 backwards: Add secret for restic cloud sync backup 2024-09-01 10:34:05 +02:00
Alexander Heldt 4f46d0a64a tadpole: Specify ssh port for gitea 2024-09-01 10:24:40 +02:00
Alexander Heldt 6efc272b2f pinwheel: Add git url preference for git.ppp.pm 2024-09-01 10:24:40 +02:00
Alexander Heldt d5c8fb5be2 pinwheel: Add ssh keys for git.ppp.pm 2024-09-01 10:24:40 +02:00
Alexander Heldt b8ebd9fd78 pinwheel: Add secrets for git.ppp.pm 2024-09-01 10:24:40 +02:00
Alexander Heldt c368a322e2 pinwheel: Use tailscale DNS for ssh to backwards 2024-09-01 10:24:40 +02:00
Alexander Heldt debe89de5a tadpole: Use standard SSH port for gitea 2024-09-01 10:24:40 +02:00
Alexander Heldt 6b4c712a5e backwards: Add transmission module 2024-09-01 10:24:40 +02:00
Alexander Heldt c1be97b0b6 backwards: Backup sync to external drive with restic 2024-09-01 10:24:40 +02:00
Alexander Heldt 5e7a343331 backwards: Add secret for restic 2024-09-01 10:02:08 +02:00
Alexander Heldt c699eeb575 backwards: Set user/groups for jellyfin 2024-08-31 15:44:36 +02:00
Alexander Heldt bbb5ae2db2 backwards: Set jellyfin data directory 2024-08-31 15:44:22 +02:00
Alexander Heldt 3d8a528151 backwards: Add media filesystem mount 2024-08-31 13:30:54 +02:00
Alexander Heldt c71d51ad3f backwards: Set syncthing GUI password 2024-08-31 12:58:04 +02:00
Alexander Heldt 7cd3f25681 backwards: Add enable option to syncthing module 2024-08-31 12:58:03 +02:00
Alexander Heldt ec58b76327 backwards/pinwheel: Share books via syncthing 2024-08-31 12:57:02 +02:00
Alexander Heldt 2e9e0a5822 backwards/pinwheel: Share work via syncthing 2024-08-31 12:52:54 +02:00
Alexander Heldt 8207c9c753 backwards/pinwheel: Share personal via syncthing 2024-08-31 12:52:53 +02:00
Alexander Heldt 4da36b01a2 backwards: Set GUI address for syncthing 2024-08-31 12:31:08 +02:00
Alexander Heldt d039bc1a71 backwards/pinwheel: Share org via syncthing 2024-08-31 12:17:58 +02:00
Alexander Heldt 8692b6da83 backwards: Share org with phone via syncthing 2024-08-31 12:14:19 +02:00
Alexander Heldt a373713ecd backwards: Add 7zip 2024-08-31 12:04:06 +02:00
Alexander Heldt 8cd0c7db2d backwards: Add swanstation emulator to retroarch 2024-08-31 12:04:06 +02:00
Alexander Heldt b79f11865e backwards: Share phone-gps with phone in syncthing 2024-08-31 12:04:06 +02:00
Alexander Heldt 72dbdbf9f4 Add backwards to shared syncthing devices 2024-08-31 11:55:19 +02:00
Alexander Heldt 1b19812a77 backwards: Add secrets for syncthing 2024-08-31 11:53:59 +02:00
Alexander Heldt 30079cabcc backwards: Add syncthing module 2024-08-31 11:46:05 +02:00
Alexander Heldt 53da4df955 backwards: Update hardware.graphics attributes 2024-08-31 11:25:04 +02:00
Alexander Heldt f731ce87f4 backwards: Update gnome attributes 2024-08-31 11:24:44 +02:00
Alexander Heldt 85f931992f backwards: Add tailscale module 2024-08-31 11:16:01 +02:00
Alexander Heldt 85c729f659 pinwheel: Clean up tailscale module 2024-08-30 21:22:56 +02:00
Alexander Heldt a922307bf7 pinwheel: Enable rerere in git 2024-08-30 21:21:42 +02:00
Alexander Heldt f192033694 Update flake inputs 2024-08-30 21:13:29 +02:00
Alexander Heldt 232da9906c pinwheel: Clean /tmp on boot 2024-08-30 21:09:35 +02:00
Alexander Heldt 04c248bae5 tadpole: Add webfinger for gitea 2024-08-30 21:09:35 +02:00
Alexander Heldt 7d3531df68 tadpole: Extract cert for gitea 2024-08-30 20:49:30 +02:00
Alexander Heldt 6a12ca3f5c tadpole: Add certs module 2024-08-30 20:47:33 +02:00
Alexander Heldt c543fbdd57 tadpole: Disable registration in gitea 2024-08-29 20:53:26 +02:00
Alexander Heldt 9aca9b2991 tadpole: Enable gitea 2024-08-29 20:52:32 +02:00
Alexander Heldt 85f9f5908c tadpole: Add gitea module 2024-08-29 20:52:32 +02:00
Alexander Heldt c96b8fb108 tadpole: Add secret for gitea 2024-08-29 20:08:09 +02:00
Alexander Heldt c797e7b212 pinwheel: Update graphite 2024-08-29 13:43:37 +02:00
Alexander Heldt 3c18147a17 tadpole: Cleanup home module 2024-08-27 09:50:38 +02:00
Alexander Heldt 0f2798f15c pinwheel: Cleanup work module 2024-08-27 09:50:25 +02:00
Alexander Heldt 4bdd66258e sombrero: Add tailscale module 2024-08-26 10:22:16 +02:00
Alexander Heldt 015e32b5c4 pinwheel: Add tailscale module 2024-08-26 10:22:16 +02:00
Alexander Heldt b8c956b493 pinwheel: Update ssh key for alex.pinwheel-andromeda 2024-08-23 22:36:53 +02:00
Alexander Heldt 11e4dff615 backwards: Add jellyfin module 2024-08-19 08:44:09 +02:00
Alexander Heldt 50eb144a61 backwards: Add secret for wpa_supplicant.conf 2024-08-18 15:19:17 +02:00
Alexander Heldt 167009f4ed backwards: Add gnome module 2024-08-18 15:01:47 +02:00
Alexander Heldt 36c7c0bd23 backwards: Add localisation module 2024-08-18 14:54:46 +02:00
Alexander Heldt c515ecb02f Update flake inputs 2024-08-18 14:52:05 +02:00
Alexander Heldt 1636a2e79b pinwheel: Enable wayland for chromium 2024-08-18 14:50:46 +02:00
Alexander Heldt 9ab4492dad pinwheel: Add chromium module 2024-08-18 14:50:16 +02:00
Alexander Heldt 6239c530c4 pinwheel: Use wlr portal instead of hyprland portal
As it worked better for screen sharing
2024-08-18 14:46:49 +02:00
Alexander Heldt 02a5c8d337 pinwheel: Enable wayland in firefox 2024-08-18 14:46:06 +02:00
Alexander Heldt 6bbb231eb0 pinwheel: Use option for gc configuration limit 2024-08-18 14:44:45 +02:00
Alexander Heldt 90e7b6115a tadpole: Use option for gc configuration limit 2024-08-18 14:41:41 +02:00
Alexander Heldt 76261330cd backwards: Automatically garbage collect generations 2024-08-18 14:38:56 +02:00
Alexander Heldt fcaa4efec2 backwards: Add boot module 2024-08-18 14:37:01 +02:00
Alexander Heldt 80fca1b3c8 backwards: Add authorized ssh key for pinwheel 2024-08-15 19:26:46 +02:00
Alexander Heldt 42053e27cd backwards: Add games module 2024-08-15 19:26:46 +02:00
Alexander Heldt 68f1ed9ec2 backwards: Add git module 2024-08-15 19:26:46 +02:00
Alexander Heldt 2fb5f50cf4 backwards: Add network module 2024-08-15 19:26:46 +02:00
Alexander Heldt 612e78d576 pinwheel: Add ssh secrets for backwards 2024-08-15 19:26:44 +02:00
Alexander Heldt f13bfa2608 backwards: Add secrets for codeberg.org 2024-08-15 19:26:15 +02:00
Alexander Heldt 8918d3bd35 backwards: Add secrets for ssh machine (root) key 2024-08-15 19:26:13 +02:00
Alexander Heldt 106d355a01 backwards: Add agenix module 2024-08-15 15:34:53 +02:00
Alexander Heldt ba8860e933 backwards: Add ssh module 2024-08-15 15:34:52 +02:00
Alexander Heldt bc1ca1c9ce backwards: Add modules directory 2024-08-15 14:41:05 +02:00
Alexander Heldt 6c2a6ce2df backwards: Add host backwards 2024-08-15 14:38:35 +02:00
Alexander Heldt 3ae92cfce9 Update flake inputs 2024-08-04 18:27:48 +02:00
Alexander Heldt bf7b4475ab config-manager: Add commands to {build, run} test-vm 2024-07-30 20:19:03 +02:00
Alexander Heldt 1846d4d2cc pinwheel/test-vm: Move development of ppp.pm-site to test-vm 2024-07-30 20:09:12 +02:00
Alexander Heldt 6d33cea887 test-vm: Add host test-vm 2024-07-30 20:06:32 +02:00
Alexander Heldt 8230c25627 tadpole: Add secrets for ssh machine (root) key 2024-07-29 10:40:07 +02:00
Alexander Heldt 8f1264870d tadpole: Move secrets in ssh module 2024-07-29 10:24:55 +02:00
Alexander Heldt 9f91c44f3e Rekey secrets with new alex key 2024-07-28 15:49:22 +02:00
Alexander Heldt a51caa5cac pinwheel: Add gimp 2024-07-27 14:18:29 +02:00
Alexander Heldt ce711d860b sombrero: Add boot module 2024-07-27 13:55:37 +02:00
Alexander Heldt 49c0a45b70 Update flake inputs 2024-07-27 12:13:47 +02:00
Alexander Heldt ff5efc2d25 tadpole: Automatically garbage collect generations 2024-07-27 12:13:47 +02:00
Alexander Heldt 6b89c51feb tadpole: Add boot module 2024-07-27 12:13:47 +02:00
Alexander Heldt 415bd24047 pinwheel: Automatically garbage collect generations 2024-07-27 12:13:47 +02:00
Alexander Heldt a7e4a56fb6 Add nix-gc-env input 2024-07-27 11:45:48 +02:00
Alexander Heldt 89c8803fbc pinwheel/sombrero: Remove time-tracking from syncthing 2024-07-25 09:36:31 +02:00
Alexander Heldt 965ec6d8af Update flake inputs 2024-07-25 09:36:31 +02:00
Alexander Heldt da29f02302 pinwheel: Add low battery manager 2024-07-25 09:36:31 +02:00
Alexander Heldt 3e1d53f205 tadpole: Use vim as EDITOR 2024-07-25 09:36:31 +02:00
Alexander Heldt bfd13f7f53 sombrero: Update nginx default SSL certification email 2024-07-25 09:36:31 +02:00
Alexander Heldt a5897fe1c7 tadpole: Add ppp.pm-site module 2024-07-25 09:36:31 +02:00
Alexander Heldt 1e5ba187ff sombrero: Disable ppp.pm-site
As it will be moved to `tadpole`
2024-07-21 10:54:52 +02:00
Alexander Heldt 09b86e62f5 tadpole: Add nginx module 2024-07-21 10:52:42 +02:00
Alexander Heldt 577725a2f6 tadpole: Add tmux module 2024-07-21 10:45:39 +02:00
Alexander Heldt 29b276ead0 tadpole: Bind stastic ip 2024-07-21 10:37:16 +02:00
Alexander Heldt d622f526dc tadpole: Add network module 2024-07-21 10:36:15 +02:00
Alexander Heldt e61b0c41a7 Update flake inputs 2024-07-21 10:16:15 +02:00
Alexander Heldt 2140bc134c pinwheel: Use pkgs.buildFHSUserEnv for pants 2024-07-21 10:13:37 +02:00
Alexander Heldt beca73ebf6 pinwheel: Use store path for jq in hyprland monitor manager 2024-07-21 10:08:51 +02:00
Alexander Heldt e4c9ef4504 pinwheel: Be more specific about what events to handle in hyprland 2024-07-21 10:07:35 +02:00
Alexander Heldt 253297c32f sombrero: Move unar from system packages to home packages 2024-07-21 10:07:10 +02:00
Alexander Heldt 6c19451de1 pinwheel: Add ssh secrets for tadpole 2024-07-21 10:06:24 +02:00
Alexander Heldt a67f27b842 pinwheel: Fix indent of ssh age secrets 2024-07-20 21:51:54 +02:00
Alexander Heldt 2afa9ba437 tadpole: Add authorized ssh key for pinwheel 2024-07-20 21:45:13 +02:00
Alexander Heldt c32a2ec793 tadpole: Add ssh secrets for codeberg.org 2024-07-20 21:21:36 +02:00
Alexander Heldt aed73fb9c8 tadpole: Add agenix module 2024-07-20 20:57:14 +02:00
Alexander Heldt 84c767e8e1 tadpole: Add ssh module 2024-07-20 20:57:14 +02:00
Alexander Heldt 27ea14e23a sombrero: Move secrets for codeberg.org to the correct host directory 2024-07-20 20:57:14 +02:00
Alexander Heldt 08df878d3b tadpole: Add localisation module 2024-07-20 20:57:14 +02:00
Alexander Heldt 305bd45d71 tadpole: Add modules directory 2024-07-20 20:57:14 +02:00
Alexander Heldt 33986d8dda tadpole: Add host tadpole 2024-07-20 17:56:36 +02:00
Alexander Heldt dd1ecc9a0d pinwheel: Add enable option to mullvad module 2024-07-19 12:07:36 +02:00
Alexander Heldt 6709d8b143 pinwheel: Add secrets for mullvad 2024-07-19 12:00:52 +02:00
Alexander Heldt c9fe20b963 pinwheel: Don't restart waybar from hyprlands monitor manager
As it breaks the manager script, which breaks `waybar` and the script
2024-07-19 11:07:07 +02:00
Alexander Heldt 5d7622d7d3 pinwheel: Ensure waybar scripts use packages with store paths 2024-07-19 11:07:07 +02:00
Alexander Heldt f302f39068 pinwheel: Fix embark key binding in emacs 2024-07-19 11:07:07 +02:00
Alexander Heldt 8ea3d5c863 pinwheel: Use flycheck-eglot in emacs 2024-07-19 11:07:07 +02:00
Alexander Heldt 96e42894d3 Update flake inputs 2024-07-19 11:07:07 +02:00
Alexander Heldt 68da9d10ae sombrero: Remove explicit transmission system package 2024-07-19 11:07:07 +02:00
Alexander Heldt d17bd5af63 sombrero: Add mullvad module 2024-07-19 11:07:07 +02:00
Alexander Heldt e605a18fdf sombrero: Use transmission v4
As v3 is being deprecated
2024-07-13 10:52:23 +02:00
Alexander Heldt 0ff5458493 Update flake inputs 2024-07-13 10:20:59 +02:00
Alexander Heldt f11d37ab23 pinwheel: Show inferred types with metals in emacs 2024-07-13 10:15:59 +02:00
Alexander Heldt d72afd237e pinwheel: Add waybar to PATH and start it in subshell
To avoid having the monitor managing script fail due to waybar errors
2024-07-13 10:15:59 +02:00
Alexander Heldt c3c923ffe5 pinwheel: Use store path for pkill in swaylock 2024-07-13 10:15:59 +02:00
Alexander Heldt 3c2600c77f pinwheel: Add pkill to PATH of hyprland monitor management 2024-07-13 10:15:59 +02:00
Alexander Heldt 44f522ef86 pinwheel: Update hyprland socket location for monitor management 2024-07-13 10:15:59 +02:00
Alexander Heldt 67a7a5411f sombrero: Add git url preference for codeberg.org 2024-07-13 10:15:59 +02:00
Alexander Heldt e5bae7eebb Update flake inputs 2024-07-13 10:15:59 +02:00
Alexander Heldt b3cbe08564 pinwheel: Move unar closer to unzip in home module 2024-07-13 10:15:59 +02:00
Alexander Heldt d0028f0fc2 pinwheel: Remove bitwarden 2024-07-13 10:15:59 +02:00
Alexander Heldt 04271dafae pinwheel: Fix adwaita-icon-theme 2024-07-13 10:15:59 +02:00
Alexander Heldt 9fa8c25f11 pinwheel: Use postman from nixpkgs 2024-07-13 10:15:59 +02:00
Alexander Heldt cd8511e7eb Update flake inputs 2024-07-13 10:15:59 +02:00
Alexander Heldt 8afb908b97 pinwheel: Add work dependencies 2024-07-13 10:15:59 +02:00
Alexander Heldt 924d181985 pinwheel: Add eglot-booster to emacs 2024-07-13 10:15:59 +02:00
Alexander Heldt 6b320acf1d pinwheel: Add JAVA_HOME to scala module 2024-07-01 12:23:55 +02:00
Alexander Heldt cb22504ddc pinwheel: Update magnifier keybindings in hyprland 2024-06-30 15:21:58 +02:00
Alexander Heldt 1449ee0403 pinwheel: Fix graphics setting in hyprland 2024-06-30 09:25:13 +02:00
Alexander Heldt 88095f8936 pinwheel: Fix magnifier in hyprland 2024-06-30 09:24:53 +02:00
Alexander Heldt 91d985ce30 pinwheel: Add keybinding to insert blocks in org-mode 2024-06-25 13:45:24 +02:00
Alexander Heldt c03049fc44 pinwheel: Remove org-habit from emacs 2024-06-25 13:44:50 +02:00
Alexander Heldt a2d047bf6d pinwheel: Add nix-tree 2024-06-19 16:03:20 +02:00
Alexander Heldt 6db1e22cb2 pinwheel: Add module for games 2024-06-19 16:03:04 +02:00
Alexander Heldt 969cac74a4 pinwheel: Don't trigger flycheck-rust-setup when in flycheck-mode 2024-06-19 15:45:40 +02:00
Alexander Heldt 3ce876ccab Update flake inputs 2024-06-19 15:45:40 +02:00
Alexander Heldt d88ae22f9a pinwheel: Enable HTTP server for metals 2024-06-19 15:45:40 +02:00
Alexander Heldt b1e1c6adab pinwheel: Add "all" treesitter languages for emacs 2024-06-19 11:36:49 +02:00
Alexander Heldt a0dbd38865 pinwheel: No need to specify nix LSP server for eglot in emacs 2024-06-19 11:36:02 +02:00
Alexander Heldt a900945c24 pinwheel: Use global flycheck-mode in emacs 2024-06-19 11:35:23 +02:00
Alexander Heldt 1de1da3639 sombrero: Update syncthing GUI options 2024-06-17 20:26:42 +02:00
Alexander Heldt 2f799eeedc pinwheel: Bump graphite-cli version 2024-06-17 16:31:17 +02:00
Alexander Heldt 6e29e7a02b pinwheel: Add protobuf-mode to emacs 2024-06-17 16:30:44 +02:00
Alexander Heldt e0f4a20d8d pinwheel: Use podman alongside docker 2024-06-17 16:30:00 +02:00
Alexander Heldt 61d8211205 pinwheel: Use eglot when in c-mode 2024-06-17 14:20:00 +02:00
Alexander Heldt 3a53823eaf pinwheel: Add c module 2024-06-17 14:20:00 +02:00
Alexander Heldt 1a481601f1 pinwheel: Add pants (called through nix-alien) to work module 2024-06-17 14:20:00 +02:00
Alexander Heldt 722b0e903d Update flake inputs 2024-06-15 13:16:03 +02:00
Alexander Heldt 976318c563 pinwheel: Add python module 2024-06-15 13:13:49 +02:00
Alexander Heldt 71f1337c4c pinwheel: Add zsh prompts when in nix shell and/or direnv 2024-06-15 13:12:39 +02:00
Alexander Heldt c2ca822e37 pinwheel: Remove duplicated p10k config file 2024-06-15 13:11:41 +02:00
Alexander Heldt 164deec80e pinwheel: Add ability to forward USB devices to VMs 2024-06-10 08:37:35 +02:00
Alexander Heldt 161456b7d1 pinwheel: Add direnv module 2024-06-10 08:37:35 +02:00
Alexander Heldt dc2304212f pinwheel: Open PDFs from emacs using firefox 2024-06-10 08:37:35 +02:00
Alexander Heldt b11eed3366 sombrero: Update media folders for plex 2024-06-04 18:02:32 +02:00
Alexander Heldt 324133c91b sombrero: Fix misspelled SSH key 2024-06-03 21:26:47 +02:00
Alexander Heldt 3e73863bf2 pinwheel: Fix dbeaver package name 2024-06-03 21:26:01 +02:00
Alexander Heldt e43e794637 pinwheel: Pin JDK for scala 2024-06-03 21:25:01 +02:00
Alexander Heldt aba632619b pinwheel: Update path for HDMI card 2024-06-03 21:23:25 +02:00
242 changed files with 11352 additions and 1684 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
use flake
+3
View File
@@ -0,0 +1,3 @@
.direnv/
*.qcow2
result
+10
View File
@@ -25,3 +25,13 @@ EDITOR=vim agenix -d "some-secret.age" -i ~/.ssh/alex.pinwheel
Or use some other SSH key that is has been used to key the secret.
# Test VM
Build the test VM with the command:
```
cm --build-test-vm
```
and test it with:
```
cm --run-test-vm
```
+23 -3
View File
@@ -1,9 +1,15 @@
{ inputs, pkgs, lib, config, ... }:
{
inputs,
pkgs,
lib,
config,
...
}:
let
flakePath = config.config-manager.flakePath;
nixosConfiguration = config.config-manager.nixosConfiguration;
nh = inputs.nh.packages."${pkgs.system}".default;
nh = inputs.nh.packages."${pkgs.stdenv.hostPlatform.system}".default;
config-manager =
if flakePath == "" then
@@ -20,12 +26,14 @@ Usage:
Flags:
--update updates the flake
--switch rebuilds + switches configuration (using 'nh')
--build-test-vm, --btvm build test-vm
--run-test-vm, --rtvm run test-vm
EOF
}
update() {
echo -e "\033[0;31mUPDATING FLAKE\033[0m"
nix flake update ${flakePath}
nix flake update --flake ${flakePath}
}
switch() {
@@ -33,11 +41,23 @@ EOF
${nh}/bin/nh os switch --hostname ${nixosConfiguration} ${flakePath}
}
build-test-vm() {
nixos-rebuild build-vm --flake ${flakePath}#test-vm
}
run-test-vm() {
${flakePath}/result/bin/run-test-vm-vm
}
case $1 in
--update)
update ;;
--switch)
switch ;;
--build-test-vm | --btvm)
build-test-vm ;;
--run-test-vm | --rtvm)
run-test-vm ;;
--help | *)
help ;;
esac
Generated
+962 -68
View File
File diff suppressed because it is too large. Load diff
+170 -11
View File
@@ -6,11 +6,17 @@
nixos-hardware.url = "github:nixos/nixos-hardware/master";
nh = {
url = "github:viperML/nh";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nh = {
url = "github:nix-community/nh/b00a24b39944efd4ec7944f02e0bd9113d991767";
};
nix-gc-env.url = "github:Julow/nix-gc-env";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
@@ -26,37 +32,190 @@
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland-contrib = {
url = "github:hyprwm/contrib";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-jetbrains-plugins = {
url = "github:nix-community/nix-jetbrains-plugins";
inputs.nixpkgs.follows = "nixpkgs";
};
naviterm = {
url = "gitlab:detoxify92/naviterm";
inputs.nixpkgs.follows = "nixpkgs";
};
ndp = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/ndp.git?ref=main";
# url = "git+file:///home/alex/code/own/ndp?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
pppdotpm-site = {
url = "git+ssh://git@codeberg.org/ppp/ppp.pm-site.git?ref=main";
url = "git+ssh://gitea@git.ppp.pm:1122/alex/ppp.pm-site.git?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
heldtenkeltdotse-site = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/heldtenkelt.se-site.git?ref=main";
# url = "git+file:///home/alex/code/heldtenkelt.se-site?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
whib-backend = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/whib.git?ref=master";
# url = "path:/home/alex/code/own/whib";
inputs.nixpkgs.follows = "nixpkgs";
};
whib-frontend = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/whib-react.git?ref=master";
# url = "path:/home/alex/code/own/whib-react";
inputs.nixpkgs.follows = "nixpkgs";
};
komga-comictracker = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/komga-comictracker.git?ref=main";
# url = "path:/home/alex/code/own/komga-comictracker";
inputs.nixpkgs.follows = "nixpkgs";
};
komga-bookmanager = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/komga-bookmanager.git?ref=main";
# url = "path:/home/alex/code/own/komga-bookmanager";
inputs.nixpkgs.follows = "nixpkgs";
};
komga-reading-stats = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/komga-reading-stats.git?ref=main";
# url = "path:/home/alex/code/own/komga-reading-stats";
inputs.nixpkgs.follows = "nixpkgs";
};
puppy-tracker = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/puppy-tracker.git?ref=main";
# url = "path:/home/alex/code/puppy-tracker";
inputs.nixpkgs.follows = "nixpkgs";
};
schema = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/schema.git?ref=main";
# url = "path:/home/alex/code/schema";
inputs.nixpkgs.follows = "nixpkgs";
};
todo = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/todo.git?ref=main";
# url = "git+file:///home/alex/code/todo?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
dagbok = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/dagbok.git?ref=main";
# url = "git+file:///home/alex/code/own/dagbok?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
ct = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/ct.git?ref=main";
# url = "git+file:///home/alex/code/own/ct?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
rv = {
url = "git+ssh://gitea@git.ppp.pm:1122/alex/rv.git?ref=main";
# url = "git+file:///home/alex/code/own/rv?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, ... }@inputs: {
outputs =
{ ... }@inputs:
{
nixosConfigurations = {
pinwheel = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
specialArgs = {
inherit inputs;
};
modules = [
./hosts/pinwheel/configuration.nix
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-10th-gen
./hosts/pinwheel/home.nix
];
};
sombrero = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { inherit inputs; };
manatee = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
};
modules = [
./hosts/sombrero/configuration.nix
./hosts/sombrero/home.nix
./hosts/manatee/configuration.nix
./hosts/manatee/home.nix
];
};
backwards = inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
};
modules = [
./hosts/backwards/configuration.nix
./hosts/backwards/home.nix
];
};
tadpole =
let
system = "x86_64-linux";
in
inputs.nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
};
modules = [
./hosts/tadpole/configuration.nix
./hosts/tadpole/home.nix
inputs.whib-backend.nixosModules.${system}.default
inputs.whib-frontend.nixosModules.${system}.default
];
};
test-vm =
let
system = "x86_64-linux";
in
inputs.nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
};
modules = [
./hosts/test-vm/configuration.nix
inputs.whib-backend.nixosModules.${system}.default
inputs.whib-frontend.nixosModules.${system}.default
];
};
};
devShells =
let
system = "x86_64-linux";
pkgs = inputs.nixpkgs.legacyPackages.${system};
in
{
${system}.default = pkgs.mkShell {
packages = [ pkgs.nixfmt ];
};
};
};
}
+72
View File
@@ -0,0 +1,72 @@
{ pkgs, ... }:
{
imports = [
../../config-manager/default.nix
./hardware-configuration.nix
./modules
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
console.keyMap = "sv-latin1";
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
extraConfig.pipewire."90-hdmi-fix" = {
"context.properties" = {
"default.clock.rate" = 48000;
"default.clock.allowed-rates" = [ 48000 ];
};
};
};
hardware = {
graphics = {
enable = true;
extraPackages = [
pkgs.intel-media-driver
pkgs.libvdpau-va-gl
];
};
};
users.users.alex = {
isNormalUser = true;
description = "alex";
extraGroups = [
"networkmanager"
"wheel"
"video"
"render"
];
packages = [ ];
};
environment.variables.EDITOR = "vim";
environment.systemPackages = [
pkgs.vim
];
config-manager = {
flakePath = "/home/alex/config";
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment?
}
@@ -0,0 +1,56 @@
# 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 = [
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/bad3d82a-7bb8-490f-bd01-a4b16fe6f33d";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/D049-60DD";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
swapDevices = [
{ device = "/dev/disk/by-uuid/ff4de0e5-2c60-4ee7-a55c-450727efb921"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
@@ -1,6 +1,5 @@
{ inputs, ... }:
{ inputs, pkgs, ... }:
{
imports = [ inputs.home-manager.nixosModules.home-manager ];
config = {
@@ -14,11 +13,13 @@
home.username = "alex";
home.homeDirectory = "/home/alex";
home.packages = [];
home.packages = [
pkgs.vim
pkgs.p7zip
];
home.stateVersion = "22.11";
home.stateVersion = "24.05";
};
};
};
}
+14
View File
@@ -0,0 +1,14 @@
{ inputs, pkgs, ... }:
{
imports = [ inputs.agenix.nixosModules.default ];
config = {
age = {
identityPaths = [ "/etc/ssh/backwards" ];
};
environment.systemPackages = [
inputs.agenix.packages."${pkgs.stdenv.hostPlatform.system}".default
];
};
}
+61
View File
@@ -0,0 +1,61 @@
{
lib,
config,
...
}:
let
configurationLimit = config.mod.gc.configurationLimit;
in
{
options = {
mod.gc = {
configurationLimit = lib.mkOption {
type = lib.types.int;
default = 10;
description = "number of configuration generations to keep";
};
};
};
config = {
# `nix.gc` cannot prune generations under `~/.local/state/nix/profiles`
# when run as root (NixOS/nix#8508), so home-manager generations piled up.
# `nh clean` walks those per-user profiles too.
programs.nh = {
enable = true;
clean = {
enable = true;
dates = "weekly";
extraArgs = "--keep ${builtins.toString configurationLimit}";
};
};
boot = {
tmp.cleanOnBoot = true;
loader = {
systemd-boot = {
enable = true;
inherit configurationLimit;
};
efi.canTouchEfiVariables = true;
};
blacklistedKernelModules = [ "hid_nintendo" ];
kernelParams = [
"i915.enable_dc=0"
"i915.disable_power_well=0"
];
extraModprobeConfig = ''
options snd-intel-dspcfg dsp_driver=1
options snd_hda_intel power_save=0 power_save_controller=N
options rtw88_core disable_lps_deep=y
options rtw88_pci disable_aspm=y
'';
};
};
}
@@ -5,4 +5,14 @@ let
in
{
imports = lib.mapAttrsToList toModulePath (filterDirs (builtins.readDir ./.));
config = {
mod = {
gc.configurationLimit = 10;
ssh.enable = true;
git.enable = true;
nginx.enable = true;
};
};
}
+105
View File
@@ -0,0 +1,105 @@
{ pkgs, ... }:
let
wrapped = pkgs.wrapFirefox pkgs.firefox-devedition-unwrapped {
extraPolicies = {
DisableFirefoxAccounts = false;
CaptivePortal = false;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
OfferToSaveLogins = false;
OfferToSaveLoginsDefault = false;
PasswordManagerEnabled = false;
FirefoxHome = {
Search = false;
Pocket = false;
Snippets = false;
TopSites = false;
Highlights = false;
};
UserMessaging = {
ExtensionRecommendations = false;
SkipOnboarding = true;
};
};
};
ff-alex = pkgs.writeShellApplication {
name = "ff-alex";
text = ''
${wrapped}/bin/firefox-devedition -P alex --new-window "$@"
'';
};
sharedSettings = {
"general.smoothScroll" = true;
"apz.gtk.kinetic_scroll.enabled" = false;
"network.dns.force_waiting_https_rr" = false;
};
in
{
home-manager.users.alex = {
programs.firefox = {
enable = true;
package = wrapped;
# Pin the legacy profile location. The default changed to the XDG path
# (`$XDG_CONFIG_HOME/mozilla/firefox`) for stateVersion >= "26.05";
# keep the old `~/.mozilla/firefox` so the existing profile isn't
# stranded (migrating would require moving the profile dir by hand).
configPath = ".mozilla/firefox";
profiles = {
alex = {
id = 0;
name = "alex";
isDefault = true;
settings = sharedSettings // { };
};
};
};
xdg = {
# /etc/profiles/per-user/alex/share/applications
desktopEntries = {
ff-alex = {
name = "ff-alex";
exec = "${ff-alex}/bin/ff-alex %U";
terminal = false;
};
};
mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "ff-alex.desktop";
"x-scheme-handler/http" = "ff-alex.desktop";
"x-scheme-handler/https" = "ff-alex.desktop";
"application/x-exension-htm" = "ff-alex.desktop";
"application/x-exension-html" = "ff-alex.desktop";
"application/x-exension-shtml" = "ff-alex.desktop";
"application/xhtml+xml" = "ff-alex.desktop";
"application/x-exension-xhtml" = "ff-alex.desktop";
"application/x-exension-xht" = "ff-alex.desktop";
};
};
# https://github.com/nix-community/home-manager/issues/1213
configFile."mimeapps.list".force = true;
};
home.packages = [
ff-alex
];
};
environment.variables = {
MOZ_ENABLE_WAYLAND = 1;
BROWSER = "${ff-alex}/bin/ff-alex $@";
};
}
+25
View File
@@ -0,0 +1,25 @@
{ pkgs, ... }:
{
programs.steam.enable = true;
services.udev.extraRules = ''
# 8BitDo in Nintendo Switch mode - allow Steam hidraw access
KERNEL=="hidraw*", ATTRS{idVendor}=="057e", ATTRS{idProduct}=="2009", \
MODE="0660", GROUP="input", TAG+="uaccess"
'';
home-manager.users.alex = {
home.packages = [
pkgs.nethack
pkgs.moonlight-qt
pkgs.pcsx2
(pkgs.retroarch.withCores (cores: [
pkgs.libretro.snes9x
pkgs.libretro.genesis-plus-gx
pkgs.libretro.swanstation
]))
];
};
}
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.git.enable;
in
File renamed without changes.
+32
View File
@@ -0,0 +1,32 @@
{ ... }:
{
services = {
displayManager = {
autoLogin = {
enable = true;
user = "alex";
};
};
desktopManager = {
gnome.enable = true;
};
displayManager = {
gdm.enable = true;
};
xserver = {
enable = true;
xkb = {
layout = "se";
variant = "";
};
};
};
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
}
+43
View File
@@ -0,0 +1,43 @@
{ lib, pkgs, ... }:
let
py = pkgs.python3Packages;
in
{
# The K400 Plus firmware turns two-finger swipes into coarse wheel ticks.
# This switches its touchpad to raw HID++ reporting and exposes it as a
# native multitouch touchpad, so GNOME scrolls it smoothly.
systemd.services.k400-touchpad = {
description = "Logitech K400 Plus raw touchpad bridge";
wants = [ "systemd-udevd.service" ];
after = [ "systemd-udevd.service" ];
wantedBy = [ "multi-user.target" ];
environment = {
# `toPythonModule` exposes Solaar's `logitech_receiver`. Not a
# `withPackages` env, since Solaar bundles a conflicting `hid_parser`.
PYTHONPATH = py.makePythonPath [
(py.toPythonModule pkgs.solaar)
py.evdev
py.pygobject3
];
# `logitech_receiver` imports Gdk at load time
GI_TYPELIB_PATH = lib.makeSearchPath "lib/girepository-1.0" [
pkgs.gtk3
pkgs.pango.out
pkgs.gdk-pixbuf
pkgs.harfbuzz
pkgs.gobject-introspection
];
};
serviceConfig = {
ExecStart = "${py.python.interpreter} ${./k400-touchpad.py}";
Restart = "on-failure";
RestartSec = 3;
TimeoutStopSec = 8;
};
};
boot.kernelModules = [ "uinput" ];
}
@@ -0,0 +1,648 @@
# Logitech K400 Plus raw touchpad bridge.
#
# Trimmed copy of the touchpad mode of k400-raw
# (https://github.com/Infinality/k400-raw, commit 04f2e58). The K400 Plus
# firmware quantizes touchpad movement into coarse mouse/wheel steps. This
# switches the touchpad to HID++ TOUCHPAD_RAW_XY (0x6100) reporting and
# exposes the raw contacts as a two-finger multitouch touchpad, so
# libinput/GNOME handle motion, tapping and scrolling. The keyboard and the
# physical buttons stay on the kernel's input device.
#
# Dropped from upstream: pointer mode, F-key configuration, CLI tunables and
# receiver/slot overrides.
#
# MIT License
#
# Copyright (c) 2026 Infinality
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import argparse
import logging
import signal
import struct
import threading
import time
from dataclasses import dataclass
from evdev import AbsInfo, UInput, ecodes
# Solaar warns at import time when libnotify is missing; nothing here sends
# desktop notifications
logging.getLogger("logitech_receiver.desktop_notifications").setLevel(logging.ERROR)
from logitech_receiver import base, listener # noqa: E402
from logitech_receiver import receiver as receiver_mod # noqa: E402
from logitech_receiver.hidpp20_constants import SupportedFeature # noqa: E402
LOG = logging.getLogger("k400-touchpad")
WPID_K400_PLUS = "404D"
RAW_FEATURE = SupportedFeature.TOUCHPAD_RAW_XY
RAW_FLAG = 0x01
ENHANCED_FLAG = 0x04
RAW_ENHANCED = RAW_FLAG | ENHANCED_FLAG
ORIGIN_LOWER_LEFT = 0x01
ORIGIN_LOWER_RIGHT = 0x02
ORIGIN_UPPER_RIGHT = 0x04
TOUCHPAD_NAME = "Logitech K400 Raw Touchpad"
FEATURE_WAIT_SECONDS = 15.0
RECONNECT_DELAY_SECONDS = 2.0
class DeviceNotReady(RuntimeError):
"""Expected transient state: the K400 is paired but asleep/offline."""
# --- HID++ raw report parsing ------------------------------------------------
@dataclass
class Touch:
finger_id: int
contact_status: int
x: int
y: int
@dataclass
class RawFrame:
spurious: bool
touches: tuple[Touch, Touch]
@dataclass
class TouchpadInfo:
x_size: int
y_size: int
max_fingers: int
origin: int
dpi: int
def parse_touch(data: bytes, offset: int) -> Touch:
x_high = data[offset]
y_high = data[offset + 2]
return Touch(
finger_id=data[offset + 6] >> 4,
contact_status=y_high >> 6,
x=((x_high & 0x3F) << 8) | data[offset + 1],
y=((y_high & 0x3F) << 8) | data[offset + 3],
)
def parse_frame(data: bytes) -> RawFrame | None:
if len(data) < 16:
return None
return RawFrame(
spurious=bool(data[8] & 0x02),
touches=(parse_touch(data, 2), parse_touch(data, 9)),
)
def parse_info(data: bytes) -> TouchpadInfo:
if not data or len(data) < 15:
raise RuntimeError(f"Short/empty TOUCHPAD_RAW_XY GetTouchpadInfo response: {data!r}")
return TouchpadInfo(
x_size=int.from_bytes(data[0:2], "big"),
y_size=int.from_bytes(data[2:4], "big"),
max_fingers=data[7],
origin=data[8],
dpi=int.from_bytes(data[13:15], "big"),
)
def active_touches(frame: RawFrame) -> list[Touch]:
touches = [t for t in frame.touches if t.finger_id != 0 and t.contact_status != 0]
if touches:
return touches
# Defensive fallback in case this firmware represents contact status
# differently while still supplying finger IDs.
return [t for t in frame.touches if t.finger_id != 0]
def origin_inversions(origin: int) -> tuple[bool, bool]:
# Screen-relative coordinates: +X right, +Y down.
invert_x = origin in (ORIGIN_LOWER_RIGHT, ORIGIN_UPPER_RIGHT)
invert_y = origin in (ORIGIN_LOWER_LEFT, ORIGIN_LOWER_RIGHT)
return invert_x, invert_y
# --- HID++ device access (via Solaar's logitech_receiver) --------------------
class StartedEventsListener(listener.EventsListener):
def __init__(self, receiver, callback):
self.started_event = threading.Event()
super().__init__(receiver, callback)
def has_started(self):
self.started_event.set()
@dataclass
class Candidate:
receiver: object
device: object
path: str
online: bool
has_raw_feature: bool
def find_k400():
"""Find the paired K400 Plus.
Prefer one that is awake and answers TOUCHPAD_RAW_XY, then one that is
awake. A sole paired K400 is used even while asleep; wait_for_feature()
then waits for it to wake.
"""
opened = []
candidates = []
for dev_info in base.receivers():
try:
r = receiver_mod.create_receiver(base, dev_info)
if not r:
continue
opened.append(r)
# Solaar stops iterating after the receiver's paired-device count
for dev in list(r):
if (dev.wpid or "").upper() != WPID_K400_PLUS:
continue
try:
online = bool(dev.ping())
except Exception:
online = False
has_raw_feature = False
if online:
try:
has_raw_feature = bool(dev.features[RAW_FEATURE])
except Exception as exc:
LOG.debug("K400 slot %d could not probe 0x6100: %s", dev.number, exc)
candidates.append(Candidate(r, dev, dev_info.path, online, has_raw_feature))
except Exception as exc:
LOG.debug("Unable to inspect receiver %s: %s", dev_info.path, exc)
preferred = (
[c for c in candidates if c.online and c.has_raw_feature]
or [c for c in candidates if c.online]
or candidates
)
selected = preferred[0] if len(preferred) == 1 else None
for r in opened:
if selected is None or r is not selected.receiver:
try:
r.close()
except Exception:
pass
if selected is None:
if not preferred:
raise RuntimeError("Could not find a paired Logitech K400 Plus")
if not any(c.online for c in preferred):
raise DeviceNotReady("Multiple paired K400 Plus records, none responding; waiting for one to wake")
locations = ", ".join(f"{c.path} slot {c.device.number}" for c in preferred)
raise RuntimeError(f"Found multiple responding K400 Plus devices: {locations}")
LOG.info(
"Selected K400 Plus on receiver %s slot %d (online=%s)",
selected.path, selected.device.number, selected.online,
)
return selected.receiver, selected.device
def wait_for_feature(dev, timeout_seconds: float, interval_seconds: float = 0.25) -> int:
"""Wake the device and wait for TOUCHPAD_RAW_XY to become queryable.
Solaar's FeaturesArray refuses feature discovery while dev.online is false,
and a K400 may be paired but asleep. Retry ping/feature discovery, falling
back to a direct ROOT.GetFeature query. If a transient lookup cached False,
the false entry is removed before installing the known-good feature index.
"""
deadline = time.monotonic() + timeout_seconds
last_error = None
while time.monotonic() < deadline:
try:
dev.ping()
except Exception as exc:
last_error = exc
if dev.online:
try:
index = dev.features[RAW_FEATURE]
if index:
return index
except Exception as exc:
last_error = exc
try:
response = dev.request(0x0000, struct.pack("!H", int(RAW_FEATURE)))
if response and response[0]:
index = response[0]
# FeaturesArray forbids deletion through its public API, so
# use the underlying dict operation only for this recovery
if dict.get(dev.features, RAW_FEATURE) is False:
dict.__delitem__(dev.features, RAW_FEATURE)
dev.features[RAW_FEATURE] = index
if len(response) > 1:
dev.features.flags[RAW_FEATURE] = response[1]
if len(response) > 2:
dev.features.version[RAW_FEATURE] = response[2]
return index
except Exception as exc:
last_error = exc
time.sleep(interval_seconds)
message = (
f"Timed out waiting for HID++ feature 0x{int(RAW_FEATURE):04X} "
f"(online={dev.online}; last error: {last_error!r})"
)
if not dev.online:
raise DeviceNotReady(message)
raise RuntimeError(message)
def enable_raw_reports(dev) -> None:
dev.feature_request(RAW_FEATURE, 0x20, bytes([RAW_ENHANCED]))
reply = dev.feature_request(RAW_FEATURE, 0x10)
if not reply or (reply[0] & RAW_FLAG) == 0:
raise RuntimeError(f"Failed to enable HID++ raw reporting; readback was {reply!r}")
if reply[0] != RAW_ENHANCED:
LOG.warning(
"Device did not preserve every requested state bit: requested=0x%02X actual=0x%02X",
RAW_ENHANCED, reply[0],
)
# --- Virtual touchpad --------------------------------------------------------
def make_absinfo(maximum: int, resolution: int = 0) -> AbsInfo:
return AbsInfo(value=0, min=0, max=maximum, fuzz=0, flat=0, resolution=resolution)
class VirtualTouchpad:
"""Translate K400 raw contacts into a two-slot Linux Type-B MT touchpad.
The uinput device is created on first connect and kept across HID++
reconnects, so the desktop keeps its settings for it.
"""
def __init__(self):
self.ui = None
self.geometry = None
self.invert_x = False
self.invert_y = False
# The HID++ listener thread and the reconnect loop both write events
self.lock = threading.Lock()
self.finger_to_slot: dict[int, int] = {}
self.slot_to_finger: dict[int, int] = {}
self.slot_xy: dict[int, tuple[int, int]] = {}
self.next_tracking_id = 1
self.last_btn_touch = 0
self.last_tool_finger = 0
self.last_tool_doubletap = 0
def configure(self, info: TouchpadInfo):
self.invert_x, self.invert_y = origin_inversions(info.origin)
resolution = max(1, round(info.dpi / 25.4))
geometry = (info.x_size, info.y_size, resolution)
if self.ui is not None:
if geometry != self.geometry:
LOG.warning(
"K400 geometry changed after reconnect: was %s now %s; keeping the original",
self.geometry, geometry,
)
return
self.geometry = geometry
x_max, y_max, _ = geometry
self.ui = UInput(
{
ecodes.EV_KEY: [ecodes.BTN_TOUCH, ecodes.BTN_TOOL_FINGER, ecodes.BTN_TOOL_DOUBLETAP],
ecodes.EV_ABS: [
(ecodes.ABS_X, make_absinfo(x_max, resolution)),
(ecodes.ABS_Y, make_absinfo(y_max, resolution)),
(ecodes.ABS_MT_SLOT, make_absinfo(1)),
(ecodes.ABS_MT_TRACKING_ID, make_absinfo(65535)),
(ecodes.ABS_MT_POSITION_X, make_absinfo(x_max, resolution)),
(ecodes.ABS_MT_POSITION_Y, make_absinfo(y_max, resolution)),
],
},
name=TOUCHPAD_NAME,
# Logitech's vendor ID with a deliberately synthetic product ID
vendor=0x046D,
product=0xF400,
version=1,
bustype=ecodes.BUS_USB,
phys="k400-touchpad/input0",
# Indirect pointing device, not a touchscreen
input_props=[ecodes.INPUT_PROP_POINTER],
)
LOG.info(
"Created virtual touchpad %s, %dx%d, %d units/mm (~%.1fx%.1f mm)",
self.ui.device.path if self.ui.device else self.ui.devnode,
x_max, y_max, resolution, x_max / resolution, y_max / resolution,
)
# Give udev/libinput time to pick up the device before the first events
time.sleep(0.5)
def _xy(self, touch: Touch) -> tuple[int, int]:
x_max, y_max, _ = self.geometry
x = x_max - touch.x if self.invert_x else touch.x
y = y_max - touch.y if self.invert_y else touch.y
return max(0, min(x_max, x)), max(0, min(y_max, y))
def _new_tracking_id(self) -> int:
tid = self.next_tracking_id
self.next_tracking_id = tid + 1 if tid < 65535 else 1
return tid
def release_all(self):
with self.lock:
if self.ui is None:
return
changed = False
for slot in sorted(self.slot_to_finger):
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_SLOT, slot)
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_TRACKING_ID, -1)
changed = True
self.finger_to_slot.clear()
self.slot_to_finger.clear()
self.slot_xy.clear()
for code, attr in (
(ecodes.BTN_TOUCH, "last_btn_touch"),
(ecodes.BTN_TOOL_FINGER, "last_tool_finger"),
(ecodes.BTN_TOOL_DOUBLETAP, "last_tool_doubletap"),
):
if getattr(self, attr):
self.ui.write(ecodes.EV_KEY, code, 0)
setattr(self, attr, 0)
changed = True
if changed:
self.ui.syn()
def process(self, frame: RawFrame):
if frame.spurious:
return
# The K400 reports at most two contacts. If malformed data ever
# contains duplicate IDs, keep only the first occurrence.
current = {}
for touch in active_touches(frame):
current.setdefault(touch.finger_id, touch)
with self.lock:
if self.ui is None:
return
old_ids = set(self.finger_to_slot)
new_ids = set(current)
# Release vanished contacts first so a slot can be reused this frame
for finger_id in sorted(old_ids - new_ids):
slot = self.finger_to_slot.pop(finger_id)
self.slot_to_finger.pop(slot, None)
self.slot_xy.pop(slot, None)
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_SLOT, slot)
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_TRACKING_ID, -1)
for finger_id in sorted(new_ids - old_ids):
free = next((s for s in (0, 1) if s not in self.slot_to_finger), None)
if free is None:
LOG.warning("More contacts than MT slots; ignoring finger id %d", finger_id)
continue
self.finger_to_slot[finger_id] = free
self.slot_to_finger[free] = finger_id
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_SLOT, free)
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_TRACKING_ID, self._new_tracking_id())
# Emit every tracked contact each frame so libinput sees the raw
# sensor report cadence
for finger_id, slot in sorted(self.finger_to_slot.items(), key=lambda p: p[1]):
touch = current.get(finger_id)
if touch is None:
continue
x, y = self._xy(touch)
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_SLOT, slot)
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_POSITION_X, x)
self.ui.write(ecodes.EV_ABS, ecodes.ABS_MT_POSITION_Y, y)
self.slot_xy[slot] = (x, y)
count = len(self.slot_to_finger)
# Touchpads also need the legacy single-touch axes; mirror the
# lowest-numbered active slot
if count:
xy = self.slot_xy.get(min(self.slot_to_finger))
if xy is not None:
self.ui.write(ecodes.EV_ABS, ecodes.ABS_X, xy[0])
self.ui.write(ecodes.EV_ABS, ecodes.ABS_Y, xy[1])
for code, attr, value in (
(ecodes.BTN_TOUCH, "last_btn_touch", int(count > 0)),
(ecodes.BTN_TOOL_FINGER, "last_tool_finger", int(count == 1)),
(ecodes.BTN_TOOL_DOUBLETAP, "last_tool_doubletap", int(count >= 2)),
):
if value != getattr(self, attr):
self.ui.write(ecodes.EV_KEY, code, value)
setattr(self, attr, value)
self.ui.syn()
def close(self):
self.release_all()
if self.ui is not None:
self.ui.close()
self.ui = None
# --- Session / reconnect loop ------------------------------------------------
def run(touchpad: VirtualTouchpad, stop: threading.Event):
session = 0
while not stop.is_set():
session += 1
r = dev = events = None
feature_index = None
old_raw_state = None
raw_enabled = False
reconfigure = threading.Event()
reconfigure_failures = 0
try:
r, dev = find_k400()
feature_index = wait_for_feature(dev, FEATURE_WAIT_SECONDS)
info = parse_info(dev.feature_request(RAW_FEATURE, 0x00))
LOG.info(
"K400 raw surface: %dx%d, dpi=%d, origin=%d, max_fingers=%d",
info.x_size, info.y_size, info.dpi, info.origin, info.max_fingers,
)
touchpad.configure(info)
def callback(n):
if n.devnumber != dev.number:
return
# Receiver connection notification; the K400 forgets raw mode
# while asleep, so re-enable it on every link-up
if n.sub_id == 0x41:
flags = (n.data[0] & 0xF0) if n.data else 0x40
dev.online = not (flags & 0x40)
touchpad.release_all()
if dev.online:
LOG.debug("K400 link established; re-enabling raw mode")
reconfigure.set()
else:
LOG.debug("K400 asleep/offline")
return
if n.sub_id != feature_index or (n.address >> 4) != 0x00:
return
frame = parse_frame(n.data)
if frame is None:
LOG.warning("Short raw XY notification: %r", n.data)
return
touchpad.process(frame)
events = StartedEventsListener(r, callback)
events.start()
if not events.started_event.wait(timeout=3.0):
raise RuntimeError("Timed out starting HID++ receiver listener")
state_reply = dev.feature_request(RAW_FEATURE, 0x10)
old_raw_state = state_reply[0] if state_reply else 0x00
enable_raw_reports(dev)
raw_enabled = True
LOG.info("K400 raw touchpad active (receiver slot %d)", dev.number)
while not stop.is_set():
if not events.is_alive():
raise ConnectionError("HID++ receiver listener stopped")
if not reconfigure.wait(timeout=1.0):
continue
reconfigure.clear()
if stop.is_set():
break
touchpad.release_all()
try:
feature_index = wait_for_feature(dev, min(FEATURE_WAIT_SECONDS, 4.0))
enable_raw_reports(dev)
reconfigure_failures = 0
LOG.info("K400 raw mode re-enabled after wake")
except DeviceNotReady as exc:
reconfigure_failures = 0
LOG.debug("K400 went offline during re-enable (%s); waiting for next link-up", exc)
except Exception as exc:
reconfigure_failures += 1
if not events.is_alive() or reconfigure_failures >= 3:
raise ConnectionError("Repeated raw-mode re-enable failure") from exc
LOG.debug("Transient re-enable failure %d/3: %s", reconfigure_failures, exc)
if stop.wait(RECONNECT_DELAY_SECONDS):
break
reconfigure.set()
except DeviceNotReady as exc:
LOG.debug("K400 not ready (%s); retrying", exc)
except Exception as exc:
if stop.is_set():
break
LOG.warning(
"K400 HID++ session #%d lost (%s). Retrying in %.1f s.",
session, exc, RECONNECT_DELAY_SECONDS,
exc_info=LOG.isEnabledFor(logging.DEBUG),
)
finally:
try:
touchpad.release_all()
except Exception:
LOG.debug("Error releasing touches", exc_info=True)
if stop.is_set() and dev is not None and raw_enabled:
try:
restore = 0x00 if old_raw_state is None else old_raw_state
dev.feature_request(RAW_FEATURE, 0x20, bytes([restore]))
LOG.info("Restored HID++ raw-report state to 0x%02X", restore)
except Exception:
LOG.warning("Could not restore raw-report state during shutdown")
if events is not None:
try:
events.stop()
events.join(timeout=2.0)
except Exception:
LOG.debug("Error stopping receiver listener", exc_info=True)
if r is not None:
try:
r.close()
except Exception:
LOG.debug("Error closing receiver", exc_info=True)
if not stop.is_set():
stop.wait(RECONNECT_DELAY_SECONDS)
def main():
parser = argparse.ArgumentParser(description="Logitech K400 Plus raw touchpad bridge")
parser.add_argument("-v", "--verbose", action="count", default=0, help="-v for info, -vv for debug")
args = parser.parse_args()
# Keep Solaar's own logging at WARNING so journald isn't flooded with
# HID++ frames
logging.basicConfig(level=logging.WARNING, format="%(levelname)-8s %(name)s: %(message)s")
LOG.setLevel([logging.WARNING, logging.INFO, logging.DEBUG][min(args.verbose, 2)])
touchpad = VirtualTouchpad()
stop = threading.Event()
def on_signal(signum, _frame):
LOG.info("Received signal %s; stopping", signum)
stop.set()
signal.signal(signal.SIGINT, on_signal)
signal.signal(signal.SIGTERM, on_signal)
try:
run(touchpad, stop)
finally:
touchpad.close()
if __name__ == "__main__":
main()
@@ -0,0 +1,18 @@
{ ... }:
{
time.timeZone = "Europe/Stockholm";
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "sv_SE.UTF-8";
LC_IDENTIFICATION = "sv_SE.UTF-8";
LC_MEASUREMENT = "sv_SE.UTF-8";
LC_MONETARY = "sv_SE.UTF-8";
LC_NAME = "sv_SE.UTF-8";
LC_NUMERIC = "sv_SE.UTF-8";
LC_PAPER = "sv_SE.UTF-8";
LC_TELEPHONE = "sv_SE.UTF-8";
LC_TIME = "sv_SE.UTF-8";
};
}
@@ -0,0 +1,48 @@
{ config, ... }:
{
networking = {
hostName = "backwards";
wireless.enable = false;
networkmanager = {
enable = true;
wifi.backend = "iwd";
ensureProfiles = {
environmentFiles = [
config.age.secrets.wireless-network-secrets.path
];
profiles = {
w1-f1_5G = {
connection = {
id = "w1-f1_5G";
type = "wifi";
interface-name = "wlp1s0";
};
wifi = {
ssid = "w1-f1_5G";
mode = "infrastructure";
};
wifi-security = {
key-mgmt = "wpa-psk";
psk = "$w1_f1_psk";
};
ipv4 = {
method = "manual";
addresses = "192.168.50.202/24";
gateway = "192.168.50.1";
dns = "1.1.1.1";
};
};
};
};
};
};
age.secrets = {
"wireless-network-secrets".file = ../../../../secrets/backwards/wireless-network-secrets.age;
};
}
+22
View File
@@ -0,0 +1,22 @@
{ lib, config, ... }:
let
enabled = config.mod.nginx.enable;
in
{
options = {
mod.nginx = {
enable = lib.mkEnableOption "Enable nginx module";
};
};
config = lib.mkIf enabled {
services = {
nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
};
};
};
}
+157
View File
@@ -0,0 +1,157 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.ssh.enable;
authorizedKeysPath = "/home/alex/.ssh/authorized-keys";
rootSSHKeyPath = "/etc/ssh";
in
{
options = {
mod.ssh = {
enable = lib.mkEnableOption "enable ssh module";
};
};
config = lib.mkIf enabled {
home-manager.users.alex = {
programs.ssh = {
enable = true;
enableDefaultConfig = false;
settings = {
"manatee" = {
HostName = "manatee";
User = "alex";
IdentityFile = "/home/alex/.ssh/alex.backwards-manatee";
Port = 1122;
};
"pinwheel" = {
HostName = "pinwheel";
User = "alex";
IdentityFile = "/home/alex/.ssh/alex.backwards-pinwheel";
Port = 1122;
};
"git.ppp.pm" = {
HostName = "git.ppp.pm";
IdentityFile = "/home/alex/.ssh/alex.backwards-git.ppp.pm";
};
"*" = {
ForwardAgent = false;
AddKeysToAgent = "no";
Compression = false;
ServerAliveInterval = 0;
ServerAliveCountMax = 3;
HashKnownHosts = false;
UserKnownHostsFile = "~/.ssh/known_hosts";
ControlMaster = "no";
ControlPath = "~/.ssh/master-%r@%n:%p";
ControlPersist = "no";
};
};
};
home.packages = [ pkgs.sshfs ];
};
environment.etc."ssh/authorized_keys_command" = {
mode = "0755";
text = ''
#!${pkgs.bash}/bin/bash
for file in ${authorizedKeysPath}/*; do
${pkgs.coreutils}/bin/cat "$file"
done
'';
};
services = {
openssh = {
enable = true;
ports = [ 1122 ];
hostKeys = [
{
path = "${rootSSHKeyPath}/root.backwards";
type = "ed25519";
}
];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
authorizedKeysCommand = "/etc/ssh/authorized_keys_command";
authorizedKeysCommandUser = "root";
};
};
networking = {
firewall = {
allowedTCPPorts = [ 1122 ];
};
};
age.secrets = {
"root.backwards" = {
file = ../../../../secrets/backwards/root.backwards.age;
path = "${rootSSHKeyPath}/root.backwards";
};
"root.backwards.pub" = {
file = ../../../../secrets/backwards/root.backwards.pub.age;
path = "${rootSSHKeyPath}/root.backwards.pub";
};
"alex.backwards-manatee" = {
file = ../../../../secrets/backwards/alex.backwards-manatee.age;
path = "/home/alex/.ssh/alex.backwards-manatee";
owner = "alex";
group = "users";
};
"alex.backwards-manatee.pub" = {
file = ../../../../secrets/backwards/alex.backwards-manatee.pub.age;
path = "/home/alex/.ssh/alex.backwards-manatee.pub";
owner = "alex";
group = "users";
};
"alex.backwards-pinwheel" = {
file = ../../../../secrets/backwards/alex.backwards-pinwheel.age;
path = "/home/alex/.ssh/alex.backwards-pinwheel";
owner = "alex";
group = "users";
};
"alex.backwards-pinwheel.pub" = {
file = ../../../../secrets/backwards/alex.backwards-pinwheel.pub.age;
path = "/home/alex/.ssh/alex.backwards-pinwheel.pub";
owner = "alex";
group = "users";
};
"alex.pinwheel-backwards.pub" = {
file = ../../../../secrets/pinwheel/alex.pinwheel-backwards.pub.age;
path = "${authorizedKeysPath}/alex.pinwheel-backwards.pub";
};
"alex.backwards-git.ppp.pm" = {
file = ../../../../secrets/backwards/alex.backwards-git.ppp.pm.age;
path = "/home/alex/.ssh/alex.backwards-git.ppp.pm";
owner = "alex";
group = "users";
};
"alex.backwards-git.ppp.pm.pub" = {
file = ../../../../secrets/backwards/alex.backwards-git.ppp.pm.pub.age;
path = "/home/alex/.ssh/alex.backwards-git.ppp.pm.pub";
owner = "alex";
group = "users";
};
};
};
}
@@ -0,0 +1,49 @@
{
config,
lib,
pkgs,
...
}:
{
services.tailscale = {
enable = true;
# Required for the systray to control tailscale without root
extraSetFlags = [ "--operator=alex" ];
};
networking.firewall = {
checkReversePath = "loose";
allowedUDPPorts = [ 41641 ];
};
home-manager.users.alex = {
# The official tailscale systray, including the node list and exit nodes
services.tailscale-systray = {
enable = true;
package = config.services.tailscale.package;
};
# The systray never retries if no tray exists when it starts, so wait for the
# AppIndicator extension to provide one. This is done in the main process,
# rather than `ExecStartPre`, to not block activation while waiting
systemd.user.services.tailscale-systray.Service.ExecStart = lib.mkForce (toString (
pkgs.writeShellScript "tailscale-systray" ''
until ${pkgs.systemd}/bin/busctl --user status org.kde.StatusNotifierWatcher >/dev/null 2>&1; do
sleep 1
done
exec ${lib.getExe config.services.tailscale.package} systray
''
));
programs.gnome-shell = {
enable = true;
extensions = [
# GNOME has no system tray without it
{ package = pkgs.gnomeExtensions.appindicator; }
];
};
};
}
+56
View File
@@ -0,0 +1,56 @@
{ pkgs, ... }:
{
imports = [
../../config-manager/default.nix
../../shared-modules/syncthing.nix
./hardware-configuration.nix
./disk-config.nix
./modules
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
users.users.alex = {
isNormalUser = true;
description = "alex";
extraGroups = [
"wheel"
"storage"
];
};
environment.variables.EDITOR = "vim";
environment.systemPackages = with pkgs; [
vim
git
];
config-manager = {
flakePath = "/home/alex/config";
};
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how
# to actually do that.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "24.11"; # Did you read the comment?
}
+251
View File
@@ -0,0 +1,251 @@
{
inputs,
pkgs,
config,
...
}:
{
imports = [ inputs.disko.nixosModules.disko ];
config = {
users.groups.storage = { };
users.users.storage = {
isSystemUser = true;
description = "storage";
group = "storage";
};
systemd.tmpfiles.settings = {
"10-media-public" = {
"/mnt/media/public" = {
d = {
# Create directory
user = "storage";
group = "storage";
mode = "2775";
};
z = {
# Ensure permissions are inherited
user = "storage";
group = "storage";
mode = "2775";
};
};
};
"10-cameras-public" = {
"/mnt/cameras/public" = {
d = {
# Create directory
user = "storage";
group = "storage";
mode = "2775";
};
z = {
# Ensure permissions are inherited
user = "storage";
group = "storage";
mode = "2775";
};
};
};
"10-sync-public" = {
"/mnt/sync/public" = {
d = {
# Create directory
user = "storage";
group = "storage";
mode = "2775";
};
z = {
# Ensure permissions are inherited
user = "storage";
group = "storage";
mode = "2775";
};
};
};
};
environment.systemPackages = [
pkgs.smartmontools
];
services.smartd = {
enable = true;
devices = [
{ device = config.disko.devices.disk.root.device; }
{ device = config.disko.devices.disk.disk1.device; }
{ device = config.disko.devices.disk.disk2.device; }
{ device = config.disko.devices.disk.disk3.device; }
{ device = config.disko.devices.disk.disk4.device; }
];
};
services.zfs.autoScrub.enable = true;
# Cap the ARC at 4 GiB (default is ~all of RAM); leaves room for services on this low-memory host.
boot.kernelParams = [ "zfs.zfs_arc_max=${toString (4 * 1024 * 1024 * 1024)}" ];
# Don't force-import the pool if it appears in use elsewhere; safer default in 26.11+.
boot.zfs.forceImportRoot = false;
networking.hostId = "0a9474e7"; # Required by ZFS
disko.devices = {
disk = {
root = {
type = "disk";
device = "/dev/nvme0n1";
content = {
type = "gpt";
partitions = {
ESP = {
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
disk1 = {
type = "disk";
device = "/dev/disk/by-id/ata-ST8000VN004-3CP101_WWZ8QCG4";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
disk2 = {
type = "disk";
device = "/dev/disk/by-id/ata-ST8000VN004-3CP101_WWZ8QDJ5";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
disk3 = {
type = "disk";
device = "/dev/disk/by-id/ata-TOSHIBA_MG10ACA20TE_85K2A0UCF4MJ";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
disk4 = {
type = "disk";
device = "/dev/disk/by-id/ata-TOSHIBA_MG10ACA20TE_85K2A0V6F4MJ";
content = {
type = "gpt";
partitions = {
zfs = {
size = "100%";
content = {
type = "zfs";
pool = "storage";
};
};
};
};
};
};
zpool = {
storage = {
type = "zpool";
mode = {
topology = {
type = "topology";
vdev = [
{
mode = "mirror";
members = [
"disk1"
"disk2"
];
}
{
mode = "mirror";
members = [
"disk3"
"disk4"
];
}
];
};
};
rootFsOptions = {
mountpoint = "none";
compression = "zstd";
xattr = "sa";
"com.sun:auto-snapshot" = "false";
};
datasets = {
media = {
type = "zfs_fs";
mountpoint = "/mnt/media";
options.mountpoint = "legacy"; # otherwise we get a race between systemd and zfs; https://github.com/nix-community/disko/issues/214
};
cameras = {
type = "zfs_fs";
mountpoint = "/mnt/cameras";
options.mountpoint = "legacy"; # otherwise we get a race between systemd and zfs; https://github.com/nix-community/disko/issues/214
};
sync = {
type = "zfs_fs";
mountpoint = "/mnt/sync";
options.mountpoint = "legacy"; # otherwise we get a race between systemd and zfs; https://github.com/nix-community/disko/issues/214
};
};
};
};
};
};
}
+46
View File
@@ -0,0 +1,46 @@
# 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 = [
"xhci_pci"
"nvme"
"ahci"
"usb_storage"
"usbhid"
"sd_mod"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
swapDevices = [
{
device = "/swapfile";
size = 32 * 1024; # 32GB
}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+26
View File
@@ -0,0 +1,26 @@
{ inputs, pkgs, ... }:
{
imports = [ inputs.home-manager.nixosModules.home-manager ];
config = {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.alex = {
programs.home-manager.enable = true;
home.username = "alex";
home.homeDirectory = "/home/alex";
home.packages = [
pkgs.streamrip
pkgs.claude-code
pkgs.wl-clipboard
];
home.stateVersion = "24.11";
};
};
};
}
@@ -4,11 +4,11 @@
config = {
age = {
identityPaths = [ "/etc/ssh/sombrero" ];
identityPaths = [ "/etc/ssh/manatee" ];
};
environment.systemPackages = [
inputs.agenix.packages."${pkgs.system}".default
inputs.agenix.packages."${pkgs.stdenv.hostPlatform.system}".default
];
};
}
+23
View File
@@ -0,0 +1,23 @@
{ lib, config, ... }:
let
enabled = config.mod.atuin.enable;
port = 8889;
in
{
options = {
mod.atuin = {
enable = lib.mkEnableOption "Enable atuin module";
};
};
config = lib.mkIf enabled {
services.atuin = {
enable = true;
host = "0.0.0.0";
inherit port;
openFirewall = true;
openRegistration = false;
database.createLocally = true;
};
};
}
@@ -0,0 +1,37 @@
{ lib, config, ... }:
let
enabled = config.mod.audiobookshelf.enable;
in
{
options = {
mod.audiobookshelf = {
enable = lib.mkEnableOption "Enable audiobookshelf module";
};
};
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Audiobookshelf";
port = 8000;
description = "Audiobooks & podcasts";
}
];
users.users.audiobookshelf = {
isSystemUser = true;
description = "audiobookshelf";
group = "storage";
};
services.audiobookshelf = {
enable = true;
user = "audiobookshelf";
group = "storage";
host = "0.0.0.0";
port = 8000;
};
};
}
+45
View File
@@ -0,0 +1,45 @@
{
inputs,
lib,
config,
...
}:
let
configurationLimit = config.mod.gc.configurationLimit;
in
{
imports = [ inputs.nix-gc-env.nixosModules.default ];
options = {
mod.gc = {
configurationLimit = lib.mkOption {
type = lib.types.int;
default = 10;
description = "number of configuration generations to keep";
};
};
};
config = {
nix.gc = {
automatic = true;
dates = "weekly";
# `delete_generations` added by nix-gc-env
delete_generations = "+${builtins.toString configurationLimit}";
};
boot = {
tmp.cleanOnBoot = true;
loader = {
systemd-boot = {
enable = true;
inherit configurationLimit;
};
efi.canTouchEfiVariables = true;
};
};
};
}
+43
View File
@@ -0,0 +1,43 @@
{ config, lib, ... }:
let
# Every host is issued the same way: a DNS-01 challenge through Hetzner.
hetznerCert = {
dnsProvider = "hetzner";
environmentFile = config.age.secrets.hetzner-dns.path;
group = "nginx";
# Flag names are lego v5's (v4 spelled them --dns.propagation-wait and
# --dns-timeout).
extraLegoFlags = [
"--dns.resolvers=1.1.1.1:53,8.8.8.8:53"
"--dns.propagation.wait=60s" # Wait for 60 seconds for DNS propagation
"--dns.timeout=60"
"--http-timeout=60"
];
};
in
{
security.acme = {
acceptTerms = true;
defaults = {
email = "acme@ppp.pm";
};
certs = lib.genAttrs [
"ha.ppp.pm"
"komga.ppp.pm"
"romm.ppp.pm"
"puppy.ppp.pm"
"todo.ppp.pm"
"schema.ppp.pm"
"dagbok.ppp.pm"
] (_: hetznerCert);
};
age = {
secrets = {
"hetzner-dns".file = ../../../../secrets/manatee/hetzner-dns.age;
};
};
}
+59
View File
@@ -0,0 +1,59 @@
{
inputs,
lib,
config,
...
}:
let
enabled = config.mod.dagbok.enable;
nginxEnabled = config.mod.nginx.enable;
port = 8093;
in
{
options = {
mod.dagbok = {
enable = lib.mkEnableOption "Enable dagbok module";
};
};
imports = [
inputs.dagbok.nixosModules.default
];
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Dagbok";
port = port;
description = "Work and personal journal";
url = "https://dagbok.ppp.pm";
}
];
services.dagbok = {
enable = true;
address = "127.0.0.1";
inherit port;
secureCookies = true;
timeZone = "Europe/Stockholm";
publicUrl = "https://dagbok.ppp.pm";
tokenFile = config.age.secrets."dagbok-token".path;
};
services.nginx = lib.mkIf nginxEnabled {
virtualHosts."dagbok.ppp.pm" = {
forceSSL = true;
useACMEHost = "dagbok.ppp.pm";
extraConfig = ''
client_max_body_size 32m;
'';
locations."/" = {
proxyPass = "http://127.0.0.1:${toString port}";
};
};
};
age.secrets."dagbok-token".file = ../../../../secrets/manatee/dagbok-token.age;
};
}
+36
View File
@@ -0,0 +1,36 @@
{ lib, ... }:
let
toModulePath = dir: _: ./. + "/${dir}";
filterDirs = dirs: lib.attrsets.filterAttrs (_: type: type == "directory") dirs;
in
{
imports = lib.mapAttrsToList toModulePath (filterDirs (builtins.readDir ./.));
config = {
mod = {
gc.configurationLimit = 10;
ssh.enable = true;
git.enable = true;
tmux.enable = true;
nginx.enable = true;
syncthing.enable = true;
restic.enable = true;
transmission.enable = true;
audiobookshelf.enable = true;
jellyfin.enable = true;
immich.enable = false;
navidrome.enable = true;
komga.enable = true;
romm.enable = true;
homepage.enable = true;
disk-smart.enable = true;
puppy-tracker.enable = true;
todo.enable = true;
schema.enable = true;
atuin.enable = true;
dagbok.enable = true;
};
};
}
@@ -0,0 +1,159 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.disk-smart.enable;
disks = [
{ path = "/dev/disk/by-id/ata-ST8000VN004-3CP101_WWZ8QCG4"; name = "seagate_8tb_1"; label = "Seagate 8TB #1"; }
{ path = "/dev/disk/by-id/ata-ST8000VN004-3CP101_WWZ8QDJ5"; name = "seagate_8tb_2"; label = "Seagate 8TB #2"; }
{ path = "/dev/disk/by-id/ata-TOSHIBA_MG10ACA20TE_85K2A0UCF4MJ"; name = "toshiba_20tb_1"; label = "Toshiba 20TB #1"; }
{ path = "/dev/disk/by-id/ata-TOSHIBA_MG10ACA20TE_85K2A0V6F4MJ"; name = "toshiba_20tb_2"; label = "Toshiba 20TB #2"; }
];
outputDir = "/var/lib/disk-smart";
collectScript = pkgs.writeShellScript "disk-smart-collect" ''
set -euo pipefail
export PATH="${lib.makeBinPath [ pkgs.smartmontools pkgs.jq pkgs.coreutils ]}"
mkdir -p ${outputDir}
result="{"
${lib.concatMapStringsSep "\n" (disk: ''
raw=$(smartctl -j -A -H ${disk.path} 2>/dev/null || true)
temp=$(echo "$raw" | jq -r '.temperature.current // empty')
power_on=$(echo "$raw" | jq -r '.power_on_time.hours // empty')
smart_status=$(echo "$raw" | jq -r '.smart_status.passed // empty')
reallocated=$(echo "$raw" | jq -r '[.ata_smart_attributes.table[] | select(.name == "Reallocated_Sector_Ct")][0].raw.value // empty')
pending=$(echo "$raw" | jq -r '[.ata_smart_attributes.table[] | select(.name == "Current_Pending_Sector")][0].raw.value // empty')
result="$result\"${disk.name}\":{\"temperature\":$temp,\"power_on_hours\":$power_on,\"smart_passed\":$smart_status,\"reallocated_sectors\":$reallocated,\"pending_sectors\":$pending},"
'') disks}
# Remove trailing comma, close object
result="''${result%,}}"
echo "$result" | jq . > ${outputDir}/smart.json.tmp
mv ${outputDir}/smart.json.tmp ${outputDir}/smart.json
'';
indent = prefix: s:
lib.concatMapStringsSep "\n"
(line: if line == "" then line else prefix + line)
(lib.splitString "\n" s);
mkSensor = disk: ''
- name: "${disk.label} Temperature"
value_template: "{{ value_json.${disk.name}.temperature }}"
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
- name: "${disk.label} Power On Hours"
value_template: "{{ value_json.${disk.name}.power_on_hours }}"
unit_of_measurement: "h"
state_class: total_increasing
- name: "${disk.label} SMART Passed"
value_template: "{{ value_json.${disk.name}.smart_passed }}"
- name: "${disk.label} Reallocated Sectors"
value_template: "{{ value_json.${disk.name}.reallocated_sectors }}"
state_class: measurement
- name: "${disk.label} Pending Sectors"
value_template: "{{ value_json.${disk.name}.pending_sectors }}"
state_class: measurement
'';
sensorYaml = indent " " (lib.concatMapStrings mkSensor disks);
sectorEntities = lib.concatMap (disk: [
"sensor.${disk.name}_reallocated_sectors"
"sensor.${disk.name}_pending_sectors"
]) disks;
sectorEntitiesYaml = lib.concatMapStringsSep "\n"
(id: " - ${id}") sectorEntities;
smartPassedEntities = map (disk: "sensor.${disk.name}_smart_passed") disks;
smartPassedEntitiesYaml = lib.concatMapStringsSep "\n"
(id: " - ${id}") smartPassedEntities;
in
{
options = {
mod.disk-smart = {
enable = lib.mkEnableOption "Enable disk SMART monitoring module";
};
};
config = lib.mkIf enabled {
mod.home-assistant.extraConfig = ''
rest:
- resource: http://127.0.0.1:9633/smart.json
scan_interval: 60
sensor:
${sensorYaml}
automation disk_smart:
- alias: "Disk sector count increased"
trigger:
- platform: state
entity_id:
${sectorEntitiesYaml}
condition:
- condition: template
value_template: "{{ trigger.from_state.state | int(-1) >= 0 and trigger.to_state.state | int(0) > trigger.from_state.state | int(0) }}"
action:
- service: notify.mobile_app_pixel_9_pro
data:
title: "Disk SMART warning"
message: "{{ trigger.to_state.attributes.friendly_name }} increased from {{ trigger.from_state.state }} to {{ trigger.to_state.state }}"
- alias: "Disk SMART check failed"
trigger:
- platform: state
entity_id:
${smartPassedEntitiesYaml}
condition:
- condition: template
value_template: "{{ trigger.to_state.state | lower == 'false' }}"
action:
- service: notify.mobile_app_pixel_9_pro
data:
title: "Disk SMART FAILURE"
message: "{{ trigger.to_state.attributes.friendly_name }} reports SMART failure — drive is likely failing"
'';
systemd.services.disk-smart-collect = {
description = "Collect disk SMART data";
serviceConfig = {
Type = "oneshot";
ExecStart = collectScript;
};
};
systemd.timers.disk-smart-collect = {
description = "Periodically collect disk SMART data";
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "1min";
OnUnitActiveSec = "1min";
};
};
services.nginx.virtualHosts."127.0.0.1" = {
listen = [
{ addr = "127.0.0.1"; port = 9633; }
];
locations."= /smart.json" = {
alias = "${outputDir}/smart.json";
extraConfig = ''
default_type application/json;
'';
};
};
};
}
+39
View File
@@ -0,0 +1,39 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.git.enable;
in
{
options = {
mod.git = {
enable = lib.mkEnableOption "enable git module";
};
};
config = lib.mkIf enabled {
home-manager.users.alex = {
programs.git = {
enable = true;
includes = [
{ path = ./gitconfig; }
];
settings = {
rerere.enable = true;
};
};
home.packages = [ pkgs.tig ];
home.file.".tigrc".text = ''
set main-view-line-number = yes
set main-view-line-number-interval = 1
'';
};
};
}
+9
View File
@@ -0,0 +1,9 @@
[user]
name = Alexander Heldt
email = me@alexanderheldt.se
[url "git@github.com:"]
insteadOf = https://github.com/
[url "gitea@git.ppp.pm:"]
insteadOf = https://git.ppp.pm/
@@ -0,0 +1,371 @@
{
pkgs,
lib,
config,
...
}:
let
nginxEnabled = config.mod.nginx.enable;
cfg = config.mod.home-assistant;
configFile = pkgs.writeText "ha-configuration.yaml" ''
# Loads default set of integrations. Do not remove.
default_config:
http:
use_x_forwarded_for: true
trusted_proxies:
- 127.0.0.1
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
automation nix:
# pyplejd keeps using a dead BLE client forever ("Service Discovery has not
# been performed yet") instead of reconnecting; reloading the integration fixes it
- alias: Reload Plejd when its BLE link goes stale
mode: single
triggers:
- trigger: event
event_type: system_log_event
event_data:
level: WARNING
conditions:
- "{{ 'pyplejd' in trigger.event.data.name and 'Service Discovery has not been performed yet' in (trigger.event.data.message | join(' ')) }}"
actions:
- action: homeassistant.reload_config_entry
target:
entity_id: light.takbelysning
# With mode: single, this caps it at one reload per 5 minutes
- delay: "00:05:00"
script: !include scripts.yaml
scene: !include scenes.yaml
recorder:
purge_keep_days: 365
# Turns logged warnings/errors into `system_log_event`s that automations can react to
system_log:
fire_event: true
notify:
# Send notifications to `phones` so they reach every phone
- platform: group
name: phones
services:
- action: mobile_app_pixel_9_pro
- action: mobile_app_iphone
template:
- binary_sensor:
- name: Galleriet too warm
unique_id: galleriet_too_warm
state: "{{ states('sensor.3rd_temp_och_fuktmatare_temperature') | float(0) > 23 }}"
availability: "{{ has_value('sensor.3rd_temp_och_fuktmatare_temperature') }}"
# Stops a temperature hovering around 23 from re-triggering the alert
delay_off: "00:15:00"
alert:
fridge_door:
name: Fridge is open
done_message: Fride is closed
entity_id: binary_sensor.kyldorr
state: "on"
repeat: 2
skip_first: true
notifiers:
- phones
kitchen_water_leak:
name: Water leak detected in the kitchen
done_message: Kitchen is dry again
entity_id: binary_sensor.vattenlackage_1_flood
state: "on"
repeat: 5
notifiers:
- phones
data:
ttl: 0
priority: high
# Plays on the alarm stream so it sounds even when the phone is silenced
channel: alarm_stream
# iOS equivalent: a critical alert, which bypasses silent mode and Focus
push:
sound:
name: default
critical: 1
volume: 1.0
galleriet_too_warm:
name: Galleriet is above 23°C
message: "Galleriet is {{ states('sensor.3rd_temp_och_fuktmatare_temperature') }}°C"
done_message: Galleriet is below 23°C again
entity_id: binary_sensor.galleriet_too_warm
state: "on"
repeat: 60
notifiers:
- mobile_app_pixel_9_pro
${cfg.extraConfig}'';
btResetScript = pkgs.writeShellScript "bt-reset" ''
set -euo pipefail
export PATH="${
lib.makeBinPath [
pkgs.bluez
pkgs.util-linux
pkgs.kmod
pkgs.gnugrep
pkgs.coreutils
pkgs.systemd
]
}"
logger -t bt-reset "Starting Bluetooth adapter reset..."
# Exit early if the adapter is already present and running
if hciconfig hci0 2>/dev/null | grep -q "UP RUNNING"; then
logger -t bt-reset "hci0 is already UP RUNNING — nothing to do"
exit 0
fi
# If hci0 exists but isn't UP, try bringing it up
if hciconfig hci0 2>/dev/null; then
logger -t bt-reset "hci0 exists but not running — bringing it up"
hciconfig hci0 up || true
sleep 2
if hciconfig hci0 2>/dev/null | grep -q "UP RUNNING"; then
logger -t bt-reset "hci0 is UP now"
systemctl restart bluetooth.service
logger -t bt-reset "bluetooth.service restarted — done"
exit 0
fi
fi
# Hard reset: reload the btusb kernel module (works for USB adapters)
logger -t bt-reset "hci0 missing — reloading btusb module..."
modprobe -r btusb 2>/dev/null || true
sleep 3
modprobe btusb
sleep 3
if hciconfig hci0 2>/dev/null; then
hciconfig hci0 up
logger -t bt-reset "hci0 restored after module reload"
else
logger -t bt-reset "ERROR: hci0 not found after module reload"
exit 1
fi
# Restart the bluetooth systemd service so bluetoothd picks up the adapter
systemctl restart bluetooth.service
logger -t bt-reset "bluetooth.service restarted — done"
'';
in
{
options = {
mod.home-assistant = {
extraConfig = lib.mkOption {
type = lib.types.lines;
default = "";
description = "Extra YAML to append to Home Assistant's configuration.yaml";
};
};
};
config = {
mod.homepage.services = [
{
name = "Home Assistant";
port = 8123;
description = "Home automation";
}
];
hardware.bluetooth.enable = true;
# Give up and enter a `failed` state (visible in `systemctl --failed`) if the
# container restarts more than 5 times in 5 minutes, instead of crash-looping
# forever. The window is deliberately long: a slow crash-loop (~5s per attempt)
# stays under systemd's default 5-starts-per-10s limit and would otherwise
# retry indefinitely.
systemd.services.podman-homeassistant = {
startLimitIntervalSec = 300;
startLimitBurst = 5;
};
virtualisation.oci-containers = {
backend = "podman";
containers.homeassistant = {
image = "ghcr.io/home-assistant/home-assistant:stable";
volumes = [
"/home/alex/.config/home-assistant:/config"
"${configFile}:/config/configuration.yaml:ro"
# Pass in bluetooth
"/run/dbus:/run/dbus:ro"
];
environment.TZ = "Europe/Stockholm";
extraOptions = [
"--network=host"
# Allows HA to perform low-level network operations (scan/reset adapter)
"--cap-add=NET_ADMIN"
"--cap-add=NET_RAW"
# Pass in Zigbee antenna
"--device=/dev/serial/by-id/usb-Nabu_Casa_ZBT-2_9C139EAAD464-if00:/dev/ttyACM0"
];
};
};
services = {
blueman.enable = true;
nginx = lib.mkIf nginxEnabled {
recommendedProxySettings = true;
virtualHosts."ha.ppp.pm" = {
forceSSL = true;
useACMEHost = "ha.ppp.pm";
extraConfig = ''
proxy_buffering off;
'';
locations."/" = {
proxyPass = "http://127.0.0.1:8123";
proxyWebsockets = true;
};
};
};
# Trigger reset via udev when hci0 disappears
udev.extraRules = ''
ACTION=="remove", SUBSYSTEM=="bluetooth", KERNEL=="hci0", \
TAG+="systemd", ENV{SYSTEMD_WANTS}+="bt-reset.service"
'';
};
systemd = {
services = {
# Trigger reset on bluetoothd failure
bluetooth = {
unitConfig.OnFailure = [ "bt-reset.service" ];
};
bt-reset = {
description = "Reset Bluetooth adapter";
after = [ "bluetooth.service" ];
serviceConfig = {
Type = "oneshot";
ExecStart = btResetScript;
Restart = "on-failure";
RestartSec = "10s";
StartLimitIntervalSec = "120";
StartLimitBurst = 3;
};
};
};
timers.bt-reset = {
description = "Periodically reset Bluetooth adapter";
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5min"; # first run 5 min after boot
OnUnitActiveSec = "4h"; # then every 4 hours
RandomizedDelaySec = "5min";
};
};
user = {
timers = {
"update-hetzner-dns" = {
unitConfig = {
Description = "updates Hetzner DNS records";
};
timerConfig = {
Unit = "update-hetzner-dns.service";
OnCalendar = "*-*-* *:00/30:00";
Persistent = true;
};
wantedBy = [ "timers.target" ];
};
};
services = {
"update-hetzner-dns" = {
unitConfig = {
Description = "updates Hetzner DNS records";
};
serviceConfig = {
Type = "exec";
EnvironmentFile = config.age.secrets.hetzner-dns.path;
};
path = [
pkgs.curl
pkgs.coreutils
pkgs.jq
];
script = ''
SUBDOMAINS="ha komga romm puppy todo schema dagbok"
INTERFACE="enp3s0"
CURRENT_IP=$(curl -s --fail --interface "$INTERFACE" ifconfig.me)
for SUBDOMAIN in $SUBDOMAINS; do
LAST_IP_FILE="/tmp/hetzner-dns-''${SUBDOMAIN}-ip"
LAST_IP=""
if [[ -f "$LAST_IP_FILE" ]]; then
LAST_IP=$(cat "$LAST_IP_FILE")
fi
if [[ "$CURRENT_IP" == "$LAST_IP" ]]; then
echo "$SUBDOMAIN: IP unchanged, NOOP update."
else
echo "$SUBDOMAIN: Updating IP"
JSON_BODY=$(jq -n --arg ip "$CURRENT_IP" '{records: [{value: $ip}]}')
curl \
--fail \
-X POST \
-H "Authorization: Bearer $HETZNER_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$JSON_BODY" \
"https://api.hetzner.cloud/v1/zones/ppp.pm/rrsets/''${SUBDOMAIN}/A/actions/set_records" \
&& echo $CURRENT_IP > $LAST_IP_FILE
fi
done
'';
};
};
};
};
age = {
secrets = {
"hetzner-dns" = {
file = ../../../../secrets/manatee/hetzner-dns.age;
owner = "alex";
group = "users";
};
};
};
};
}
+121
View File
@@ -0,0 +1,121 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.homepage.enable;
nginxEnabled = config.mod.nginx.enable;
services = config.mod.homepage.services;
serviceToCard =
svc:
let
href = if svc.url != null then svc.url else "http://manatee:${toString svc.port}";
in
''
<a class="card" href="${href}">
<div class="name">${svc.name}</div>
<div class="desc">${svc.description}</div>
<div class="port">:${toString svc.port}</div>
</a>
'';
page = pkgs.writeTextDir "index.html" ''
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>manatee</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: #1a1b26;
color: #c0caf5;
min-height: 100vh;
padding: 3rem 1.5rem;
}
h1 {
text-align: center;
font-size: 1.5rem;
font-weight: 400;
color: #7aa2f7;
margin-bottom: 2rem;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1rem;
max-width: 900px;
margin: 0 auto;
}
.card {
display: block;
background: #24283b;
border: 1px solid #414868;
border-radius: 8px;
padding: 1.25rem;
text-decoration: none;
color: inherit;
transition: border-color 0.15s;
}
.card:hover { border-color: #7aa2f7; }
.name { font-size: 1.1rem; font-weight: 600; color: #c0caf5; }
.desc { font-size: 0.85rem; color: #565f89; margin-top: 0.35rem; }
.port { font-size: 0.8rem; color: #414868; margin-top: 0.5rem; font-family: monospace; }
</style>
</head>
<body>
<h1>manatee</h1>
<div class="grid">
${lib.concatMapStrings serviceToCard services}
</div>
</body>
</html>
'';
in
{
options = {
mod.homepage = {
enable = lib.mkEnableOption "Enable homepage module";
services = lib.mkOption {
type = lib.types.listOf (
lib.types.submodule {
options = {
name = lib.mkOption { type = lib.types.str; };
port = lib.mkOption { type = lib.types.port; };
description = lib.mkOption { type = lib.types.str; };
url = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Link target for the card; defaults to http://manatee:<port>.";
};
};
}
);
default = [ ];
description = "Services to display on the homepage";
};
};
};
config = lib.mkIf (enabled && nginxEnabled) {
services.nginx.virtualHosts."homepage" = {
listen = [
{
addr = "0.0.0.0";
port = 9999;
}
];
root = page;
locations."/" = {
index = "index.html";
};
};
networking.firewall.allowedTCPPorts = [ 9999 ];
};
}
+43
View File
@@ -0,0 +1,43 @@
{ lib, config, ... }:
let
enabled = config.mod.immich.enable;
in
{
options = {
mod.immich = {
enable = lib.mkEnableOption "Enable immich module";
};
};
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Immich";
port = 2283;
description = "Photo library";
}
];
users.users.immich = {
isSystemUser = true;
group = "storage";
extraGroups = [
"render"
"video"
];
};
services.immich = {
enable = true;
user = "immich";
group = "storage";
host = "0.0.0.0";
mediaLocation = "/mnt/cameras/public";
accelerationDevices = [ "/dev/dri/renderD128" ];
};
};
}
@@ -0,0 +1,68 @@
{
lib,
pkgs,
config,
...
}:
let
enabled = config.mod.jellyfin.enable;
in
{
options = {
mod.jellyfin = {
enable = lib.mkEnableOption "Enable jellyfin module";
};
};
config = lib.mkIf enabled {
users.users.jellyfin = {
isSystemUser = true;
group = "storage";
extraGroups = [
"render"
"video"
];
};
hardware = {
graphics = {
enable = true;
extraPackages = [
pkgs.intel-media-driver # Modern Intel VA-API driver (needed for N305)
pkgs.libvdpau-va-gl # VDPAU backend for VA-API GLX interop
pkgs.intel-compute-runtime # OpenCL support
];
};
};
services = {
jellyfin = {
enable = true;
openFirewall = true;
user = "jellyfin";
group = "storage";
};
};
mod.homepage.services = [
{
name = "Jellyfin";
port = 8096;
description = "Media streaming";
}
];
networking = {
firewall.allowedTCPPorts = [ 8096 ];
};
environment.systemPackages = [
pkgs.jellyfin
pkgs.jellyfin-web
pkgs.jellyfin-ffmpeg
];
};
}
+159
View File
@@ -0,0 +1,159 @@
{
inputs,
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.komga.enable;
nginxEnabled = config.mod.nginx.enable;
in
{
options = {
mod.komga = {
enable = lib.mkEnableOption "Enable komga module";
};
};
imports = [
inputs.komga-comictracker.nixosModules.default
inputs.komga-bookmanager.nixosModules.default
inputs.komga-reading-stats.nixosModules.default
];
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Komga";
port = 8002;
description = "Comic library";
}
{
name = "Komga Reader";
port = 8888;
description = "Comic reader";
}
{
name = "Komga Book Manager";
port = 8686;
description = "Book manager";
}
{
name = "Komga Reading Stats";
port = 8787;
description = "Reading stats";
}
];
users.users.komga = {
isSystemUser = true;
group = "storage";
};
services.komga = {
enable = true;
user = "komga";
group = "storage";
settings = {
server.port = 8002;
komga."cors.allowed-origins" = [
"http://manatee:8888"
"https://komga.ppp.pm"
];
};
openFirewall = true;
};
services.nginx = lib.mkIf nginxEnabled {
virtualHosts."komga-reader" = {
listen = [
{
addr = "0.0.0.0";
port = 8888;
}
];
root = (pkgs.writeTextDir "komga-reader.html" (builtins.readFile ./komga-reader.html));
locations."/" = {
index = "komga-reader.html";
tryFiles = "$uri $uri/ /komga-reader.html";
};
};
virtualHosts."komga.ppp.pm" = {
forceSSL = true;
useACMEHost = "komga.ppp.pm";
locations."/" = {
proxyPass = "http://127.0.0.1:8002";
proxyWebsockets = true;
};
};
};
networking.firewall.allowedTCPPorts = [ 8888 ];
programs.comictracker = {
enable = true;
komgaUrl = "http://127.0.0.1:8002";
komgaLibraryId = "0NVZH5AK3RPE1";
secretsFile = config.age.secrets.komga-comicbooktracker-credentials.path;
};
services.komga-book-manager = {
enable = true;
port = 8686;
group = "storage";
komgaUrl = "http://127.0.0.1:8002";
credentialsFile = config.age.secrets.komga-bookmanager-credentials.path;
libraryRoot = "/mnt/media/public/books";
libraryId = "0PNE1NEPY6995";
};
# `libraryRoot` is bind mounted into the service's own mount namespace when it
# starts, so starting before the ZFS dataset is mounted leaves it with an empty folder
systemd.services.komga-book-manager.unitConfig.RequiresMountsFor = [
config.services.komga-book-manager.libraryRoot
];
services.komga-reading-stats = {
enable = true;
host = "0.0.0.0";
port = 8787;
origin = "http://manatee:8787";
anthropicApiKeyFile = config.age.secrets.komga-reading-stats-claude-api-key.path;
claudeModel = "claude-sonnet-4-6";
komga = {
url = "http://127.0.0.1:8002";
apiKeyFile = config.age.secrets.komga-reading-stats-komga-api-key.path;
};
};
age.secrets = {
"komga-comicbooktracker-credentials" = {
file = ../../../../secrets/manatee/komga-comicbooktracker-credentials.age;
owner = "alex";
group = "users";
};
"komga-bookmanager-credentials" = {
file = ../../../../secrets/manatee/komga-bookmanager-credentials.age;
owner = "alex";
group = "users";
};
"komga-reading-stats-claude-api-key" = {
file = ../../../../secrets/manatee/komga-reading-stats-claude-api-key.age;
};
"komga-reading-stats-komga-api-key" = {
file = ../../../../secrets/manatee/komga-reading-stats-komga-api-key.age;
};
};
};
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,59 @@
{
inputs,
lib,
pkgs,
config,
...
}:
let
navidromeEnabled = config.mod.navidrome.enable;
in
{
imports = [ inputs.ndp.nixosModules.lbsync ];
options = {
mod.navidrome = {
enable = lib.mkEnableOption "Enable navidrome module";
};
};
config = {
mod.homepage.services = lib.mkIf navidromeEnabled [
{
name = "Navidrome";
port = 4533;
description = "Music streaming";
}
];
services = lib.mkIf navidromeEnabled {
navidrome = {
enable = true;
openFirewall = true;
user = "navidrome";
group = "storage";
settings = {
Port = 4533;
Address = "0.0.0.0";
MusicFolder = "/mnt/media/public/music";
};
lbsync = {
enable = true;
settingsFile = config.age.secrets."lbsync-config".path;
};
};
};
age.secrets."lbsync-config" = lib.mkIf navidromeEnabled {
file = ../../../../secrets/manatee/lbsync-config.age;
};
# `MusicFolder` is bind mounted into the service's own mount namespace when it
# starts, so starting before the ZFS dataset is mounted leaves it with an empty folder
systemd.services.navidrome = lib.mkIf navidromeEnabled {
unitConfig.RequiresMountsFor = [ config.services.navidrome.settings.MusicFolder ];
};
};
}
+50
View File
@@ -0,0 +1,50 @@
{ ... }:
let
hostAddress = "192.168.50.203";
in
{
networking = {
hostName = "manatee";
# Required for asymmetric routing (sending replies out a different interface
# than the default route). Without this, the kernel drops the return traffic.
firewall.checkReversePath = "loose";
defaultGateway = "192.168.50.1";
nameservers = [ "1.1.1.1" ];
interfaces = {
enp3s0 = {
useDHCP = false;
ipv4 = {
addresses = [
{
address = hostAddress;
prefixLength = 24;
}
];
};
ipv4.routes = [
{
address = "0.0.0.0";
prefixLength = 0;
via = "192.168.50.1"; # Router
options = {
table = "100";
};
}
];
};
};
localCommands = ''
# Ensure local LAN traffic uses the main table, e.g. responds to the local machine
ip rule list | grep -q "192.168.50.0/24 lookup main" || \
ip rule add to 192.168.50.0/24 lookup main priority 4999
# All other traffic from this IP uses Table 100 (e.g. responds to router and back out)
ip rule list | grep -q "from ${hostAddress} lookup 100" || \
ip rule add from ${hostAddress} lookup 100 priority 5000
'';
};
}
+28
View File
@@ -0,0 +1,28 @@
{ lib, config, ... }:
let
enabled = config.mod.nginx.enable;
in
{
options = {
mod.nginx = {
enable = lib.mkEnableOption "Enable nginx module";
};
};
config = lib.mkIf enabled {
services = {
nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
};
};
networking = {
firewall = {
allowedTCPPorts = [ 443 ];
};
};
};
}
@@ -0,0 +1,63 @@
{
inputs,
lib,
config,
...
}:
let
enabled = config.mod.puppy-tracker.enable;
nginxEnabled = config.mod.nginx.enable;
port = 8089;
in
{
options = {
mod.puppy-tracker = {
enable = lib.mkEnableOption "Enable puppy-tracker module";
};
};
imports = [
inputs.puppy-tracker.nixosModules.default
];
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Puppy Tracker";
port = port;
description = "Sleep, meals, pees, poos";
# Login needs HTTPS (Secure cookies), so link to the public vhost.
url = "https://puppy.ppp.pm";
}
];
services.puppy-tracker = {
enable = true;
inherit port;
openFirewall = true;
# Served publicly over HTTPS via the nginx vhost below.
secureCookies = true;
# Shared registration secret; the file holds `PUPPY_INVITE_CODE=...`.
inviteCodeFile = config.age.secrets."puppy-tracker-invite-code".path;
};
services.nginx = lib.mkIf nginxEnabled {
virtualHosts."puppy.ppp.pm" = {
forceSSL = true;
useACMEHost = "puppy.ppp.pm";
# Photo uploads are up to 15 MB; give nginx headroom over its 1 MB default.
extraConfig = ''
client_max_body_size 20m;
'';
locations."/" = {
proxyPass = "http://127.0.0.1:${toString port}";
};
};
};
age.secrets."puppy-tracker-invite-code".file =
../../../../secrets/manatee/puppy-tracker-invite-code.age;
};
}
+220
View File
@@ -0,0 +1,220 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.restic.enable;
# Where the consistent, restic-ready copies of service state are staged.
# Lives on the external backup disk. root-only (0700): these dumps contain
# credentials (HA .storage, secrets.yaml, session tokens, the romm database).
stateDir = "/mnt/backup/public/state";
# Produce consistent, restore-ready copies of every service's state under
# ${stateDir}. Runs as root before the state backups. SQLite DBs are copied
# via the online-backup API (safe on a live, WAL-mode DB); the romm MariaDB is
# dumped logically with mariadb-dump --single-transaction. Rebuildable caches
# and indexes are skipped to keep the offsite copy lean.
stateDumpScript = pkgs.writeShellScript "state-backup-dump" ''
export PATH=${
lib.makeBinPath [
pkgs.sqlite
pkgs.rsync
pkgs.podman
pkgs.coreutils
pkgs.findutils
]
}
set -euo pipefail
umask 077
STATE=${lib.escapeShellArg stateDir}
install -d -m700 "$STATE"
# snapshot SRC DEST [extra rsync excludes...]
# Copies plain files with rsync (excluding live DBs, their WAL/SHM sidecars
# and logs), then makes a consistent online copy of each *.db / *.sqlite.
snapshot() {
local src="$1" dst="$2"
shift 2
if [ ! -e "$src" ]; then
echo "state-backup: skip (missing) $src"
return 0
fi
install -d -m700 "$dst"
rsync -a --delete \
--exclude='*.sqlite' --exclude='*.sqlite-shm' --exclude='*.sqlite-wal' \
--exclude='*.db' --exclude='*.db-shm' --exclude='*.db-wal' \
--exclude='*.log' --exclude='*.log.*' \
--exclude='__pycache__/' \
"$@" \
"$src/" "$dst/"
# find -H: with DynamicUser, /var/lib/<name> is a symlink into
# /var/lib/private, and plain find stops at the link and finds no
# databases (rsync follows "$src/", but excludes them on purpose).
while IFS= read -r db; do
local rel="''${db#"$src"/}"
install -d -m700 "$dst/$(dirname "$rel")"
sqlite3 "$db" ".backup '$dst/$rel'"
done < <(find -H "$src" -maxdepth 4 -type f \( -name '*.sqlite' -o -name '*.db' \))
}
# --- romm: logical MariaDB dump + user assets (saves/states/screenshots) ---
# Cover art under resources/ is intentionally skipped (refetched from
# metadata providers); redis is a rebuildable cache.
if podman exec romm-db true 2>/dev/null; then
install -d -m700 "$STATE/romm"
podman exec romm-db sh -c \
'exec mariadb-dump --user="$MARIADB_USER" --password="$MARIADB_PASSWORD" --single-transaction --no-tablespaces "$MARIADB_DATABASE"' \
> "$STATE/romm/romm.sql"
rsync -a --delete /var/lib/romm/assets/ "$STATE/romm/assets/"
else
echo "state-backup: skip (romm-db not running)"
fi
# --- komga: only database.sqlite matters (read progress, users, collections).
# tasks.sqlite is transient and the lucene/ index is rebuilt on demand. ---
if [ -e /var/lib/komga/database.sqlite ]; then
install -d -m700 "$STATE/komga"
sqlite3 /var/lib/komga/database.sqlite ".backup '$STATE/komga/database.sqlite'"
fi
# --- home-assistant: config, credentials and integrations, plus the two live
# SQLite DBs. Recorder history (home-assistant_v2.db) is included per choice.
# deps/ and tts/ are reinstalled/regenerated; logs are dropped. ---
HA=/home/alex/.config/home-assistant
if [ -e "$HA" ]; then
install -d -m700 "$STATE/home-assistant"
rsync -a --delete \
--exclude='home-assistant_v2.db' --exclude='home-assistant_v2.db-shm' --exclude='home-assistant_v2.db-wal' \
--exclude='zigbee.db' --exclude='zigbee.db-shm' --exclude='zigbee.db-wal' \
--exclude='*.log' --exclude='*.log.*' --exclude='*.log.fault' \
--exclude='deps/' --exclude='tts/' --exclude='__pycache__/' \
"$HA/" "$STATE/home-assistant/"
for db in home-assistant_v2.db zigbee.db; do
if [ -e "$HA/$db" ]; then
sqlite3 "$HA/$db" ".backup '$STATE/home-assistant/$db'"
fi
done
fi
# --- remaining NixOS services: generic snapshot, skipping rebuildable caches ---
snapshot /var/lib/navidrome "$STATE/navidrome" --exclude='cache/'
snapshot /var/lib/jellyfin "$STATE/jellyfin" --exclude='transcodes/' --exclude='cache/' --exclude='metadata/' --exclude='log/' --exclude='data/subtitles/'
snapshot /var/lib/audiobookshelf "$STATE/audiobookshelf" --exclude='metadata/'
snapshot /var/lib/puppy-tracker "$STATE/puppy-tracker"
snapshot /var/lib/todo "$STATE/todo"
snapshot /var/lib/schema "$STATE/schema"
snapshot /var/lib/dagbok "$STATE/dagbok"
snapshot /var/lib/komga-book-manager "$STATE/komga-book-manager"
snapshot /var/lib/komga-reading-stats "$STATE/komga-reading-stats"
echo "state-backup: dump complete"
'';
# A run killed mid-way (e.g. DNS dropping during an upload) leaves its lock
# behind, and every later run then fails in the pre-start "cat config"
# check. unlock only removes stale locks; "|| true" keeps a first run
# against a not-yet-initialized repo working.
backupPrepareCommand = "${pkgs.restic}/bin/restic unlock || true";
# Retention shared by all jobs.
pruneOpts = [
"--keep-daily 1"
"--keep-weekly 7"
"--keep-yearly 12"
];
in
{
options.mod.restic.enable = lib.mkEnableOption "Enable restic";
config = lib.mkIf enabled {
fileSystems."/mnt/backup" = {
device = "/dev/disk/by-uuid/34601701-65e6-4b2c-ac4d-8bef3dfd743f";
fsType = "ext4";
options = [ "nofail" ];
};
services.restic.backups = {
"sync-to-external" = {
initialize = true;
passwordFile = config.age.secrets.restic-password.path;
paths = [ "/mnt/sync/public" ];
repository = "/mnt/backup/restic";
timerConfig = {
OnCalendar = "*-*-* 0/12:00:00";
Persistent = true;
};
inherit pruneOpts backupPrepareCommand;
};
"sync-to-cloud" = {
initialize = true;
passwordFile = config.age.secrets.restic-password.path;
environmentFile = config.age.secrets.restic-cloud-sync-key.path;
repositoryFile = config.age.secrets.restic-cloud-sync-repository.path;
paths = [ "/mnt/sync/public" ];
timerConfig = {
OnCalendar = "*-*-* 0/12:00:00";
Persistent = true;
};
inherit pruneOpts backupPrepareCommand;
};
# Service state (databases etc.). No timer of their own: the state-backup
# orchestrator below runs the dump once and then triggers these in order,
# so both back up the same consistent staging dir without racing it.
"state-to-external" = {
initialize = true;
passwordFile = config.age.secrets.restic-password.path;
paths = [ stateDir ];
repository = "/mnt/backup/restic";
timerConfig = null;
inherit pruneOpts backupPrepareCommand;
};
"state-to-cloud" = {
initialize = true;
passwordFile = config.age.secrets.restic-password.path;
environmentFile = config.age.secrets.restic-cloud-sync-key.path;
repositoryFile = config.age.secrets.restic-cloud-sync-repository.path;
paths = [ stateDir ];
timerConfig = null;
inherit pruneOpts backupPrepareCommand;
};
};
# Dump service state, then push it to the external disk and the cloud, in
# that order. A "-" prefix means a failure of one restic target does not
# block the other; a failed dump (no prefix) aborts before either runs.
systemd.services.state-backup = {
description = "Dump service state and back it up (external + cloud)";
after = [ "podman.service" ];
serviceConfig = {
Type = "oneshot";
ExecStart = [
"${stateDumpScript}"
"-${pkgs.systemd}/bin/systemctl start --wait restic-backups-state-to-external.service"
"-${pkgs.systemd}/bin/systemctl start --wait restic-backups-state-to-cloud.service"
];
};
};
systemd.timers.state-backup = {
description = "Timer for service-state backups";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "*-*-* 0/12:00:00";
Persistent = true;
};
};
age.secrets = {
"restic-password".file = ../../../../secrets/manatee/restic-password.age;
"restic-cloud-sync-key".file = ../../../../secrets/manatee/restic-cloud-sync-key.age;
"restic-cloud-sync-repository".file = ../../../../secrets/manatee/restic-cloud-sync-repository.age;
};
};
}
+234
View File
@@ -0,0 +1,234 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.romm.enable;
nginxEnabled = config.mod.nginx.enable;
configFile = pkgs.writeText "romm-config.yml" ''
filesystem:
skip_hash_calculation: false
exclude:
roms:
single_file:
extensions:
- xml
- txt
- nfo
- dat
- jpg
- png
names:
- '._*'
- 'Thumbs.db'
- '.DS_Store'
'';
# Give up and enter a `failed` state (visible in `systemctl --failed`) if a
# container restarts more than 5 times in 5 minutes, instead of crash-looping
# forever. The window is deliberately long: a slow crash-loop (~5s per attempt)
# stays under systemd's default 5-starts-per-10s limit and would otherwise
# retry indefinitely.
crashLoopGuard = {
startLimitIntervalSec = 300;
startLimitBurst = 5;
};
in
{
options = {
mod.romm = {
enable = lib.mkEnableOption "Enable romm module";
};
};
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "RomM";
port = 8085;
description = "ROM library manager";
}
];
systemd.tmpfiles.rules = [
"d /var/lib/romm 0755 root root -"
# Owned by the container's mysql user (999). tmpfiles re-applies owner
# and mode on every switch; as root:root it left a running MariaDB unable
# to delete tc.log on shutdown, so the next start failed "crash recovery"
# with "Bad magic header in tc log".
"d /var/lib/romm/db 0755 999 999 -"
"d /var/lib/romm/redis 0755 999 1000 -"
"d /var/lib/romm/resources 0755 root root -"
"d /var/lib/romm/assets 0755 root root -"
];
systemd.services.podman-romm = crashLoopGuard;
systemd.services.podman-romm-db = crashLoopGuard;
systemd.services.podman-romm-redis = crashLoopGuard;
systemd.services.romm-net = {
description = "Create Podman network for RomM";
after = [ "podman.service" ];
requires = [ "podman.service" ];
before = [
"podman-romm.service"
"podman-romm-db.service"
"podman-romm-redis.service"
];
requiredBy = [
"podman-romm.service"
"podman-romm-db.service"
"podman-romm-redis.service"
];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = pkgs.writeShellScript "romm-net-create" ''
${pkgs.podman}/bin/podman network exists romm-net \
|| ${pkgs.podman}/bin/podman network create romm-net
'';
ExecStop = "${pkgs.podman}/bin/podman network rm -f romm-net";
};
};
virtualisation.oci-containers = {
backend = "podman";
containers.romm-db = {
image = "mariadb:latest";
environment = {
MARIADB_DATABASE = "romm";
MARIADB_USER = "romm";
};
environmentFiles = [
config.age.secrets.romm-db-password.path
];
volumes = [
"/var/lib/romm/db:/var/lib/mysql"
];
extraOptions = [
"--network=romm-net"
];
};
containers.romm-redis = {
image = "redis:alpine";
volumes = [
"/var/lib/romm/redis:/data"
];
extraOptions = [
"--network=romm-net"
"--user=root"
];
};
containers.romm = {
image = "rommapp/romm:latest";
dependsOn = [
"romm-db"
"romm-redis"
];
environment = {
DB_HOST = "romm-db";
DB_PORT = "3306";
DB_NAME = "romm";
DB_USER = "romm";
REDIS_HOST = "romm-redis";
REDIS_PORT = "6379";
ROMM_AUTH_ENABLED = "true";
};
environmentFiles = [
config.age.secrets.romm-auth-secret-key.path
config.age.secrets.romm-db-password.path
config.age.secrets.romm-metadata-api-keys.path
];
ports = [
"127.0.0.1:8086:8080"
];
volumes = [
"${configFile}:/romm/config/config.yml:ro"
"/mnt/media/public/games:/romm/library"
"/var/lib/romm/resources:/romm/resources"
"/var/lib/romm/assets:/romm/assets"
];
extraOptions = [
"--network=romm-net"
];
};
};
services.nginx = lib.mkIf nginxEnabled {
virtualHosts."romm-local" = {
listen = [
{
addr = "0.0.0.0";
port = 8085;
}
];
extraConfig = ''
client_max_body_size 0;
'';
locations."/" = {
proxyPass = "http://127.0.0.1:8086";
proxyWebsockets = true;
};
};
virtualHosts."romm.ppp.pm" = {
forceSSL = true;
useACMEHost = "romm.ppp.pm";
extraConfig = ''
client_max_body_size 0;
'';
locations."/" = {
proxyPass = "http://127.0.0.1:8086";
proxyWebsockets = true;
};
};
};
boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
networking.firewall.allowedTCPPorts = [ 8085 ];
age.secrets = {
"romm-auth-secret-key" = {
file = ../../../../secrets/manatee/romm-auth-secret-key.age;
owner = "root";
group = "root";
};
"romm-db-password" = {
file = ../../../../secrets/manatee/romm-db-password.age;
owner = "root";
group = "root";
};
"romm-metadata-api-keys" = {
file = ../../../../secrets/manatee/romm-metadata-api-keys.age;
owner = "root";
group = "root";
};
};
};
}
+57
View File
@@ -0,0 +1,57 @@
{
inputs,
lib,
config,
...
}:
let
enabled = config.mod.schema.enable;
nginxEnabled = config.mod.nginx.enable;
port = 8092;
in
{
options = {
mod.schema = {
enable = lib.mkEnableOption "Enable schema module";
};
};
imports = [
inputs.schema.nixosModules.default
];
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Schema";
port = port;
description = "Our week: chores, meals, dog";
# Login needs HTTPS (Secure cookies), so link to the public vhost.
url = "https://schema.ppp.pm";
}
];
services.schema = {
enable = true;
address = "127.0.0.1";
inherit port;
# Served publicly over HTTPS via the nginx vhost below.
secureCookies = true;
inviteCodeFile = config.age.secrets."schema-invite-code".path;
timeZone = "Europe/Stockholm";
};
services.nginx = lib.mkIf nginxEnabled {
virtualHosts."schema.ppp.pm" = {
forceSSL = true;
useACMEHost = "schema.ppp.pm";
locations."/" = {
proxyPass = "http://127.0.0.1:${toString port}";
};
};
};
age.secrets."schema-invite-code".file = ../../../../secrets/manatee/schema-invite-code.age;
};
}
+140
View File
@@ -0,0 +1,140 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.ssh.enable;
authorizedKeysPath = "/home/alex/.ssh/authorized-keys";
rootSSHKeyPath = "/etc/ssh";
in
{
options = {
mod.ssh = {
enable = lib.mkEnableOption "enable ssh module";
};
};
config = lib.mkIf enabled {
home-manager.users.alex = {
programs.ssh = {
enable = true;
enableDefaultConfig = false;
settings = {
"git.ppp.pm" = {
hostname = "git.ppp.pm";
identityFile = "/home/alex/.ssh/alex.manatee-git.ppp.pm";
};
"tadpole" = {
hostname = "65.21.106.222";
user = "alex";
identityFile = "/home/alex/.ssh/alex.manatee-tadpole";
port = 1122;
};
"*" = {
forwardAgent = false;
addKeysToAgent = "no";
compression = false;
serverAliveInterval = 0;
serverAliveCountMax = 3;
hashKnownHosts = false;
userKnownHostsFile = "~/.ssh/known_hosts";
controlMaster = "no";
controlPath = "~/.ssh/master-%r@%n:%p";
controlPersist = "no";
};
};
};
};
environment.etc."ssh/authorized_keys_command" = {
mode = "0755";
text = ''
#!${pkgs.bash}/bin/bash
for file in ${authorizedKeysPath}/*; do
${pkgs.coreutils}/bin/cat "$file"
done
'';
};
services = {
openssh = {
enable = true;
ports = [ 1122 ];
hostKeys = [
{
path = "${rootSSHKeyPath}/root.manatee";
type = "ed25519";
}
];
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
};
authorizedKeysCommand = "/etc/ssh/authorized_keys_command";
authorizedKeysCommandUser = "root";
};
};
networking = {
firewall = {
allowedTCPPorts = [ 1122 ];
};
};
age.secrets = {
"root.manatee" = {
file = ../../../../secrets/manatee/root.manatee.age;
path = "${rootSSHKeyPath}/root.manatee";
};
"root.manatee.pub" = {
file = ../../../../secrets/manatee/root.manatee.pub.age;
path = "${rootSSHKeyPath}/root.manatee.pub";
};
"alex.pinwheel-manatee.pub" = {
file = ../../../../secrets/pinwheel/alex.pinwheel-manatee.pub.age;
path = "${authorizedKeysPath}/alex.pinwheel-manatee.pub";
};
"alex.backwards-manatee.pub" = {
file = ../../../../secrets/backwards/alex.backwards-manatee.pub.age;
path = "${authorizedKeysPath}/alex.backwards-manatee.pub";
};
"alex.manatee-git.ppp.pm" = {
file = ../../../../secrets/manatee/alex.manatee-git.ppp.pm.age;
path = "/home/alex/.ssh/alex.manatee-git.ppp.pm";
owner = "alex";
group = "users";
};
"alex.manatee-git.ppp.pm.pub" = {
file = ../../../../secrets/manatee/alex.manatee-git.ppp.pm.pub.age;
path = "/home/alex/.ssh/alex.manatee-git.ppp.pm.pub";
owner = "alex";
group = "users";
};
"alex.manatee-tadpole" = {
file = ../../../../secrets/manatee/alex.manatee-tadpole.age;
path = "/home/alex/.ssh/alex.manatee-tadpole";
owner = "alex";
group = "users";
};
"alex.manatee-tadpole.pub" = {
file = ../../../../secrets/manatee/alex.manatee-tadpole.pub.age;
path = "/home/alex/.ssh/alex.manatee-tadpole.pub";
owner = "alex";
group = "users";
};
};
};
}
+104
View File
@@ -0,0 +1,104 @@
{ lib, config, ... }:
let
enabled = config.mod.syncthing.enable;
in
{
options = {
mod.syncthing = {
enable = lib.mkEnableOption "Enable syncthing module";
};
};
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Syncthing";
port = 8384;
description = "File sync";
}
];
services.syncthing = {
enable = true;
cert = config.age.secrets.syncthing-cert.path;
key = config.age.secrets.syncthing-key.path;
user = "storage";
group = "storage";
dataDir = "/mnt/sync/public";
guiAddress = "0.0.0.0:8384";
settings = {
gui = {
user = "syncthing";
password = "$2a$12$YBcqhl8AXpoLmIWikuMtkOQLcrPXKKj0xY/qy4hggWnfjeVLQ3Ct6";
insecureSkipHostcheck = false;
};
devices = {
phone.id = config.lib.syncthing.phone;
pinwheel.id = config.lib.syncthing.pinwheel;
};
folders = {
org = {
path = "/mnt/sync/public/org";
devices = [
"phone"
"pinwheel"
];
versioning = {
type = "staggered";
params = {
maxage = "2592000"; # 30 days
};
};
};
personal = {
path = "/mnt/sync/public/personal";
devices = [ "pinwheel" ];
versioning = {
type = "staggered";
params = {
maxage = "2592000"; # 30 days
};
};
};
work = {
path = "/mnt/sync/public/work";
devices = [ "pinwheel" ];
versioning = {
type = "staggered";
params = {
maxage = "2592000"; # 30 days
};
};
};
"phone-gps" = {
path = "/mnt/sync/public/phone-gps";
devices = [ "phone" ];
versioning = {
type = "staggered";
params = {
maxage = "2592000"; # 30 days
};
};
};
};
};
};
age = {
secrets = {
"syncthing-cert".file = ../../../../secrets/manatee/syncthing-cert.age;
"syncthing-key".file = ../../../../secrets/manatee/syncthing-key.age;
};
};
};
}
@@ -0,0 +1,11 @@
{ ... }:
{
# If an exit node is used, set:
# tailscale set --exit-node-allow-lan-access
services.tailscale.enable = true;
networking.firewall = {
checkReversePath = "loose";
allowedUDPPorts = [ 41641 ];
};
}
+69
View File
@@ -0,0 +1,69 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.tmux.enable;
in
{
options = {
mod.tmux = {
enable = lib.mkEnableOption "enable tmux module";
};
};
config = lib.mkIf enabled {
home-manager.users.alex = {
programs.tmux = {
enable = true;
baseIndex = 1;
keyMode = "vi";
# Allow vi mode to be enabled instantly
escapeTime = 0;
plugins = [ pkgs.tmuxPlugins.sensible ];
extraConfig = ''
set -g renumber-windows on
# https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/
set -g default-terminal "xterm-256color"
set -ga terminal-overrides ",*256col*:Tc"
set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[ q'
set-environment -g COLORTERM "truecolor"
set-option -g allow-rename off
# Remove date/time etc. on the right side
set -g status-right ""
# Remove accidental `suspend-client` triggers
unbind C-z
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Move panes shortcuts
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Move windows
bind -r Left swap-window -t -1 \; select-window -t -1
bind -r Right swap-window -t +1 \; select-window -t +1
'';
};
};
};
}
+58
View File
@@ -0,0 +1,58 @@
{
inputs,
lib,
config,
...
}:
let
enabled = config.mod.todo.enable;
nginxEnabled = config.mod.nginx.enable;
port = 8091;
in
{
options = {
mod.todo = {
enable = lib.mkEnableOption "Enable todo module";
};
};
imports = [
inputs.todo.nixosModules.default
];
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Todo";
port = port;
description = "Offline-first todo";
# Login needs HTTPS (Secure cookies), so link to the public vhost.
url = "https://todo.ppp.pm";
}
];
services.todo = {
enable = true;
address = "127.0.0.1";
inherit port;
# Served publicly over HTTPS via the nginx vhost below.
secureCookies = true;
tokenFile = config.age.secrets."todo-token".path;
# sessionSecretFile is left unset: the app generates one in its state dir
# (/var/lib/todo) on first boot, mode 0600.
};
services.nginx = lib.mkIf nginxEnabled {
virtualHosts."todo.ppp.pm" = {
forceSSL = true;
useACMEHost = "todo.ppp.pm";
locations."/" = {
proxyPass = "http://127.0.0.1:${toString port}";
};
};
};
age.secrets."todo-token".file = ../../../../secrets/manatee/todo-token.age;
};
}
@@ -0,0 +1,63 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.transmission.enable;
in
{
options = {
mod.transmission = {
enable = lib.mkEnableOption "enable transmission module";
};
};
config = lib.mkIf enabled {
mod.homepage.services = [
{
name = "Transmission";
port = 9091;
description = "Torrent client";
}
];
services = {
transmission = {
enable = true;
package = pkgs.transmission_4;
openFirewall = true;
user = "storage";
group = "storage";
home = "/mnt/media/public/.ts-home";
downloadDirPermissions = "775";
settings = {
incomplete-dir-enabled = false;
download-dir = "/mnt/media/public/downloads";
rpc-bind-address = "0.0.0.0";
# Required to have empty user/pass to satisfy transmissionA
# https://github.com/transmission/transmission/discussions/1941#discussioncomment-1472352
rpc-whitelist-enabled = false;
rpc-authentication-required = true;
rpc-username = "";
rpc-password = "";
};
};
};
# Both paths are bind mounted into the service's own mount namespace when it
# starts, so starting before the ZFS dataset is mounted writes to the root disk
systemd.services.transmission.unitConfig.RequiresMountsFor = [
config.services.transmission.home
config.services.transmission.settings.download-dir
];
};
}
+14 -6
View File
@@ -1,7 +1,6 @@
{ pkgs, ... }:
{ pkgs, lib, ... }:
{
imports =
[
imports = [
../../config-manager/default.nix
../../nix-wrapper/default.nix
../../shared-modules/syncthing.nix
@@ -9,17 +8,26 @@
./modules
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
hardware.trackpoint.device = "TPPS/2 Synaptics TrackPoint";
services.thermald.enable = lib.mkDefault true;
users.users.alex = {
isNormalUser = true;
description = "alex";
extraGroups = [ "wheel" ];
extraGroups = [
"wheel"
"networkmanager"
];
};
environment.systemPackages = with pkgs; [
gnome.adwaita-icon-theme # needed for things that expect icons to exist; like blueman-manager
adwaita-icon-theme # needed for things that expect icons to exist; like blueman-manager
coreutils
gnumake
bash
+7 -13
View File
@@ -1,7 +1,7 @@
# 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, modulesPath, ... }:
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
@@ -10,31 +10,25 @@
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/9c3ef2ad-0244-4310-9984-2e548ced3e22";
{ device = "/dev/mapper/luks-b05ba0f3-51f9-48d1-8d14-fcbff7c13c5b";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-f569d036-e500-4839-bc78-ce4b032840d8".device = "/dev/disk/by-uuid/f569d036-e500-4839-bc78-ce4b032840d8";
boot.initrd.luks.devices."luks-b05ba0f3-51f9-48d1-8d14-fcbff7c13c5b".device = "/dev/disk/by-uuid/b05ba0f3-51f9-48d1-8d14-fcbff7c13c5b";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/FCAE-6849";
{ device = "/dev/disk/by-uuid/D449-C034";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.npu.enable = true;
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
+13 -9
View File
@@ -14,21 +14,25 @@
home.homeDirectory = "/home/alex";
home.packages = [
inputs.whib-backend.packages.${pkgs.stdenv.hostPlatform.system}.whib-import
# pkgs.beekeeper-studio
pkgs.gimp
pkgs.zip
pkgs.brogue-ce
pkgs.jq
pkgs.bitwarden
pkgs.dbeaver
pkgs.htop
pkgs.onlyoffice-bin
pkgs.wdisplays
pkgs.ungoogled-chromium
pkgs.unzip
pkgs.unar
pkgs.python3
pkgs.jq
pkgs.dbeaver-bin
pkgs.htop
pkgs.onlyoffice-desktopeditors
pkgs.wdisplays
pkgs.vlc
pkgs.opencode
];
home.stateVersion = "23.05";
};
};
environment.sessionVariables.NIXOS_OZONE_WL = "1";
};
}
+2 -2
View File
@@ -6,12 +6,12 @@
age = {
identityPaths = [
"/etc/ssh/pinwheel"
"/home/alex/.ssh/alex.pinwheel"
"/home/alex/.ssh/alex"
];
};
environment.systemPackages = [
inputs.agenix.packages."${pkgs.system}".default
inputs.agenix.packages."${pkgs.stdenv.hostPlatform.system}".default
];
};
}
+107
View File
@@ -0,0 +1,107 @@
{
inputs,
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.ai.enable;
# Shared statusline: show the logged-in account email.
statusLine = {
type = "command";
command = "jq -r '.oauthAccount.emailAddress' \"$CLAUDE_CONFIG_DIR/.claude.json\"";
};
# PostToolUse hook: echoes a JSON payload that injects a comment-policy
# reminder as additional context after every Write/Edit.
commentPolicyPayload = builtins.toJSON {
suppressOutput = true;
hookSpecificOutput = {
hookEventName = "PostToolUse";
additionalContext = "Comment policy: default to ZERO code comments. Review what you just wrote and delete any comment that narrates the change, restates the code, states the obvious, is tangential, or explains design/why rationale -- put that reasoning in your chat reply instead, never in the code. Never use em dashes or en dashes anywhere in file content; use a plain ASCII hyphen or reword.";
};
};
settings = builtins.toJSON {
inherit statusLine;
theme = "dark";
editorMode = "vim";
cleanupPeriodDays = 3650;
attribution = {
commit = "";
pr = "";
};
hooks = {
SessionStart = [
{
hooks = [
{
type = "command";
command = "tmux-panes claude-session";
}
];
}
];
PostToolUse = [
{
matcher = "Write|Edit";
hooks = [
{
type = "command";
command = "echo ${lib.escapeShellArg commentPolicyPayload}";
}
];
}
];
};
};
settingsFile = pkgs.writeText "claude-settings.json" settings;
in
{
options = {
mod.ai = {
enable = lib.mkEnableOption "enable ai module";
};
};
config = lib.mkMerge [
{ home-manager.sharedModules = [ inputs.ct.homeManagerModules.default ]; }
(lib.mkIf enabled {
home-manager.users.alex = {
home.packages = [ pkgs.claude-code ];
programs.zsh.shellAliases = {
claude = "pclaude";
wclaude = "CLAUDE_CONFIG_DIR=$HOME/.claude-work command claude";
pclaude = "CLAUDE_CONFIG_DIR=$HOME/.claude-personal command claude";
};
home.activation.claudeSettings = {
after = [ "linkGeneration" ];
before = [ ];
data = ''
for f in "$HOME"/.claude-{work,personal}/settings.json; do
current="$(cat "$f" 2>/dev/null || echo '{}')"
run mkdir -p "$(dirname "$f")"
run rm -f "$f"
echo "$current" | ${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${settingsFile} - | run tee "$f" > /dev/null
done
'';
};
programs.ct = {
enable = true;
web.enable = true;
settings.profiles = {
work.configDir = "/home/alex/.claude-work";
personal.configDir = "/home/alex/.claude-personal";
};
};
};
})
];
}
+37
View File
@@ -0,0 +1,37 @@
{ lib, config, ... }:
let
enabled = config.mod.atuin.enable;
in
{
options = {
mod.atuin = {
enable = lib.mkEnableOption "enable atuin module";
};
};
config = lib.mkIf enabled {
home-manager.users.alex = {
programs.atuin = {
enable = true;
enableZshIntegration = true;
flags = [ "--disable-up-arrow" ];
settings = {
sync_address = "http://manatee:8889";
auto_sync = true;
sync_frequency = "5m";
key_path = config.age.secrets."atuin-key".path;
ctrl_n_shortcuts = false;
};
};
programs.fzf.historyWidget.command = "";
};
age.secrets."atuin-key" = {
file = ../../../../secrets/pinwheel/atuin-key.age;
owner = "alex";
group = "users";
};
};
}
+14 -2
View File
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
hyprlandEnabled = config.mod.hyprland.enable;
@@ -23,7 +28,14 @@ in
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = {
bind = [ "$mod, SPACE, exec, ${bmr}" ];
bind = [
{
_args = [
"SUPER + SPACE"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${bmr}")'')
];
}
];
};
};
};
+16 -9
View File
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.bluetooth.enable;
in
@@ -25,12 +30,6 @@ in
# Low battery notification for bluetooth devices
systemd.user =
let
trackpad = {
id = "battery_hid_a8o91o3doe5ofeo38_battery";
name = "trackpad";
threshold = "20";
};
headphones = {
id = "headset_dev_38_18_4C_18_A4_6E";
name = "headphones";
@@ -58,7 +57,11 @@ in
};
};
in
builtins.listToAttrs (builtins.map mkTimer [ trackpad headphones ]);
builtins.listToAttrs (
builtins.map mkTimer [
headphones
]
);
services =
let
@@ -107,7 +110,11 @@ in
};
};
in
builtins.listToAttrs (builtins.map mkService [ trackpad headphones ]);
builtins.listToAttrs (
builtins.map mkService [
headphones
]
);
};
};
}
+38 -5
View File
@@ -1,8 +1,40 @@
{ pkgs, ... }:
{
inputs,
pkgs,
lib,
config,
...
}:
let
configurationLimit = config.mod.gc.configurationLimit;
in
{
imports = [ inputs.nix-gc-env.nixosModules.default ];
options = {
mod.gc = {
configurationLimit = lib.mkOption {
type = lib.types.int;
default = 10;
description = "number of configuration generations to keep";
};
};
};
config = {
nix.gc = {
automatic = true;
dates = "weekly";
# `delete_generations` added by nix-gc-env
delete_generations = "+${builtins.toString configurationLimit}";
};
boot = {
kernelPackages = pkgs.linuxPackages_latest;
tmp.cleanOnBoot = true;
kernel = {
sysctl = {
"fs.inotify.max_user_instances" = 1024; # default: 128
@@ -10,12 +42,13 @@
};
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
systemd-boot = {
enable = true;
inherit configurationLimit;
};
initrd.secrets = {
"/crypto_keyfile.bin" = null;
efi.canTouchEfiVariables = true;
};
};
};
}
+22
View File
@@ -0,0 +1,22 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.c.enable;
in
{
options = {
mod.c = {
enable = lib.mkEnableOption "enable c module";
};
};
config = lib.mkIf enabled {
home-manager.users.alex = {
home.packages = [ pkgs.ccls ];
};
};
}
@@ -0,0 +1,8 @@
{ pkgs, ... }:
{
home-manager.users.alex = {
home.packages = [ pkgs.ungoogled-chromium ];
};
environment.sessionVariables.NIXOS_OZONE_WL = "1";
}
+37 -4
View File
@@ -1,12 +1,45 @@
let
bar = "2c2c2c";
in
{
lib = {
colors = {
foreground = "bd93f9";
foreground-dim = "644294";
background = "1E2029";
foreground = "ffb347";
foreground-dim = "8a5a20";
background = bar;
gray = "3a3a3a";
warning = "ff6969";
warning = "e0473c";
terminal = {
foreground = "e2e2e2";
background = "222222";
cursor = "b8843a";
selection = "4a3820";
status = bar;
regular = [
"181818" # black
"e0473c" # red
"7fb35a" # green
"b8904a" # yellow
"8a8a8a" # blue
"a05048" # magenta
"9e9e9e" # cyan
"e2e2e2" # white
];
bright = [
"5a5a5a" # black
"ff5f52" # red
"9fd078" # green
"d8b070" # yellow
"aaaaaa" # blue
"c06058" # magenta
"bebebe" # cyan
"fafafa" # white
];
};
};
};
}
+12 -3
View File
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
dockerEnabled = config.mod.containers.docker.enable;
podmanEnabled = config.mod.containers.podman.enable;
@@ -24,13 +29,17 @@ in
podman = lib.mkIf podmanEnabled {
enable = true;
defaultNetwork.settings.dns_enabled = true;
};
};
users.users.alex.extraGroups = lib.mkIf dockerEnabled [ "docker" ];
home-manager.users.alex = lib.mkIf dockerEnabled {
home.packages = [ pkgs.docker-compose ];
home-manager.users.alex = {
home.packages = [
(lib.mkIf dockerEnabled pkgs.docker-compose)
(lib.mkIf podmanEnabled pkgs.podman-compose)
];
};
};
}
+15 -3
View File
@@ -8,31 +8,43 @@ in
config = {
mod = {
gc.configurationLimit = 10;
bluetooth.enable = true;
nix-index.enable = false;
greetd.enable = true;
hyprland.enable = true;
swaylock.enable = true;
hyprlock.enable = true;
physlock.enable = false;
power.enable = true;
lowbat.enable = true;
wezterm.enable = false;
foot.enable = true;
git.enable = true;
zsh.enable = true;
atuin.enable = true;
openvpn.enable = true;
c.enable = true;
go.enable = true;
rust.enable = true;
scala.enable = true;
python.enable = true;
gleam.enable = true;
keyboard.enable = true;
containers = {
docker.enable = true;
podman.enable = false;
podman.enable = true;
};
vm.enable = true;
scripts.enable = true;
pppdotpm-site.enable = false;
ai.enable = true;
};
};
}
+14
View File
@@ -0,0 +1,14 @@
{ lib, config, ... }:
let
zshEnabled = config.mod.zsh.enable;
in
{
home-manager.users.alex = {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.direnv.enableZshIntegration = lib.mkIf zshEnabled true;
};
}
-2
View File
@@ -7,8 +7,6 @@
settings = {
global = {
monitor = 1;
width = 300;
height = 300;
offset = "10x10";
origin = "top-right";
transparency = 10;
+194 -30
View File
@@ -58,7 +58,7 @@
#+END_SRC
*** This makes emacsclient startup faster in TUI-mode
#+BEGIN_SRC emacs-lisp
(setq-default xterm-query-timeout nil)
(setq-default xterm-query-timeout 0.1)
#+END_SRC
*** Disable startup messages
#+BEGIN_SRC emacs-lisp
@@ -86,8 +86,24 @@
* Setup
#+BEGIN_SRC emacs-lisp
#+END_SRC
** Use wl-clipboard for interprocess copy/paste
** Use wl-clipboard and OSC 52 for interprocess copy/paste
#+BEGIN_SRC emacs-lisp
(setq kill-do-not-save-duplicates t)
(defun alex/osc52-copy (text)
(unless (display-graphic-p)
(send-string-to-terminal
(concat "\e]52;c;"
(base64-encode-string (encode-coding-string text 'utf-8) t)
"\a"))))
(defun alex/clipboard-copy (text)
(alex/osc52-copy text)
(when (fboundp 'wl-copy)
(wl-copy text)))
(setq interprogram-cut-function 'alex/clipboard-copy)
(setq wl-copy-process nil)
(when (string-prefix-p "wayland" (getenv "WAYLAND_DISPLAY"))
(defun wl-copy (text)
@@ -103,7 +119,6 @@
nil ; should return nil if we're the current paste owner
(shell-command-to-string "wl-paste -n | tr -d \r")))
(setq interprogram-cut-function 'wl-copy)
(setq interprogram-paste-function 'wl-paste))
#+END_SRC
** Don't create backup files, don't create #autosave# files
@@ -144,7 +159,7 @@
** Theme
#+BEGIN_SRC emacs-lisp
(use-package doom-themes
:init (load-theme 'doom-dracula t))
:config (load-theme 'sodium t))
#+END_SRC
** Disable the menu bar
#+BEGIN_SRC emacs-lisp
@@ -317,6 +332,41 @@ https://github.com/justbur/emacs-which-key
(setq history-length 25)
(savehist-mode 1)
#+END_SRC
** Remember open buffers per tmux pane
Used by `tmux-panes` to reopen buffers when tmux-resurrect restores a pane
#+BEGIN_SRC emacs-lisp
(defun tmux-panes--state-file ()
(when-let* ((pane (getenv "TMUX_PANE")))
(expand-file-name (concat "tmux-panes/" (substring pane 1) "/emacs")
(or (getenv "XDG_STATE_HOME") "~/.local/state"))))
(defun tmux-panes-save-buffers ()
(when-let* ((file (tmux-panes--state-file)))
(make-directory (file-name-directory file) t)
(let ((buffers (delq nil (mapcar (lambda (buffer)
(when-let* ((name (buffer-file-name buffer)))
(cons name (with-current-buffer buffer (point)))))
(buffer-list)))))
(with-temp-file file
(prin1 buffers (current-buffer))))))
(defun tmux-panes-restore-buffers ()
(when-let* ((file (getenv "TMUX_PANES_RESTORE")))
(setenv "TMUX_PANES_RESTORE" nil)
(when (file-readable-p file)
(let ((buffers (with-temp-buffer
(insert-file-contents file)
(read (current-buffer)))))
(dolist (entry (reverse buffers))
(when (file-exists-p (car entry))
(find-file (car entry))
(goto-char (cdr entry)))))
(delete-file file)))
(tmux-panes-save-buffers))
(add-hook 'emacs-startup-hook #'tmux-panes-restore-buffers)
(run-with-idle-timer 30 t #'tmux-panes-save-buffers)
#+END_SRC
** Vertico
#+BEGIN_SRC emacs-lisp
(use-package vertico
@@ -334,8 +384,8 @@ https://github.com/justbur/emacs-which-key
#+BEGIN_SRC emacs-lisp
(use-package embark
:bind
(("C-S-a" . embark-act) ;; pick some comfortable binding
("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
(("C-A" . embark-act)
("C-h B" . embark-bindings))
:init
;; Optionally replace the key help with a completing-read interface
@@ -354,6 +404,15 @@ https://github.com/justbur/emacs-which-key
(embark-collect-mode . consult-preview-at-point-mode))
#+END_SRC
* Opening files
#+BEGIN_SRC emacs-lisp
;; PDFs visited in Org-mode are opened in firefox (and not in the default choice)
(add-hook 'org-mode-hook
'(lambda ()
(delete '("\\.pdf\\'" . default) org-file-apps)
(add-to-list 'org-file-apps '("\\.pdf\\'" . "ff-alex %s"))))
#+END_SRC
* Keybindings
Setup prefix for keybindings.
#+BEGIN_SRC emacs-lisp
@@ -401,6 +460,32 @@ Setup prefix for keybindings.
"t" '(:ignore t :which-key "text")
"ts" '(hydra-text-scale/body :which-key "scale text"))
#+END_SRC
** Copy file path with line number
#+BEGIN_SRC emacs-lisp
(defun alex/copy-path-with-line ()
"Copy /abs/path:LINE, or /abs/path:START-END when a region is active."
(interactive)
(unless buffer-file-name (user-error "Buffer is not visiting a file"))
(let* ((path (expand-file-name buffer-file-name))
(ref (if (use-region-p)
(let* ((beg (region-beginning))
(end (if (and (> (region-end) beg)
(save-excursion (goto-char (region-end)) (bolp)))
(1- (region-end))
(region-end)))
(start-line (line-number-at-pos beg))
(end-line (line-number-at-pos end)))
(if (= start-line end-line)
(format "%s:%d" path start-line)
(format "%s:%d-%d" path start-line end-line)))
(format "%s:%d" path (line-number-at-pos)))))
(kill-new ref)
(deactivate-mark)
(message "Copied %s" ref)))
(alex/keybindings
"y" '(alex/copy-path-with-line :which-key "copy path:line"))
#+END_SRC
* Browser
#+BEGIN_SRC emacs-lisp
@@ -452,12 +537,7 @@ Setup prefix for keybindings.
(setq org-startup-folded 'content)
(setq org-startup-indented t)
(setq org-agenda-files '("~/sync/org"))
#+END_SRC
** Org-habit
#+BEGIN_SRC emacs-lisp
(require 'org-habit)
(add-to-list 'org-modules 'org-habit)
(setq org-habit-graph-column 60))
(define-key org-mode-map (kbd "C-c C-b") #'org-insert-structure-template))
#+END_SRC
* Magit
#+BEGIN_SRC emacs-lisp
@@ -475,7 +555,39 @@ Setup prefix for keybindings.
* Flycheck
#+BEGIN_SRC emacs-lisp
(use-package flycheck)
(use-package flycheck
:preface
(defun mp-flycheck-eldoc (callback &rest _ignored)
"Print flycheck messages at point by calling CALLBACK."
(when-let ((flycheck-errors (and flycheck-mode (flycheck-overlay-errors-at (point)))))
(mapc
(lambda (err)
(funcall callback
(format "%s: %s"
(let ((level (flycheck-error-level err)))
(pcase level
('info (propertize "I" 'face 'flycheck-error-list-info))
('error (propertize "E" 'face 'flycheck-error-list-error))
('warning (propertize "W" 'face 'flycheck-error-list-warning))
(_ level)))
(flycheck-error-message err))
:thing (or (flycheck-error-id err)
(flycheck-error-group err))
:face 'font-lock-doc-face))
flycheck-errors)))
(defun mp-flycheck-prefer-eldoc ()
(add-hook 'eldoc-documentation-functions #'mp-flycheck-eldoc nil t)
(setq eldoc-documentation-strategy 'eldoc-documentation-compose-eagerly)
(setq flycheck-display-errors-function nil)
(setq flycheck-help-echo-function nil))
:hook ((flycheck-mode . mp-flycheck-prefer-eldoc)))
(use-package flycheck-eglot
:after (flycheck eglot)
:config
(global-flycheck-eglot-mode 1))
#+END_SRC
* LSP
** Eglot
@@ -489,19 +601,54 @@ Setup prefix for keybindings.
)
(defun alex/format-on-save ()
(add-hook 'before-save-hook #'eglot-format-buffer -10 t)
)
(let ((excluded-files '("secrets.nix")))
(unless (member (file-name-nondirectory buffer-file-name) excluded-files)
(add-hook 'before-save-hook #'eglot-format-buffer -10 t))))
(use-package eglot
:preface
(defun mp-eglot-eldoc ()
(setq eldoc-echo-area-use-multiline-p nil)
(setq eldoc-documentation-strategy
'eldoc-documentation-compose-eagerly))
:config
;; Ensure `nil` is in your PATH.
(add-to-list 'eglot-server-programs '(nix-mode . ("nil")))
(add-to-list 'eglot-server-programs
'(scala-mode .
("metals" :initializationOptions (:isHttpEnabled t))))
(add-to-list 'eglot-server-programs
'(nix-mode . ("nixd")))
(add-to-list 'eglot-server-programs
'(gleam-ts-mode . ("gleam" "lsp")))
(setq-default eglot-workspace-configuration
'(
:metals (
:inlayHints (:inferredTypes (:enable t))
)
)
)
:custom
(refactor-indications nil)
:hook (
(eglot-managed-mode . mp-eglot-eldoc)
(go-mode . eglot-ensure)
(go-mode . alex/organize-imports-on-save)
(go-mode . alex/format-on-save)
(c-mode . eglot-ensure)
(nix-mode . eglot-ensure)
(nix-mode . alex/format-on-save)
(gleam-ts-mode . eglot-ensure)
(gleam-ts-mode . alex/format-on-save)
(python-mode . eglot-ensure)
(javascript-mode . eglot-ensure)
(js-mode . eglot-ensure)
(js-jsx-mode . eglot-ensure)
@@ -516,13 +663,7 @@ Setup prefix for keybindings.
(scala-mode . alex/format-on-save)
)
)
#+END_SRC
** Eldoc-box
#+BEGIN_SRC emacs-lisp
(use-package eldoc-box
:after eglot
:bind (:map eglot-mode-map
("M-h" . eldoc-box-help-at-point)))
#+END_SRC
** Go
#+BEGIN_SRC emacs-lisp
@@ -541,6 +682,12 @@ Setup prefix for keybindings.
)
)
#+END_SRC
** Gleam
#+BEGIN_SRC emacs-lisp
(use-package gleam-ts-mode
:mode "\\.gleam\\'"
)
#+END_SRC
** YAML
#+BEGIN_SRC emacs-lisp
(use-package yaml-mode
@@ -550,6 +697,11 @@ Setup prefix for keybindings.
)
)
#+END_SRC
** Protobuf
#+BEGIN_SRC emacs-lisp
(use-package protobuf-mode
:mode "\\.proto$")
#+END_SRC
** Terraform
#+BEGIN_SRC emacs-lisp
(use-package terraform-mode)
@@ -563,11 +715,27 @@ Setup prefix for keybindings.
#+BEGIN_SRC emacs-lisp
(use-package markdown-mode)
#+END_SRC
** Dagbok
#+BEGIN_SRC emacs-lisp
(use-package dagbok
:commands (dagbok-today dagbok-year dagbok-next-day dagbok-previous-day
dagbok-switch-journal dagbok-note dagbok-tasks dagbok-questions dagbok-search
dagbok-add-task dagbok-ask dagbok-set-status dagbok-toggle-flag
dagbok-toggle-highlight dagbok-toggle-completed dagbok-backlinks
dagbok-set-property dagbok-toggle-toc dagbok-goto-heading
dagbok-refresh dagbok-browse)
:custom
(dagbok-url "https://dagbok.ppp.pm")
(dagbok-token-file "/run/agenix/dagbok-token")
:init
(alex/keybindings "d" '(:keymap dagbok-command-map :package dagbok :which-key "dagbok")))
#+END_SRC
** Javascript
#+BEGIN_SRC emacs-lisp
(setq
js-indent-level 2
js2-basic-offset 2)
js2-basic-offset 2
indent-tabs-mode nil)
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
#+END_SRC
@@ -575,11 +743,7 @@ Setup prefix for keybindings.
#+BEGIN_SRC emacs-lisp
(use-package flycheck-rust)
(use-package rust-mode
:hook (
(flycheck-mode . #'flycheck-rust-setup)
)
)
(use-package rust-mode)
#+END_SRC
** GLSL
#+BEGIN_SRC emacs-lisp
+14 -1
View File
@@ -7,14 +7,18 @@ let
alwaysEnsure = true;
alwaysTangle = true;
override = inputs.dagbok.overlays.emacs;
extraEmacsPackages = epkgs: [
epkgs.flymake-go-staticcheck
epkgs.tree-sitter-langs
epkgs.treesit-grammars.with-all-grammars
];
};
e = pkgs.writeShellScriptBin "e" ''
${emacs}/bin/emacs -nw $@
exec ${emacs}/bin/emacs -nw "$@"
'';
ec = pkgs.writeShellScriptBin "ec" ''
@@ -31,13 +35,22 @@ in
TIG_EDITOR = "${e}/bin/e $@";
};
home.file.".emacs.d/sodium-theme.el".source = ./sodium-theme.el;
home.packages = [
e
ec
emacs
pkgs.wl-clipboard
pkgs.nixd
];
};
environment.systemPackages = [ pkgs.ripgrep ];
age.secrets."dagbok-token" = {
file = ../../../../secrets/manatee/dagbok-token.age;
owner = "alex";
group = "users";
};
}
@@ -0,0 +1,79 @@
;;; sodium-theme.el --- Grayscale with amber accents, like sodium streetlights at night -*- lexical-binding: t; no-byte-compile: t; -*-
(require 'doom-themes)
(def-doom-theme sodium
"Grayscale with amber accents, like sodium streetlights at night."
((bg '("#222222" nil nil))
(bg-alt '("#181818" nil nil))
(base0 '("#121212" nil nil))
(base1 '("#181818" nil nil))
(base2 '("#242424" nil nil))
(base3 '("#2c2c2c" nil nil))
(base4 '("#404040" nil nil))
(base5 '("#626262" nil nil))
(base6 '("#858585" nil nil))
(base7 '("#a0a0a0" nil nil))
(base8 '("#f4f4f4" nil nil))
(fg '("#e2e2e2" nil nil))
(fg-alt '("#9a9a9a" nil nil))
(grey base5)
(red '("#e0473c" nil nil))
(orange '("#ffb347" nil nil))
(green '("#f4f4f4" nil nil))
(teal '("#aaaaaa" nil nil))
(yellow '("#ffb347" nil nil))
(blue '("#aaaaaa" nil nil))
(dark-blue '("#7a7a7a" nil nil))
(magenta '("#ffb347" nil nil))
(violet '("#9a9a9a" nil nil))
(cyan '("#bebebe" nil nil))
(dark-cyan '("#8a8a8a" nil nil))
(added '("#7fb35a" nil nil))
(highlight orange)
(vertical-bar base3)
(selection base3)
(builtin fg)
(comments base5)
(doc-comments base6)
(constants yellow)
(functions base8)
(keywords orange)
(methods base8)
(operators fg-alt)
(type fg)
(strings base7)
(variables fg)
(numbers yellow)
(region '("#4a3820" nil nil))
(error red)
(warning red)
(success green)
(vc-modified base6)
(vc-added added)
(vc-deleted red)
(modeline-fg fg)
(modeline-fg-alt base6)
(modeline-bg base2)
(modeline-bg-alt bg-alt)
(modeline-bg-inactive bg-alt)
(modeline-bg-inactive-l bg-alt))
(((custom-group-subtitle &override) :foreground orange)
((diff-added &override) :foreground added)
((diff-indicator-added &override) :foreground added)
((magit-diff-added &override) :foreground added)
((magit-diff-added-highlight &override) :foreground added)
((magit-diffstat-added &override) :foreground added)
((hl-todo &override) :foreground orange)
((magit-blame-date &override) :foreground orange)
((markdown-list-face &override) :foreground orange)
((markdown-metadata-key-face &override) :foreground orange)
((org-journal-calendar-scheduled-face &override) :foreground orange)
((org-priority &override) :foreground orange)
((paren-face-match &override) :foreground orange)
((widget-button-pressed &override) :foreground orange)))
;;; sodium-theme.el ends here
+62 -17
View File
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
let
wrapped = pkgs.wrapFirefox pkgs.firefox-devedition-unwrapped {
extraPolicies = {
@@ -29,14 +29,34 @@ let
ff = pkgs.writeShellApplication {
name = "ff";
text = ''
${wrapped}/bin/firefox --ProfileManager
${wrapped}/bin/firefox-devedition --ProfileManager
'';
};
ff-alex = pkgs.writeShellApplication {
name = "ff-alex";
text = ''
${wrapped}/bin/firefox -P alex --new-window "$@"
${wrapped}/bin/firefox-devedition -P alex --new-window "$@"
'';
};
ff-work = pkgs.writeShellApplication {
name = "ff-work";
text = ''
${wrapped}/bin/firefox-devedition -P work --new-window "$@"
'';
};
# Links opened from work checkouts (e.g. `gcloud auth login` in a work
# devshell, which ships its own `gcloud`, or `gt`) go to the work profile.
# Used both as `$BROWSER` and as the default handler for `xdg-open`.
browser = pkgs.writeShellApplication {
name = "browser";
text = ''
case "$PWD/" in
"$HOME/code/work/"*) exec ${ff-work}/bin/ff-work "$@" ;;
*) exec ${ff-alex}/bin/ff-alex "$@" ;;
esac
'';
};
@@ -44,6 +64,8 @@ let
"general.smoothScroll" = true;
"apz.gtk.kinetic_scroll.enabled" = false;
"network.dns.force_waiting_https_rr" = false;
"browser.smartwindow.enabled" = false;
"browser.smartwindow.isDefaultWindow" = false;
};
in
{
@@ -53,6 +75,12 @@ in
package = wrapped;
# Pin the legacy profile location. The default changed to the XDG path
# (`$XDG_CONFIG_HOME/mozilla/firefox`) for stateVersion >= "26.05";
# keep the old `~/.mozilla/firefox` so the existing profile isn't
# stranded (migrating would require moving the profile dir by hand).
configPath = ".mozilla/firefox";
profiles = {
alex = {
id = 0;
@@ -68,11 +96,16 @@ in
settings = sharedSettings // {
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"network.lna.skip-domains" = "music-admin-staging.soundtr.ac,api-internal.apps-us.platform.staging.internal.syb.sh";
};
userChrome = ''
.tab-content {
border-top: solid #9400FF !important;
#navigator-toolbox,
#nav-bar {
background-image: linear-gradient(
color-mix(in srgb, #${config.lib.colors.foreground} 5%, transparent),
color-mix(in srgb, #${config.lib.colors.foreground} 5%, transparent)
) !important;
}
'';
};
@@ -87,21 +120,27 @@ in
exec = "${ff-alex}/bin/ff-alex %U";
terminal = false;
};
browser = {
name = "browser";
exec = "${browser}/bin/browser %U";
terminal = false;
};
};
mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "ff-alex.desktop";
"x-scheme-handler/http" = "ff-alex.desktop";
"x-scheme-handler/https" = "ff-alex.desktop";
"application/x-exension-htm" = "ff-alex.desktop";
"application/x-exension-html" = "ff-alex.desktop";
"application/x-exension-shtml" = "ff-alex.desktop";
"application/xhtml+xml" = "ff-alex.desktop";
"application/x-exension-xhtml" = "ff-alex.desktop";
"application/x-exension-xht" = "ff-alex.desktop";
"text/html" = "browser.desktop";
"x-scheme-handler/http" = "browser.desktop";
"x-scheme-handler/https" = "browser.desktop";
"application/x-exension-htm" = "browser.desktop";
"application/x-exension-html" = "browser.desktop";
"application/x-exension-shtml" = "browser.desktop";
"application/xhtml+xml" = "browser.desktop";
"application/x-exension-xhtml" = "browser.desktop";
"application/x-exension-xht" = "browser.desktop";
};
};
@@ -109,9 +148,15 @@ in
configFile."mimeapps.list".force = true;
};
home.packages = [ ff ];
home.packages = [
ff
ff-alex
ff-work
];
};
environment.variables.BROWSER = "${ff-alex}/bin/ff-alex $@";
environment.variables = {
MOZ_ENABLE_WAYLAND = 1;
BROWSER = "${browser}/bin/browser";
};
}
+3 -3
View File
@@ -2,9 +2,9 @@
{
fonts.packages = [
pkgs.noto-fonts
pkgs.noto-fonts-cjk
pkgs.noto-fonts-emoji
pkgs.nerdfonts
pkgs.noto-fonts-cjk-sans
pkgs.noto-fonts-color-emoji
pkgs.nerd-fonts.jetbrains-mono
pkgs.liberation_ttf
];
}
+26 -4
View File
@@ -1,8 +1,16 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.foot.enable;
hyprlandEnabled = config.mod.hyprland.enable;
colors = config.lib.colors.terminal;
indexed = prefix: list: lib.listToAttrs (lib.imap0 (i: c: lib.nameValuePair "${prefix}${toString i}" c) list);
in
{
options = {
@@ -19,16 +27,30 @@ in
settings = {
main = {
term = "xterm-256color";
font = "JetBrainsMono Nerd Font:size=15";
include = "${pkgs.foot.themes}/share/foot/themes/dracula";
font = "JetBrainsMono Nerd Font:size=17";
};
colors-dark = {
foreground = colors.foreground;
background = colors.background;
cursor = "${colors.background} ${colors.cursor}";
selection-foreground = colors.foreground;
selection-background = colors.selection;
}
// indexed "regular" colors.regular
// indexed "bright" colors.bright;
};
};
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = {
bind = [
"$mod, RETURN, exec, ${pkgs.foot}/bin/foot"
{
_args = [
"SUPER + RETURN"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.foot}/bin/foot")'')
];
}
];
};
};
+1 -1
View File
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ ... }:
{
home-manager.users.alex = {
programs.fzf = {
+6
View File
@@ -0,0 +1,6 @@
{ pkgs, ... }:
{
home-manager.users.alex = {
home.packages = [ pkgs.brogue-ce ];
};
}
+108 -2
View File
@@ -1,6 +1,43 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.git.enable;
# Wrapper around `ssh-keygen` used as git's SSH signing program. Before a
# signing operation it ensures the passphrase-protected signing key is loaded
# into the agent — `ssh-keygen -Y sign` reads the key from disk and re-prompts
# every commit otherwise, since `AddKeysToAgent` only ever caches auth keys.
# Loading it once (through the GUI askpass) lets later commits reuse the
# cached key from the agent. Verification and every other op pass straight
# through to the real ssh-keygen untouched.
sshSignWrapper = pkgs.writeShellApplication {
name = "git-ssh-sign";
runtimeInputs = [
pkgs.openssh
pkgs.gawk
pkgs.gnugrep
];
text = ''
key="${config.age.secrets."alex.pinwheel-github.com-signing".path}"
case " $* " in
*" -Y sign "*)
fp=""
fp="$(ssh-keygen -lf "$key.pub" 2>/dev/null | awk '{print $2}')" || true
if [ -n "$fp" ] && ! ssh-add -l 2>/dev/null | grep -qF "$fp"; then
# </dev/null detaches stdin so ssh-add uses SSH_ASKPASS (the GUI).
ssh-add "$key" </dev/null || true
fi
;;
esac
exec ssh-keygen "$@"
'';
};
in
{
options = {
@@ -10,21 +47,90 @@ in
};
config = lib.mkIf enabled {
home-manager.users.alex = {
home-manager.users.alex = { lib, ... }: {
programs.git = {
enable = true;
includes = [
{ path = ./gitconfig; }
];
signing = {
key = config.age.secrets."alex.pinwheel-github.com-signing.pub".path;
signByDefault = true;
};
settings = {
rerere.enable = true;
# Tells Git to use SSH instead of the default GPG
gpg.format = "ssh";
# Sign via a wrapper that loads the signing key into the agent on
# first use, so subsequent signed commits reuse the cached key
# instead of re-prompting for the passphrase every time.
gpg.ssh.program = "${sshSignWrapper}/bin/git-ssh-sign";
};
};
home.file.".ssh/config".target = ".ssh/config_source";
home.activation.sshConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
run cat ~/.ssh/config_source > ~/.ssh/config
run chmod 600 ~/.ssh/config
'';
home.packages = [ pkgs.tig ];
home.file.".tigrc".text = ''
set main-view-line-number = yes
set main-view-line-number-interval = 1
color default default default
color cursor color0 yellow bold
color search-result color0 yellow
color title-focus white color8 bold
color title-blur color8 default
color status white default
color delimiter color8 default
color line-number color8 default
color id yellow default
color date color8 default
color author cyan default
color mode cyan default
color graph-commit yellow default
color main-commit default default
color main-head yellow default bold
color main-ref yellow default
color main-local-tag color11 default
color main-tag color11 default bold
color main-remote color8 default
color main-tracked yellow default bold
color main-replace cyan default
color diff-header color15 default bold
color diff-index color8 default
color diff-chunk cyan default
color diff-add green default
color diff-del red default
color diff-stat cyan default
'';
};
age.secrets = {
"alex.pinwheel-github.com-signing" = {
file = ../../../../secrets/pinwheel/alex.pinwheel-github.com-signing.age;
path = "/home/alex/.ssh/alex.pinwheel-github.com-signing";
owner = "alex";
group = "users";
};
"alex.pinwheel-github.com-signing.pub" = {
file = ../../../../secrets/pinwheel/alex.pinwheel-github.com-signing.pub.age;
path = "/home/alex/.ssh/alex.pinwheel-github.com-signing.pub";
owner = "alex";
group = "users";
};
};
};
}
+2 -6
View File
@@ -5,9 +5,5 @@
[url "git@github.com:"]
insteadOf = https://github.com/
[url "git@gitlab.com:"]
insteadOf = https://gitlab.com/
[url "git@codeberg.org:"]
insteadOf = https://codeberg.org/
[url "gitea@git.ppp.pm:"]
insteadOf = https://git.ppp.pm/
+25
View File
@@ -0,0 +1,25 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.gleam.enable;
in
{
options = {
mod.gleam = {
enable = lib.mkEnableOption "enable gleam module";
};
};
config = lib.mkIf enabled {
home-manager.users.alex = {
home.packages = [
pkgs.gleam
pkgs.beamPackages.erlang
];
};
};
}
+9 -16
View File
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.go.enable;
in
@@ -10,26 +15,14 @@ in
};
config = lib.mkIf enabled {
nixpkgs.overlays = let
buildGo122 = pkgs: pkg:
pkg.override { buildGoModule = pkgs.buildGo122Module; };
in
[
(final: prev: {
go = prev.go_1_22;
gopls = buildGo122 prev prev.gopls;
go-tools = buildGo122 prev prev.go-tools;
govulncheck = buildGo122 prev prev.govulncheck;
gotestsum = buildGo122 prev prev.gotestsum;
})
];
home-manager.users.alex = {
programs.go = {
enable = true;
package = pkgs.go;
goPath = "code/go";
env = {
GOPATH = "/home/alex/code/go";
};
};
home.packages = [
+9 -3
View File
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.greetd.enable;
in
@@ -13,10 +18,11 @@ in
services.greetd = {
enable = true;
settings = let
settings =
let
session = {
user = "alex";
command = "${pkgs.hyprland}/bin/Hyprland";
command = "uwsm start hyprland-uwsm.desktop";
};
in
{
+364 -155
View File
@@ -1,6 +1,79 @@
{ pkgs, lib, config, ... }:
{
inputs,
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.hyprland.enable;
mod = "SUPER";
monitorScript = pkgs.writeShellScript "hyprland-monitor-handler" ''
INTERNAL="eDP-1"
EXTERNAL_MONITORS="HDMI-A-1 DP-3"
HYPRCTL="${pkgs.hyprland}/bin/hyprctl"
JQ="${pkgs.jq}/bin/jq"
get_active_external() {
# Return the first connected external monitor
for mon in $EXTERNAL_MONITORS; do
if $HYPRCTL monitors -j | $JQ -e ".[] | select(.name == \"$mon\")" > /dev/null 2>&1; then
echo "$mon"
return 0
fi
done
return 1
}
bind_workspaces() {
local external batch=""
if external=$(get_active_external); then
# External monitor connected: move workspaces 1-5 to external, 6-10 to internal
for ws in 1 2 3 4 5; do
batch="$batch dispatch hl.dsp.workspace.move({ monitor = \"$external\", workspace = $ws });"
done
for ws in 6 7 8 9 10; do
batch="$batch dispatch hl.dsp.workspace.move({ monitor = \"$INTERNAL\", workspace = $ws });"
done
else
# No external monitor: move all workspaces to internal
for ws in 1 2 3 4 5 6 7 8 9 10; do
batch="$batch dispatch hl.dsp.workspace.move({ monitor = \"$INTERNAL\", workspace = $ws });"
done
fi
$HYPRCTL --batch "$batch"
}
handle_event() {
case $1 in
monitoradded*|monitorremoved*)
sleep 0.5
bind_workspaces
;;
esac
}
# Start the event listener first so monitoradded events emitted during
# session startup are not lost in the gap before we begin reading them.
${pkgs.socat}/bin/socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do
handle_event "$line"
done &
LISTENER_PID=$!
# Give socat a moment to actually connect before the initial bind.
sleep 0.2
bind_workspaces
# Re-bind once more after the DRM subsystem has had time to enumerate
# external connectors, in case they were not yet present at session start.
(sleep 3; bind_workspaces) &
wait $LISTENER_PID
'';
in
{
options = {
@@ -10,44 +83,27 @@ in
};
config = lib.mkIf enabled {
programs.hyprland = {
enable = true;
withUWSM = true;
package = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland;
portalPackage =
inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland;
xwayland = {
enable = true;
};
};
home-manager.users.alex = {
wayland.windowManager.hyprland = {
enable = true;
xwayland = {
enable = true;
};
extraConfig = ''
exec-once=waybar
env = GDK_DPI_SCALE,1.5
env = XCURSOR_SIZE,64
monitor=eDP-1, 1920x1200, 0x0, 1
workspace = 1, monitor:HDMI-A-1
workspace = 2, monitor:HDMI-A-1
workspace = 3, monitor:HDMI-A-1
workspace = 4, monitor:HDMI-A-1
workspace = 5, monitor:HDMI-A-1
workspace = 6, monitor:eDP-1
workspace = 7, monitor:eDP-1
workspace = 8, monitor:eDP-1
workspace = 9, monitor:eDP-1
workspace = 10, monitor:eDP-1
exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
'';
systemd.enable = false;
configType = "lua";
settings = {
"$mod" = "SUPER";
animations.enabled = false;
xwayland = {
force_zero_scaling = true;
};
config = {
xwayland.force_zero_scaling = true;
input = {
kb_layout = "se";
@@ -55,41 +111,199 @@ in
# 2 - Cursor focus will be detached from keyboard focus. Clicking on a window will move keyboard focus to that window.
follow_mouse = 2;
sensitivity = 0.30;
sensitivity = 0.3;
accel_profile = "flat";
touchpad = {
natural_scroll = false;
tap-and-drag = false;
tap_and_drag = false;
};
};
cursor = {
zoom_factor = 1;
zoom_rigid = true;
};
general = {
layout = "dwindle";
gaps_in = 0; # gaps between windows
gaps_out = 0; # gaps between windows and monitor edges
"col.active_border" = "rgba(${config.lib.colors.foreground}ff)";
"col.inactive_border" = "rgba(${config.lib.colors.background}ff)";
col = {
active_border = "rgba(${config.lib.colors.foreground}ff)";
inactive_border = "rgba(${config.lib.colors.background}ff)";
};
};
dwindle = {
force_split = 2;
no_gaps_when_only = 1;
dwindle.force_split = 2;
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
};
bind = let
ws = x:
let n = if (x + 1) < 10
then (x + 1)
else 0;
animations.enabled = false;
};
monitor = [
{
output = "eDP-1";
mode = "1920x1200";
position = "auto-center-down";
scale = "1";
}
{
output = "HDMI-A-1";
mode = "2560x1440@100";
position = "auto-center-up";
scale = "1";
}
{
output = "DP-3";
mode = "2560x1440@60";
position = "auto-center-up";
scale = "1";
}
];
# Static defaults only: a workspace can only have one `monitor` in
# hl.workspace_rule (later calls overwrite it, unlike hyprlang's
# rule list). The hyprland-monitors service re-dispatches these to
# whichever external monitor is actually connected at startup and
# on hotplug, so this only matters for the brief window before it
# runs.
workspace_rule = [
{
workspace = "1";
monitor = "HDMI-A-1";
default = true;
}
{
workspace = "2";
monitor = "HDMI-A-1";
}
{
workspace = "3";
monitor = "HDMI-A-1";
}
{
workspace = "4";
monitor = "HDMI-A-1";
}
{
workspace = "5";
monitor = "HDMI-A-1";
}
{
workspace = "6";
monitor = "eDP-1";
default = true;
}
{
workspace = "7";
monitor = "eDP-1";
}
{
workspace = "8";
monitor = "eDP-1";
}
{
workspace = "9";
monitor = "eDP-1";
}
{
workspace = "10";
monitor = "eDP-1";
}
{
workspace = "w[tv1]";
gaps_out = 0;
gaps_in = 0;
}
{
workspace = "f[1]";
gaps_out = 0;
gaps_in = 0;
}
];
window_rule = [
{
name = "no-gaps-wtv1";
match = {
float = false;
workspace = "w[tv1]";
};
border_size = 0;
rounding = 0;
}
{
name = "no-gaps-f1";
match = {
float = false;
workspace = "f[1]";
};
border_size = 0;
rounding = 0;
}
{
# https://wiki.archlinux.org/title/Hyprland#Jetbrains_apps_focus_issues
name = "xwayland-no-initial-focus";
match.xwayland = true;
no_initial_focus = true;
}
];
env = [
{ _args = [ "GDK_DPI_SCALE" "1.5" ]; }
{ _args = [ "HYPRCURSOR_THEME" "Adwaita" ]; }
{ _args = [ "HYPRCURSOR_SIZE" "24" ]; }
];
on = {
_args = [
"hyprland.start"
(lib.generators.mkLuaInline ''
function()
hl.exec_cmd("uwsm app -- waybar")
hl.exec_cmd("uwsm app -- hyprctl setcursor Adwaita 24")
end
'')
];
};
bind =
let
ws =
x:
let
n = if (x + 1) < 10 then (x + 1) else 0;
in
builtins.toString n;
select = builtins.genList (x: "$mod, ${ws x}, workspace, ${builtins.toString (x + 1)}") 10;
move = builtins.genList (x: "$mod SHIFT, ${ws x}, movetoworkspacesilent, ${builtins.toString (x + 1)}") 10;
focusWs = x: {
_args = [
"${mod} + ${ws x}"
(lib.generators.mkLuaInline "hl.dsp.focus({ workspace = ${builtins.toString (x + 1)} })")
];
};
moveToWs = x: {
_args = [
"${mod} + SHIFT + ${ws x}"
(lib.generators.mkLuaInline
"hl.dsp.window.move({ workspace = ${builtins.toString (x + 1)}, follow = false })"
)
];
};
select = builtins.genList focusWs 10;
move = builtins.genList moveToWs 10;
magnifier = pkgs.writeShellScript "magnifier" ''
CURRENT=$(${pkgs.hyprland}/bin/hyprctl getoption misc:cursor_zoom_factor -j | jq .float)
CURRENT=$(${pkgs.hyprland}/bin/hyprctl getoption cursor:zoom_factor -j | ${pkgs.jq}/bin/jq .float)
DELTA=0.1
UPDATED=1
@@ -103,37 +317,93 @@ in
esac
if (( $(echo "$UPDATED < 1" | bc) )); then UPDATED=1; fi
${pkgs.hyprland}/bin/hyprctl keyword misc:cursor_zoom_factor $UPDATED
${pkgs.hyprland}/bin/hyprctl keyword cursor:zoom_factor $UPDATED
'';
in
select ++ move ++ [
"$mod, ESCAPE, killactive"
"$mod, f, fullscreen, 1"
"$mod SHIFT, f, togglefloating, active"
"$mod, h, movefocus, l"
"$mod, j, movefocus, d"
"$mod, k, movefocus, u"
"$mod, l, movefocus, r"
"$mod SHIFT_CONTROL, 1, exec, ${magnifier} --increase"
"$mod SHIFT_CONTROL, 2, exec, ${magnifier} --decrease"
"$mod SHIFT_CONTROL, 3, exec, ${magnifier} --reset"
select
++ move
++ [
{
_args = [
"${mod} + ESCAPE"
(lib.generators.mkLuaInline "hl.dsp.window.close()")
];
}
bindm = [
# mouse movements
"$mod, mouse:272, movewindow" # left click
"$mod, mouse:273, resizewindow" # right click
{
_args = [
"${mod} + f"
(lib.generators.mkLuaInline ''hl.dsp.window.fullscreen({ mode = "maximized" })'')
];
}
{
_args = [
"${mod} + SHIFT + f"
(lib.generators.mkLuaInline ''hl.dsp.window.float({ action = "toggle" })'')
];
}
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
cursor_zoom_factor = 1;
cursor_zoom_rigid = true;
};
{
_args = [
"${mod} + h"
(lib.generators.mkLuaInline ''hl.dsp.focus({ direction = "left" })'')
];
}
{
_args = [
"${mod} + j"
(lib.generators.mkLuaInline ''hl.dsp.focus({ direction = "down" })'')
];
}
{
_args = [
"${mod} + k"
(lib.generators.mkLuaInline ''hl.dsp.focus({ direction = "up" })'')
];
}
{
_args = [
"${mod} + l"
(lib.generators.mkLuaInline ''hl.dsp.focus({ direction = "right" })'')
];
}
{
_args = [
"${mod} + CONTROL + 1"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${magnifier} --increase")'')
];
}
{
_args = [
"${mod} + CONTROL + 2"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${magnifier} --decrease")'')
];
}
{
_args = [
"${mod} + CONTROL + 3"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${magnifier} --reset")'')
];
}
# mouse movements: hyprland's lua API has no separate `bindm`,
# mouse binds are plain `hl.bind` with `{ mouse = true }`.
{
_args = [
"${mod} + mouse:272" # left click
(lib.generators.mkLuaInline "hl.dsp.window.drag()")
{ mouse = true; }
];
}
{
_args = [
"${mod} + mouse:273" # right click
(lib.generators.mkLuaInline "hl.dsp.window.resize()")
{ mouse = true; }
];
}
];
};
};
@@ -141,6 +411,23 @@ in
pkgs.wdisplays
pkgs.bc
];
systemd.user.services.hyprland-monitors = {
Unit = {
Description = "Hyprland monitor hotplug handler";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
Type = "simple";
ExecStart = "${monitorScript}";
Restart = "on-failure";
RestartSec = 5;
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
# To start electron apps like `chromium` with wayland support
@@ -153,90 +440,12 @@ in
# override "trace: warning: xdg-desktop-portal 1.17 reworked how portal implementations are loaded ..."
config.common.default = "*";
extraPortals = [ pkgs.xdg-desktop-portal-hyprland ];
extraPortals = [ pkgs.xdg-desktop-portal-wlr ];
};
# openGL is needed for wayland/hyprland
hardware.opengl.enable = true;
hardware.graphics.enable = true;
systemd.user.services.hyprland-monitors = {
# systemctl --user restart hyprland-monitors.service
# journalctl --user -u hyprland-monitors.service -e -f
unitConfig = {
Description = "handles hyprland monitor connect/disconnect";
};
wantedBy = [ "graphical-session.target" ];
requires = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
path = [
pkgs.hyprland
pkgs.socat
pkgs.jq
pkgs.bc
pkgs.libnotify
];
script = let
moveWSToMonitor = monitor: first: last:
if last < first
then throw "'first' has to be less than or equal to 'last'"
else
builtins.genList (n: "dispatch moveworkspacetomonitor ${builtins.toString (first + n)} ${monitor}") (last - first + 1);
external = moveWSToMonitor "HDMI-A-1" 1 5;
internal = moveWSToMonitor "eDPI-1" 6 10;
onlyInternal = moveWSToMonitor "eDPI-1" 1 10;
in
''
update() {
# waybar is buggy and duplicates workspaces somtimes
pkill waybar && waybar & disown
HDMI_STATUS=$(cat /sys/class/drm/card0-HDMI-A-1/status)
INTERNAL_WIDTH=1920
INTERNAL_HEIGHT=1200
if [ $HDMI_STATUS = "connected" ]; then
notify-send "Using external and laptop monitor"
hyprctl keyword monitor HDMI-A-1,preferred,0x0,1
HDMI=$(hyprctl monitors -j | jq '.[] | select(.name=="HDMI-A-1")')
HDMI_WIDTH=$(echo $HDMI | jq .width)
HDMI_HEIGHT=$(echo $HDMI | jq .height)
INTERNAL_POS_X=$(echo "($HDMI_WIDTH - $INTERNAL_WIDTH) / 2" | bc)
if (( $(echo "$INTERNAL_POS_X < 0" | bc) )); then INTERNAL_POS_X=0; fi
INTERNAL_POS_Y=$HDMI_HEIGHT
hyprctl keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,$INTERNAL_POS_X"x"$INTERNAL_POS_Y,1
hyprctl --batch "${lib.strings.concatStringsSep ";" (external ++ internal)}"
else
notify-send "Using only laptop monitor"
hyprctl --batch "keyword monitor HDMI-A,disable; keyword monitor eDP-1,$INTERNAL_WIDTH"x"$INTERNAL_HEIGHT,0x0,1"
hyprctl --batch "${lib.strings.concatStringsSep ";" onlyInternal}"
fi
}
handle() {
case $1 in
monitoradded*|monitorremoved*)
echo "handling event: \"$1\""
update ;;
esac
}
echo "Starting service with instance \"$HYPRLAND_INSTANCE_SIGNATURE\""
# Do initial configuration
update
socat -U - UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done
'';
};
boot.kernelParams = [ "i915.enable_psr=0" ];
};
}
+111
View File
@@ -0,0 +1,111 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.hyprlock.enable;
hyprlandEnabled = config.mod.hyprland.enable;
in
{
options = {
mod.hyprlock = {
enable = lib.mkEnableOption "enable hyprlock module";
dpmsTimeout = lib.mkOption {
description = "timeout in seconds before DPMS is turned on";
type = lib.types.str;
default = "10";
};
};
};
config = lib.mkIf enabled {
home-manager.users.alex = {
programs.hyprlock = {
enable = true;
settings = {
general = {
hide_cursor = true;
};
background = [
{
color = "rgb(000000)";
}
];
input-field = [
{
size = "250, 50";
position = "0, 0";
halign = "center";
valign = "center";
outline_thickness = 2;
dots_center = true;
fade_on_empty = false;
placeholder_text = "";
}
];
};
};
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = {
bind =
let
pause-music = "${pkgs.playerctl}/bin/playerctl -a pause";
dpmsTimeout = config.mod.hyprlock.dpmsTimeout;
dpmsOff = pkgs.writeShellScript "dpms-off" ''
${pkgs.hyprland}/bin/hyprctl dispatch 'hl.dsp.dpms({ action = "off" })'
'';
dpmsOn = pkgs.writeShellScript "dpms-on" ''
${pkgs.hyprland}/bin/hyprctl dispatch 'hl.dsp.dpms({ action = "on" })'
'';
dpms-lock = pkgs.writeShellScript "dpms-lock" ''
${pkgs.swayidle}/bin/swayidle \
timeout ${dpmsTimeout} ${dpmsOff} \
resume ${dpmsOn} &
${pkgs.hyprlock}/bin/hyprlock; ${pkgs.procps}/bin/pkill swayidle
'';
in
[
{
_args = [
"SUPER + x"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pause-music}; ${dpms-lock}")'')
];
}
{
_args = [
"switch:on:Lid Switch"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.procps}/bin/pidof hyprlock || { ${pause-music}; ${dpms-lock}; }")'')
{ locked = true; }
];
}
{
_args = [
"SUPER + SHIFT + x"
(lib.generators.mkLuaInline
''hl.dsp.exec_cmd("${pause-music}; ${pkgs.hyprlock}/bin/hyprlock & sleep 0.5; systemctl suspend-then-hibernate")''
)
];
}
];
};
};
};
security = {
polkit.enable = true;
pam.services.hyprlock = {};
};
};
}
@@ -1,6 +1,6 @@
{ pkgs, ... }:
{
home-manager.users.alex = {
home.packages = [ pkgs.nodePackages.typescript-language-server ];
home.packages = [ pkgs.typescript-language-server ];
};
}
+6 -1
View File
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.keyboard.enable;
in
+18 -4
View File
@@ -1,17 +1,31 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
hyprlandEnabled = config.mod.hyprland.enable;
in
{
users.users.alex.extraGroups = [ "video" ];
programs.light.enable = true;
home-manager.users.alex = {
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = {
bind = [
", XF86MonBrightnessUp, exec, ${pkgs.light}/bin/light -A 5"
", XF86MonBrightnessDown, exec, ${pkgs.light}/bin/light -U 5"
{
_args = [
"XF86MonBrightnessUp"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.brightnessctl}/bin/brightnessctl set +5%")'')
];
}
{
_args = [
"XF86MonBrightnessDown"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.brightnessctl}/bin/brightnessctl set 5%-")'')
];
}
];
};
};
@@ -1,7 +0,0 @@
{ pkgs, ... }:
{
services.mullvad-vpn = {
enable = true;
package = pkgs.mullvad-vpn;
};
}
+94
View File
@@ -0,0 +1,94 @@
{
inputs,
pkgs,
lib,
config,
...
}:
let
hyprlandEnabled = config.mod.hyprland.enable;
in
{
home-manager.users.alex = {
wayland.windowManager.hyprland = lib.mkIf hyprlandEnabled {
settings = {
bind =
let
prev = "${pkgs.playerctl}/bin/playerctl -p ndp,naviterm,spotify previous";
next = "${pkgs.playerctl}/bin/playerctl -p ndp,naviterm,spotify next";
mkExec = key: cmd: {
_args = [
key
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${cmd}")'')
];
};
in
[
(mkExec "XF86AudioPrev" prev)
(mkExec "XF86AudioNext" next)
(mkExec "XF86AudioPlay" "${pkgs.playerctl}/bin/playerctl -p ndp,naviterm,spotify play-pause")
(mkExec "XF86AudioPause" "${pkgs.playerctl}/bin/playerctl -p ndp,naviterm,spoitfy play-pause")
(mkExec "SUPER + ALT + LEFT" prev)
(mkExec "SUPER + ALT + RIGHT" next)
(mkExec "SUPER + ALT + DOWN" "${pkgs.playerctl}/bin/playerctl -p ndp,naviterm,spotify play-pause")
];
};
};
home.packages = [
pkgs.playerctl
pkgs.spotify
inputs.naviterm.packages.${pkgs.stdenv.hostPlatform.system}.default
];
programs.ndp = {
enable = true;
settings = {
server = "http://manatee:4533";
user = "navi";
passwordCommand = "cat ${config.age.secrets."navidrome-password".path}";
anthropicKeyCommand = "cat ${config.age.secrets."ndp-llm-api-key".path}";
};
};
};
home-manager.sharedModules = [ inputs.ndp.homeManagerModules.default ];
systemd.user.services.playerctld = {
unitConfig = {
Description = "starts playerctld daemon";
};
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.playerctl}/bin/playerctld";
};
};
# Ensure the parent dir of the secret's path is owned by alex; otherwise
# agenix creates it as root.
systemd.tmpfiles.rules = [
"d /home/alex/.config/naviterm 0755 alex users -"
];
age.secrets."naviterm-config" = {
file = ../../../../secrets/pinwheel/naviterm-config.age;
path = "/home/alex/.config/naviterm/config.ini";
owner = "alex";
group = "users";
};
age.secrets."navidrome-password" = {
file = ../../../../secrets/pinwheel/navidrome-password.age;
owner = "alex";
group = "users";
};
age.secrets."ndp-llm-api-key" = {
file = ../../../../secrets/pinwheel/ndp-llm-api-key.age;
owner = "alex";
group = "users";
};
}
+12 -11
View File
@@ -1,21 +1,22 @@
{ pkgs, ... }:
{
services.connman = {
home-manager = {
users.alex = {
home.packages = [ pkgs.networkmanager ];
};
};
networking = {
wireless.enable = false; # Wireless is managed by networkmanager
networkmanager = {
enable = true;
wifi = {
backend = "iwd";
};
};
networkInterfaceBlacklist = [
"vmnet"
"vboxnet"
"virbr"
"ifb"
"ve"
"docker"
"br-"
"wg-"
];
};
networking = {
+4 -1
View File
@@ -1,6 +1,9 @@
{ pkgs, ... }:
{
home-manager.users.alex = {
home.packages = [ pkgs.nil ];
home.packages = [
pkgs.nixfmt
pkgs.nix-tree
];
};
}
+15 -12
View File
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.openvpn.enable;
in
@@ -13,21 +18,19 @@ in
home-manager.users.alex = {
home.packages = [
pkgs.openvpn
pkgs.update-systemd-resolved
];
};
services.resolved = {
enable = false;
dnssec = "true";
domains = [ "~." ];
fallbackDns = [
"1.1.1.1#one.one.one.one"
"1.0.0.1#one.one.one.one"
];
extraConfig = ''
DNSOverTLS=yes
'';
enable = true;
settings = {
Resolve = {
Domains = [ "~." ];
DNSSEC = false;
DNSOverTLS = true;
};
};
};
};
}
+20 -3
View File
@@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.physlock.enable;
hyprlandEnabled = config.mod.hyprland.enable;
@@ -33,8 +38,20 @@ in
in
[
# will lock the screen with `physlock`, see `lockOn.suspend
"$mod SHIFT, x, exec, ${pause-music}; systemctl suspend"
"$mod, x, exec, ${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m"
{
_args = [
"SUPER + SHIFT + x"
(lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pause-music}; systemctl suspend")'')
];
}
{
_args = [
"SUPER + x"
(lib.generators.mkLuaInline
''hl.dsp.exec_cmd("${pause-music}; ${config.security.wrapperDir}/physlock -d -s -m")''
)
];
}
];
};
};
+35
View File
@@ -0,0 +1,35 @@
{ pkgs, ... }:
let
picard = pkgs.symlinkJoin {
name = "picard";
paths = [ pkgs.picard ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/picard --set QT_SCREEN_SCALE_FACTORS 1.5
'';
};
plugins = pkgs.linkFarm "picard-plugins" {
replaygain2 = pkgs.fetchFromGitHub {
owner = "metabrainz";
repo = "picard-plugin-replaygain2";
tag = "v2.3.1";
hash = "sha256-NBn/LgjDRVCHmbI+bU4j29UhrL33ctV9jXj6CfFRBWA=";
};
};
in
{
home-manager.users.alex = { lib, ... }: {
home.packages = [
picard
pkgs.rsgain
];
home.activation.picardReplayGainPlugin = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
if ! ${pkgs.picard}/bin/picard-cli plugins info replaygain2 2>/dev/null | grep -qF "${plugins}/replaygain2"; then
run ${pkgs.picard}/bin/picard-cli --yes plugins install --no-git --reinstall "${plugins}/replaygain2" \
|| warnEcho "Failed to install Picard plugin replaygain2"
fi
'';
};
}
@@ -1,20 +0,0 @@
{ pkgs, ... }:
{
nixpkgs.overlays = [
(final: prev: {
postman = prev.postman.overrideAttrs(old: rec {
version = "20230716100528";
src = final.fetchurl {
url = "https://web.archive.org/web/${version}/https://dl.pstmn.io/download/latest/linux_64";
sha256 = "sha256-svk60K4pZh0qRdx9+5OUTu0xgGXMhqvQTGTcmqBOMq8=";
name = "${old.pname}-${version}.tar.gz";
};
});
})
];
home-manager.users.alex = {
home.packages = [ pkgs.postman ];
};
}
+105 -3
View File
@@ -1,18 +1,59 @@
{ lib, config, ... }:
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.power.enable;
lowbat = config.mod.lowbat;
in
{
options = {
mod.power = {
enable = lib.mkEnableOption "enable power module";
};
mod.lowbat = {
enable = lib.mkEnableOption "enable low battery manager";
battery = lib.mkOption {
default = "BAT0";
description = "Battery to monitor";
};
config = lib.mkIf enabled {
services = {
notifyCapacity = lib.mkOption {
default = 15;
description = "Notify low battery at this level";
};
hibernateCapacity = lib.mkOption {
default = 10;
description = "Warn at this level and then hibernate if power is not plugged in";
};
};
};
config = {
swapDevices = lib.mkIf enabled [
{
device = "/var/lib/swapfile";
size = 64 * 1024; # MiB
}
];
services = lib.mkIf enabled {
upower = {
enable = true;
criticalPowerAction = "Hibernate";
};
logind.settings.Login = {
HandleLidSwitch = "ignore";
HandleLidSwitchExternalPower = "ignore";
HandleLidSwitchDocked = "ignore";
HandleSuspendKey = "ignore";
HandleHibernateKey = "ignore";
};
tlp = {
@@ -24,5 +65,66 @@ in
};
};
};
systemd.user = lib.mkIf lowbat.enable {
timers = {
"monitor-low-battery" = {
unitConfig = {
Description = "monitors battery level and hibernates computer if battery is low";
};
timerConfig = {
Unit = "monitor-low-battery.service";
OnCalendar = "*-*-* *:00/15:00"; # Every 15 minutes
Persistent = true;
};
wantedBy = [ "timers.target" ];
};
};
services = {
"monitor-low-battery" = {
unitConfig = {
Description = "monitors battery level and hibernates computer if battery is low";
};
serviceConfig = {
Type = "exec";
};
path = [
pkgs.coreutils # For `cat`
pkgs.libnotify
pkgs.hyprlock
];
script =
let
pause-music = "${pkgs.playerctl}/bin/playerctl -a pause";
in
''
BATTERY_CAPACITY=$(cat /sys/class/power_supply/${lowbat.battery}/capacity)
BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status)
echo "Battery capacity: $BATTERY_CAPACITY"
echo "Battery status: $BATTERY_STATUS"
if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.notifyCapacity} && $BATTERY_STATUS = "Discharging" ]]; then
notify-send --expire-time=0 --urgency=critical "Battery Low"
fi
if [[ $BATTERY_CAPACITY -le ${builtins.toString lowbat.hibernateCapacity} && $BATTERY_STATUS = "Discharging" ]]; then
notify-send --expire-time=0 --urgency=critical "Battery Critically Low" "Hibernating in 60 seconds if power is not plugged in"
sleep 60s
BATTERY_STATUS=$(cat /sys/class/power_supply/${lowbat.battery}/status)
if [[ $BATTERY_STATUS = "Discharging" ]]; then
${pause-music}; ${pkgs.hyprlock}/bin/hyprlock & sleep 0.5; systemctl hibernate
fi
fi
'';
};
};
};
};
}
Loaded 100 of 242 files, more files were not shown because too many files have changed in this diff. Show more