Compare commits
34
Commits
master
...
621ca5dde6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
621ca5dde6 | ||
|
|
a00916864c | ||
|
|
3ab8bfbb91 | ||
|
|
70deb25080 | ||
|
|
ac57abf255 | ||
|
|
83ee518091 | ||
|
|
3ee2b1a9d8 | ||
|
|
e9a5781944 | ||
|
|
1f8a34d0e8 | ||
|
|
1176132627 | ||
|
|
01b31a3493 | ||
|
|
28fc71dbbe | ||
|
|
c7392f2dd9 | ||
|
|
f5f8e88966 | ||
|
|
bf874d962a | ||
|
|
f01b1f2c4f | ||
|
|
ff34fe762e | ||
|
|
7e4407a1f8 | ||
|
|
539fb26791 | ||
|
|
003a2f77dd | ||
|
|
86e7f9c1a8 | ||
|
|
adb7fcfad7 | ||
|
|
5235f5abcb | ||
|
|
f53f2331d0 | ||
|
|
84cec9e935 | ||
|
|
79b26ddfda | ||
|
|
b8961fb47d | ||
|
|
4851f745d8 | ||
|
|
59b5cfb47c | ||
|
|
a8364f21ca | ||
|
|
f135c1646f | ||
|
|
7a1b0541c2 | ||
|
|
6c5f61997d | ||
|
|
763253693c |
@@ -1 +1,3 @@
|
|||||||
AGENTS.md
|
AGENTS.md
|
||||||
|
*.dec
|
||||||
|
keys.txt
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
keys:
|
||||||
|
- &admin_finn age1a0v442ct2qfjcdhyktn25spw02yq4fl08plrrvuradwwxzsle4mq8thln4
|
||||||
|
- &host_mibook age1n3uqtee5ymykrls6k04dznq50cwmj99hw7ny83yxjndt4y2ncf5qhjwa2p
|
||||||
|
# - &host_jupiter age1... # TODO: Phase 9, see docs/secrets.md
|
||||||
|
|
||||||
|
creation_rules:
|
||||||
|
- path_regex: ^secrets/mibook\.yaml$
|
||||||
|
key_groups:
|
||||||
|
- age:
|
||||||
|
- *admin_finn
|
||||||
|
- *host_mibook
|
||||||
|
# - path_regex: ^secrets/jupiter\.yaml$ # TODO: Phase 9
|
||||||
|
# key_groups:
|
||||||
|
# - age: [ *admin_finn, *host_jupiter ]
|
||||||
|
# - path_regex: ^secrets/common\.yaml$ # TODO: Phase 9
|
||||||
|
# key_groups:
|
||||||
|
# - age: [ *admin_finn, *host_mibook, *host_jupiter ]
|
||||||
@@ -35,6 +35,7 @@ flake.nix
|
|||||||
│ ├── core.nix # system packages, locale, timezone
|
│ ├── core.nix # system packages, locale, timezone
|
||||||
│ ├── network.nix
|
│ ├── network.nix
|
||||||
│ ├── nix.nix
|
│ ├── nix.nix
|
||||||
|
│ ├── sops.nix # sops-nix decryption config, sops/age/ssh-to-age on PATH
|
||||||
│ └── users.nix
|
│ └── users.nix
|
||||||
├── modules/ # custom NixOS option modules (my.profiles.*, my.hardware.*, my.services.*)
|
├── modules/ # custom NixOS option modules (my.profiles.*, my.hardware.*, my.services.*)
|
||||||
│ ├── environments/ # per-service/app profiles
|
│ ├── environments/ # per-service/app profiles
|
||||||
@@ -43,10 +44,21 @@ flake.nix
|
|||||||
└── machines/<name>/
|
└── machines/<name>/
|
||||||
├── configuration.nix # machine-specific NixOS settings
|
├── configuration.nix # machine-specific NixOS settings
|
||||||
├── environments.nix # enables profiles via my.profiles.* / my.hardware.* options
|
├── environments.nix # enables profiles via my.profiles.* / my.hardware.* options
|
||||||
|
├── secrets.nix # sops.secrets declared for this host
|
||||||
├── disks.nix
|
├── disks.nix
|
||||||
└── hardware-configuration.nix
|
└── hardware-configuration.nix
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Secrets (sops-nix)
|
||||||
|
|
||||||
|
Secrets are encrypted with sops, decrypted per-host from that host's SSH host
|
||||||
|
key. `.sops.yaml` defines who can decrypt what; `secrets/<host>.yaml` holds
|
||||||
|
the encrypted values; `machines/<host>/secrets.nix` declares which secrets
|
||||||
|
that host exposes and consumes them via `config.sops.secrets.<name>.path`.
|
||||||
|
Always `git add` a secrets file before `nix build` — untracked files are
|
||||||
|
invisible to flake evaluation. Full workflow (adding a secret, adding a host,
|
||||||
|
rotating keys): see [`docs/secrets.md`](docs/secrets.md).
|
||||||
|
|
||||||
### Profile / Module Pattern
|
### Profile / Module Pattern
|
||||||
|
|
||||||
Every module under `modules/` follows the same structure:
|
Every module under `modules/` follows the same structure:
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
# Secrets (sops-nix)
|
||||||
|
|
||||||
|
Secrets are encrypted with [sops](https://github.com/getsops/sops) and decrypted
|
||||||
|
at activation by [sops-nix](https://github.com/Mic92/sops-nix). Each host decrypts
|
||||||
|
with its own SSH host key (converted to an age key in-memory — no separate host
|
||||||
|
private key is ever stored on disk).
|
||||||
|
|
||||||
|
Tooling (`sops`, `age`, `ssh-to-age`) is available via `nix develop` in this repo,
|
||||||
|
and installed system-wide on every machine via `machines/core/sops.nix`.
|
||||||
|
|
||||||
|
## Adding a secret to an existing host
|
||||||
|
|
||||||
|
```
|
||||||
|
nix develop -c sops secrets/<host>.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
This opens `$EDITOR` on the decrypted content. Add your key, save, quit — sops
|
||||||
|
re-encrypts on write. Then declare it in `machines/<host>/secrets.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
sops.secrets.my-secret = {
|
||||||
|
owner = "someuser"; # defaults to root
|
||||||
|
group = "someuser";
|
||||||
|
mode = "0400";
|
||||||
|
restartUnits = [ "foo.service" ]; # if a running service needs to pick it up
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Consume it in the owning module as `config.sops.secrets.my-secret.path`
|
||||||
|
(resolves to `/run/secrets/my-secret`) — never inline the decrypted value into
|
||||||
|
a Nix string, since that copies it into the world-readable `/nix/store`.
|
||||||
|
|
||||||
|
Then:
|
||||||
|
|
||||||
|
```
|
||||||
|
nix build '.#nixosConfigurations.<host>.config.system.build.toplevel'
|
||||||
|
sudo nixos-rebuild test --flake '.#<host>'
|
||||||
|
# verify, then:
|
||||||
|
sudo nixos-rebuild switch --flake '.#<host>'
|
||||||
|
```
|
||||||
|
|
||||||
|
**The secrets file must be `git add`ed before `nix build`** — untracked files
|
||||||
|
are invisible to flake evaluation, and `sops.validateSopsFiles` needs it in the
|
||||||
|
Nix store.
|
||||||
|
|
||||||
|
## Adding a new host
|
||||||
|
|
||||||
|
1. On the new host: `ssh-to-age < /etc/ssh/ssh_host_ed25519_key.pub` to get its
|
||||||
|
age public key.
|
||||||
|
2. In `.sops.yaml`: add a `&host_<name>` anchor with that key, and a
|
||||||
|
`creation_rules` entry for `secrets/<name>.yaml` including both the new
|
||||||
|
host key and `*admin_finn`.
|
||||||
|
3. Create `machines/<name>/secrets.nix`, add it to that machine's
|
||||||
|
`configuration.nix` imports.
|
||||||
|
4. If the host needs to read an existing shared file, run
|
||||||
|
`sops updatekeys secrets/<file>.yaml` after step 2 so it's re-encrypted to
|
||||||
|
include the new recipient.
|
||||||
|
|
||||||
|
## Rotating keys
|
||||||
|
|
||||||
|
```
|
||||||
|
# after editing .sops.yaml (new/removed recipient):
|
||||||
|
nix develop -c sops updatekeys secrets/<file>.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
for every file the change affects. `updatekeys` requires you to already be
|
||||||
|
able to decrypt the file — this is why `*admin_finn` is a recipient on every
|
||||||
|
rule, as the standing fallback.
|
||||||
|
|
||||||
|
Reinstalling a host regenerates its SSH host key, which changes its age
|
||||||
|
identity. Any file previously encrypted to that host must be `updatekeys`'d
|
||||||
|
with the new key, or the host's next activation fails to decrypt.
|
||||||
|
|
||||||
|
## Where private keys live
|
||||||
|
|
||||||
|
- **Operator** (you): `~/.config/sops/age/keys.txt` — sops' default lookup
|
||||||
|
path, so `SOPS_AGE_KEY_FILE` never needs to be set. Never committed. Back
|
||||||
|
this up out-of-band (password manager, offline copy) — if it's lost, only
|
||||||
|
the surviving host keys can still decrypt their own files, and any file that
|
||||||
|
was only ever readable by an operator-only rule becomes permanently
|
||||||
|
unreadable.
|
||||||
|
- **Hosts**: `/etc/ssh/ssh_host_ed25519_key` — already managed by NixOS,
|
||||||
|
converted to age in-memory at activation time. Nothing extra to back up.
|
||||||
|
|
||||||
|
## Layout
|
||||||
|
|
||||||
|
```
|
||||||
|
.sops.yaml # age recipients + creation rules (which keys can decrypt which files)
|
||||||
|
secrets/<host>.yaml # per-host encrypted secrets (default sopsFile for that host)
|
||||||
|
machines/core/sops.nix # applied to every machine: decryption config, sops/age/ssh-to-age on PATH
|
||||||
|
machines/<host>/secrets.nix # per-host: which secrets exist, owner/group/mode
|
||||||
|
```
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
# Jellyfin Hardware Transcoding (jupiter) Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
**Goal:** Give jupiter's Jellyfin service access to the Intel iGPU's VAAPI render node so Quick Sync hardware transcoding can be enabled, instead of every transcode falling back to CPU.
|
||||||
|
|
||||||
|
**Architecture:** One NixOS module change (`modules/environments/jellyfin/default.nix`) grants the `jellyfin` systemd service supplementary access to the `video`/`render` groups and installs `libva-utils` for verification. This is declarative and build-verifiable from the Mac. Enabling Quick Sync inside Jellyfin's own dashboard, and the on-machine verification, is a manual step run by the user on jupiter after deploy — the NixOS module has no option for it and this environment's convention is that the assistant never SSHes into jupiter directly (see `docs/superpowers/specs/2026-07-26-jellyfin-hw-transcoding.md`).
|
||||||
|
|
||||||
|
**Tech Stack:** NixOS (flake-parts), nixpkgs `services.jellyfin` module, VAAPI/`intel-media-driver`, `libva-utils`.
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- No SSH from the assistant into jupiter — all on-machine commands are given to the user to run and paste back.
|
||||||
|
- Follow the existing profile pattern in `modules/environments/jellyfin/default.nix` (`config = lib.mkIf cfg.enable { ... }`); don't introduce a new toggle option — hardcode the hardware-acceleration wiring on, per the approved spec.
|
||||||
|
- Verify locally via `nix eval` / `nix build` before asking the user to deploy.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 1: Grant Jellyfin access to the iGPU and verify the build
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Modify: `modules/environments/jellyfin/default.nix`
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `systemd.services.jellyfin.serviceConfig.SupplementaryGroups = [ "video" "render" ];` — verified via `nix eval` in Step 2.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Add the device-access config and `libva-utils` package**
|
||||||
|
|
||||||
|
Read the current file first (`modules/environments/jellyfin/default.nix`), then edit the `config = lib.mkIf cfg.enable { ... }` block so it reads:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.jellyfin = {
|
||||||
|
enable = true;
|
||||||
|
openFirewall = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.libva-utils ];
|
||||||
|
|
||||||
|
my.homepage.services = [
|
||||||
|
{
|
||||||
|
group = "Media";
|
||||||
|
name = "Jellyfin";
|
||||||
|
description = "Media server";
|
||||||
|
href = "http://${hostName}:${toString port}";
|
||||||
|
icon = "jellyfin.png";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.services.jellyfin = {
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
serviceConfig.SupplementaryGroups = [
|
||||||
|
"video"
|
||||||
|
"render"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Note the two existing `systemd.services.jellyfin` keys (`after`) and the new `serviceConfig.SupplementaryGroups` now live in the same attrset — don't create a second `systemd.services.jellyfin = { ... }` block, it would overwrite the first.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Verify the rendered config with `nix eval`**
|
||||||
|
|
||||||
|
Run (from the repo root on the Mac):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix eval '.#nixosConfigurations.jupiter.config.systemd.services.jellyfin.serviceConfig.SupplementaryGroups' \
|
||||||
|
--extra-experimental-features 'nix-command flakes'
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected output: `[ "video" "render" ]`
|
||||||
|
|
||||||
|
- [ ] **Step 3: Verify the machine still builds**
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix build '.#nixosConfigurations.jupiter.config.system.build.toplevel' \
|
||||||
|
--extra-experimental-features 'nix-command flakes' --no-link
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected: build succeeds with no errors (may take a while; watch for any evaluation error mentioning `jellyfin` or `libva-utils`).
|
||||||
|
|
||||||
|
- [ ] **Step 4: Format and commit**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nixfmt-rfc-style modules/environments/jellyfin/default.nix
|
||||||
|
git add modules/environments/jellyfin/default.nix
|
||||||
|
git commit -m "feat(jellyfin): grant iGPU access for Quick Sync hardware transcoding"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 2: Deploy on jupiter and enable Quick Sync (user-executed)
|
||||||
|
|
||||||
|
**Files:** none (on-machine deploy + Jellyfin dashboard UI)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: the `SupplementaryGroups` change from Task 1, already merged into the flake.
|
||||||
|
|
||||||
|
These steps run **on jupiter**, by the user — paste the output back so we can confirm each one before moving to the next.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Deploy**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake '.#jupiter'
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected: switch succeeds, no errors mentioning `jellyfin`.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Confirm the service picked up the new groups**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl show jellyfin -p SupplementaryGroups
|
||||||
|
systemctl status jellyfin --no-pager
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected: `SupplementaryGroups=video render` (order may vary) and the service is `active (running)`.
|
||||||
|
|
||||||
|
- [ ] **Step 3: Confirm VAAPI driver loads**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
vainfo
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected: output starts with something like `vainfo: VA-API version: 1.x` and `Driver version: Intel iHD driver`, followed by a list of supported VAProfiles/VAEntrypoints (e.g. `VAProfileH264Main : VAEntrypointVLD`, `VAEntrypointEncSlice`).
|
||||||
|
|
||||||
|
If this instead prints a permissions or "no VA display" error, paste it back — that means the group grant isn't reaching the process and Task 1 needs a follow-up fix (e.g. the jellyfin service may be more sandboxed than expected, requiring an explicit `DeviceAllow=char-drm rw` in `serviceConfig` as well).
|
||||||
|
|
||||||
|
- [ ] **Step 4: Enable Quick Sync in the Jellyfin dashboard**
|
||||||
|
|
||||||
|
In the Jellyfin web UI:
|
||||||
|
1. **Dashboard → Playback**.
|
||||||
|
2. Hardware acceleration: **Intel QuickSync (QSV)**.
|
||||||
|
3. VA-API device: `/dev/dri/renderD128`.
|
||||||
|
4. Enable hardware decoding for the codecs your library uses (H264 at minimum).
|
||||||
|
5. If the library has HDR content, enable tone-mapping.
|
||||||
|
6. Save.
|
||||||
|
|
||||||
|
- [ ] **Step 5: Functional check**
|
||||||
|
|
||||||
|
Play a file that requires transcoding (or force a lower quality in the client's playback settings to trigger one), then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
journalctl -u jellyfin -n 50 --no-pager
|
||||||
|
```
|
||||||
|
|
||||||
|
Look for a line referencing `qsv` or `vaapi` in the transcode command. Separately, watch CPU usage (`htop`) during playback — it should stay low on the core doing the transcode, rather than pegging at 100%, since the iGPU is now doing the encode/decode work.
|
||||||
|
|
||||||
|
## Self-Review Notes
|
||||||
|
|
||||||
|
- Spec coverage: NixOS change (Task 1) ✓, manual dashboard step (Task 2 Step 4) ✓, verification via `vainfo`/build (Task 1 Step 2-3, Task 2 Step 3) ✓, functional check (Task 2 Step 5) ✓. Toggle option explicitly excluded per approved spec — not present, correctly.
|
||||||
|
- No placeholders — every step has literal commands/code.
|
||||||
|
- `SupplementaryGroups` key/value matches exactly between Task 1 (produced) and Task 2 (consumed/checked).
|
||||||
@@ -0,0 +1,299 @@
|
|||||||
|
# Immich NixOS Module Implementation Plan
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
>
|
||||||
|
> **Note on nature:** Task 1 is repo work verifiable with `nix build` (no runtime tests exist for declarative config). Tasks 2–6 are a **manual migration runbook executed on jupiter by the operator** — they are destructive and cannot be run from the dev machine (mibook). Do not attempt to automate or execute Tasks 2–6 from an agent session; present them for the operator to run and confirm.
|
||||||
|
|
||||||
|
**Goal:** Replace jupiter's docker-compose Immich with the native `services.immich` NixOS module, preserving all data (albums, faces, shares, library).
|
||||||
|
|
||||||
|
**Architecture:** A standard `my.profiles.immich` module wraps `services.immich` (native Postgres+VectorChord over unix socket, Redis, server, machine-learning). Media stays at the default local `/var/lib/immich`. The existing docker Postgres dump is restored same-version (2.7.5 → 2.7.5, no schema/vector migration). GPU is exposed for VAAPI/QSV transcoding.
|
||||||
|
|
||||||
|
**Tech Stack:** NixOS (flake-parts), `services.immich` from nixpkgs 25.11, PostgreSQL, Intel QSV/VAAPI, docker (source only).
|
||||||
|
|
||||||
|
## Global Constraints
|
||||||
|
|
||||||
|
- Machine: **jupiter** only. Do not enable on mibook.
|
||||||
|
- Immich version: source docker == target nixpkgs == **2.7.5** (stable). No `package` override. Do NOT bump nixpkgs Immich during this work.
|
||||||
|
- Media location: default `/var/lib/immich` (local disk). Do not point at the NAS.
|
||||||
|
- Database: local PostgreSQL over **unix socket + peer auth** — no password, no sops secret.
|
||||||
|
- HW accel: **video transcoding only**. ML stays on CPU (`machine-learning.enable = true`, no OpenVINO).
|
||||||
|
- Access: LAN + VPN, `openFirewall = true`, port **2283**. No reverse proxy/TLS.
|
||||||
|
- Rebuild command: `sudo nixos-rebuild switch --flake '.#jupiter'`.
|
||||||
|
- Build-check command: `nix build '.#nixosConfigurations.jupiter.config.system.build.toplevel'`.
|
||||||
|
- Format Nix with `nixfmt-rfc-style` before committing.
|
||||||
|
- Do not delete docker DB or upload data until Task 6 sign-off.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## File Structure
|
||||||
|
|
||||||
|
- **Create** `modules/environments/immich/default.nix` — the `my.profiles.immich` module (single responsibility: declare Immich).
|
||||||
|
- **Modify** `modules/environments/default.nix` — add `./environments/immich` to the import list.
|
||||||
|
- **Modify** `machines/jupiter/environments.nix` — set `immich.enable = true`.
|
||||||
|
|
||||||
|
No other files change. The DB/media migration touches only runtime state on jupiter, not the repo.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 1: Author the `immich` profile module
|
||||||
|
|
||||||
|
**Files:**
|
||||||
|
- Create: `modules/environments/immich/default.nix`
|
||||||
|
- Modify: `modules/environments/default.nix` (import list)
|
||||||
|
- Modify: `machines/jupiter/environments.nix` (`my.profiles.immich.enable`)
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: NixOS option `my.profiles.immich.enable` (bool). When true, configures `services.immich`, adds `immich` user to `video`/`render` groups, and appends an entry to `my.homepage.services`.
|
||||||
|
- Consumes: existing `my.homepage.services` aggregator; `config.networking.hostName`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Read a reference module to match repo style**
|
||||||
|
|
||||||
|
Read `modules/environments/jellyfin/default.nix` (same shape: `cfg`, `hostName`, `port`, `mkIf`, `my.homepage.services`). Match its formatting and header-comment convention.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Create the module file**
|
||||||
|
|
||||||
|
Create `modules/environments/immich/default.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# Immich self-hosted photo & video server
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.my.profiles.immich;
|
||||||
|
hostName = config.networking.hostName;
|
||||||
|
port = 2283;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.my.profiles.immich = with lib; {
|
||||||
|
enable = mkEnableOption "Immich photo server";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.immich = {
|
||||||
|
enable = true;
|
||||||
|
host = "0.0.0.0";
|
||||||
|
inherit port;
|
||||||
|
openFirewall = true;
|
||||||
|
mediaLocation = "/var/lib/immich";
|
||||||
|
machine-learning.enable = true;
|
||||||
|
accelerationDevices = [ "/dev/dri/renderD128" ];
|
||||||
|
settings.server.externalDomain = "http://${hostName}:${toString port}";
|
||||||
|
};
|
||||||
|
|
||||||
|
# The native module does not add GPU groups; required for VAAPI/QSV transcoding.
|
||||||
|
users.users.immich.extraGroups = [
|
||||||
|
"video"
|
||||||
|
"render"
|
||||||
|
];
|
||||||
|
|
||||||
|
my.homepage.services = [
|
||||||
|
{
|
||||||
|
group = "Media";
|
||||||
|
name = "Immich";
|
||||||
|
description = "Photo & video server";
|
||||||
|
href = "http://${hostName}:${toString port}";
|
||||||
|
icon = "immich.png";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 3: Register the module in the environments import list**
|
||||||
|
|
||||||
|
Open `modules/environments/default.nix` and add `./environments/immich` (or `./immich`, matching the exact relative style already used in that file — check how `jellyfin` is listed and mirror it).
|
||||||
|
|
||||||
|
- [ ] **Step 4: Enable it on jupiter**
|
||||||
|
|
||||||
|
In `machines/jupiter/environments.nix`, inside the `my.profiles = { ... }` block, add:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
immich.enable = true;
|
||||||
|
```
|
||||||
|
|
||||||
|
- [ ] **Step 5: Format**
|
||||||
|
|
||||||
|
Run: `nixfmt-rfc-style modules/environments/immich/default.nix`
|
||||||
|
|
||||||
|
- [ ] **Step 6: Build-check (this is the "test")**
|
||||||
|
|
||||||
|
Run: `nix build '.#nixosConfigurations.jupiter.config.system.build.toplevel'`
|
||||||
|
Expected: builds successfully. If it fails on an unknown option (e.g. `accelerationDevices`, `settings.server.externalDomain`), reconcile against the module at `$(nix eval --raw '.#nixosConfigurations.jupiter.pkgs.path')/nixos/modules/services/web-apps/immich.nix` and fix.
|
||||||
|
|
||||||
|
- [ ] **Step 7: Confirm the option evaluates on**
|
||||||
|
|
||||||
|
Run: `nix eval '.#nixosConfigurations.jupiter.config.services.immich.enable'`
|
||||||
|
Expected: `true`
|
||||||
|
|
||||||
|
- [ ] **Step 8: Commit**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add modules/environments/immich/default.nix modules/environments/default.nix machines/jupiter/environments.nix
|
||||||
|
git commit -m "feat(jupiter): add native Immich profile module"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 2: Pre-flight & backup on jupiter (operator-run)
|
||||||
|
|
||||||
|
**Files:** none (runtime state on jupiter). Run all commands on jupiter.
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Produces: `immich-db.sql` dump file and a known-good copy/snapshot of the docker upload folder; recorded `UPLOAD_LOCATION` path and DB container name.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Record docker facts**
|
||||||
|
|
||||||
|
From the docker-compose dir on jupiter, note `UPLOAD_LOCATION`, the DB service/container name, and `POSTGRES_USER`/`POSTGRES_DB` from `.env`/compose. Confirm server version is **2.7.5** (web UI footer or `docker exec <server> immich --version`). If it is not 2.7.5, STOP — this plan assumes a same-version restore.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Stop the docker stack (DB may stay up for the dump)**
|
||||||
|
|
||||||
|
Run: `docker compose stop immich-server immich-machine-learning` (leave the DB container running).
|
||||||
|
|
||||||
|
- [ ] **Step 3: Dump the database**
|
||||||
|
|
||||||
|
Run: `docker exec -t <db-container> pg_dumpall --clean --if-exists --username=<POSTGRES_USER> > ~/immich-db.sql`
|
||||||
|
Expected: a non-trivial `immich-db.sql` (check it is not near-empty: `wc -l ~/immich-db.sql`).
|
||||||
|
|
||||||
|
- [ ] **Step 4: Stop the DB and record the media size**
|
||||||
|
|
||||||
|
Run: `docker compose down` then `du -sh <UPLOAD_LOCATION>` and note the size. Do NOT copy yet. Do NOT delete anything.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 3: First switch — let the module create empty state (operator-run)
|
||||||
|
|
||||||
|
**Files:** none at runtime (repo change already committed in Task 1). Run on jupiter after pulling the committed branch.
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `immich-db.sql`, `UPLOAD_LOCATION` from Task 2.
|
||||||
|
- Produces: an `immich` system user, an empty `immich` Postgres DB + role, and `/var/lib/immich` created with correct ownership, with services then stopped.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Deploy the config**
|
||||||
|
|
||||||
|
On jupiter, check out the branch containing Task 1's commit and run:
|
||||||
|
`sudo nixos-rebuild switch --flake '.#jupiter'`
|
||||||
|
Expected: `immich-server`, `immich-machine-learning`, postgres, and redis units come up; UI reachable at `http://jupiter:2283` showing a fresh/empty instance.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Stop immich so data can be swapped underneath**
|
||||||
|
|
||||||
|
Run: `sudo systemctl stop immich-server immich-machine-learning`
|
||||||
|
Expected: both inactive. PostgreSQL and Redis stay running.
|
||||||
|
|
||||||
|
- [ ] **Step 3: Verify the DB and user exist**
|
||||||
|
|
||||||
|
Run: `sudo -u postgres psql -c '\l' | grep immich` and `sudo -u postgres psql -c '\du' | grep immich`
|
||||||
|
Expected: an `immich` database and `immich` role are present.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 4: Restore database and media (operator-run, destructive)
|
||||||
|
|
||||||
|
**Files:** none in repo. Run on jupiter. This overwrites the freshly-created empty DB.
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: `immich-db.sql`, `<UPLOAD_LOCATION>`, the running NixOS PostgreSQL.
|
||||||
|
- Produces: the migrated DB and populated `/var/lib/immich`.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Restore the dump into the NixOS Postgres**
|
||||||
|
|
||||||
|
`pg_dumpall` output includes role/DB creation. Load it as the `postgres` superuser over the unix socket:
|
||||||
|
Run: `sudo -u postgres psql -f ~/immich-db.sql`
|
||||||
|
Expected: completes without fatal errors. Harmless "role already exists"/"database already exists" notices are OK because of `--clean --if-exists`. If the immich DB ends up owned by the wrong role, reassign: `sudo -u postgres psql -c 'ALTER DATABASE immich OWNER TO immich;'`.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Sanity-check the restored data**
|
||||||
|
|
||||||
|
Run: `sudo -u postgres psql -d immich -c 'SELECT count(*) FROM assets;'`
|
||||||
|
Expected: a count matching your library size (non-zero). If the table name differs by version, list tables with `\dt` and check an obviously-populated one.
|
||||||
|
|
||||||
|
- [ ] **Step 3: Move the media into the default location**
|
||||||
|
|
||||||
|
Immich's upload folder holds subdirs `library/ upload/ thumbs/ encoded-video/ profile/ backups/`. Move (not copy, if same filesystem) the contents of `<UPLOAD_LOCATION>` into `/var/lib/immich`:
|
||||||
|
Run: `sudo rsync -aHAX --info=progress2 <UPLOAD_LOCATION>/ /var/lib/immich/`
|
||||||
|
(Use `rsync` — safe if partially interrupted. Keep the source until Task 6 sign-off.)
|
||||||
|
|
||||||
|
- [ ] **Step 4: Fix ownership**
|
||||||
|
|
||||||
|
Run: `sudo chown -R immich:immich /var/lib/immich`
|
||||||
|
Expected: everything under `/var/lib/immich` owned by `immich`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 5: Start and verify (operator-run)
|
||||||
|
|
||||||
|
**Files:** none. Run on jupiter.
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: migrated DB + media from Task 4.
|
||||||
|
- Produces: a running, verified native Immich.
|
||||||
|
|
||||||
|
- [ ] **Step 1: Start the server and watch logs**
|
||||||
|
|
||||||
|
Run: `sudo systemctl start immich-server && journalctl -u immich-server -f`
|
||||||
|
Expected: it connects to the DB, runs same-version startup checks (no destructive migration since 2.7.5==2.7.5), and reports listening on 2283. Leave the follow running through the next step.
|
||||||
|
|
||||||
|
- [ ] **Step 2: Start machine-learning**
|
||||||
|
|
||||||
|
Run: `sudo systemctl start immich-machine-learning`
|
||||||
|
Expected: active, no crash loop in `journalctl -u immich-machine-learning`.
|
||||||
|
|
||||||
|
- [ ] **Step 3: Functional spot-check in the web UI**
|
||||||
|
|
||||||
|
At `http://jupiter:2283`: log in with an existing account; confirm the timeline loads; open an **album**; open the **People/faces** view; open a **shared link**; open one photo so a **thumbnail and its full original both load** (this proves DB↔file paths align after the media move).
|
||||||
|
Expected: all present, images render.
|
||||||
|
|
||||||
|
- [ ] **Step 4: Confirm homepage dashboard tile**
|
||||||
|
|
||||||
|
Open the homepage dashboard; confirm the Immich tile appears under "Media" and links to `http://jupiter:2283`.
|
||||||
|
|
||||||
|
- [ ] **Step 5: Enable and verify hardware transcoding**
|
||||||
|
|
||||||
|
In Immich **Administration → Settings → Video Transcoding**, set hardware acceleration to **Quick Sync** (QSV) (or VAAPI). Trigger a transcode (upload/play a video that needs transcoding, or run the transcoding job). Then:
|
||||||
|
Run: `journalctl -u immich-server | grep -iE 'qsv|vaapi|hwaccel|transcode'`
|
||||||
|
Expected: log shows the hardware path in use, not a CPU-fallback error. Confirm `/dev/dri/renderD128` is accessible to the service (the `video`/`render` groups + `accelerationDevices` from Task 1 handle this).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Task 6: Sign-off and cleanup (operator-run)
|
||||||
|
|
||||||
|
**Files:** none in repo. Merge the branch; then, only after a confidence window, remove docker.
|
||||||
|
|
||||||
|
**Interfaces:**
|
||||||
|
- Consumes: a verified running instance (Task 5).
|
||||||
|
|
||||||
|
- [ ] **Step 1: Merge the feature branch**
|
||||||
|
|
||||||
|
Open a PR from `feat/immich-nixos-module` into `main` and merge it (repo convention: PRs via the Gitea remote).
|
||||||
|
|
||||||
|
- [ ] **Step 2: Confidence window**
|
||||||
|
|
||||||
|
Use Immich normally for a few days. Keep the docker `<UPLOAD_LOCATION>` source copy and `~/immich-db.sql` untouched as the rollback path.
|
||||||
|
|
||||||
|
- [ ] **Step 3: Rollback (only if needed, before cleanup)**
|
||||||
|
|
||||||
|
If something is wrong: `sudo systemctl stop immich-server immich-machine-learning`, set `immich.enable = false` (or check out the pre-migration commit), `sudo nixos-rebuild switch --flake '.#jupiter'`, then `docker compose up -d` in the old stack. Original docker DB + upload folder are intact until Step 4.
|
||||||
|
|
||||||
|
- [ ] **Step 4: Cleanup (after sign-off)**
|
||||||
|
|
||||||
|
Remove the docker Immich stack (`docker compose down --rmi all --volumes` in the old dir if the DB volume is dedicated — verify first), delete the now-duplicated `<UPLOAD_LOCATION>` source, and remove `~/immich-db.sql`. Optionally disable the `docker` profile on jupiter if Immich was its only consumer (check other services first — jupiter's `docker.enable` may still be needed).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Self-Review
|
||||||
|
|
||||||
|
**Spec coverage:**
|
||||||
|
- Native `services.immich` → Task 1. ✓
|
||||||
|
- Version target 2.7.5==stable, no override → Global Constraints + Task 2 Step 1. ✓
|
||||||
|
- Media at default `/var/lib/immich` → Task 1 + Task 4 Step 3. ✓
|
||||||
|
- DB migrate keep-everything → Tasks 2–4. ✓
|
||||||
|
- HW transcoding only → Task 1 (`accelerationDevices`, groups) + Task 5 Step 5. ✓
|
||||||
|
- LAN+VPN, port 2283, openFirewall, homepage tile → Task 1 + Task 5 Steps 3–4. ✓
|
||||||
|
- Rollback path → Task 6 Step 3. ✓
|
||||||
|
- Deferred (OpenVINO/NAS/proxy) → correctly absent. ✓
|
||||||
|
|
||||||
|
**Placeholder scan:** No TBD/TODO; every command is concrete. Placeholders like `<db-container>`, `<UPLOAD_LOCATION>`, `<POSTGRES_USER>` are runtime values the operator reads in Task 2 Step 1 — intentional, not gaps.
|
||||||
|
|
||||||
|
**Type consistency:** Option name `my.profiles.immich.enable` and path `/var/lib/immich` used consistently across all tasks. Media subfolder list matches between Task 4 Step 3 and the spec.
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
# Intel Quick Sync hardware transcoding for Jellyfin on jupiter
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
Jellyfin streams stutter on jupiter whenever a client needs a transcode
|
||||||
|
(unsupported codec/container, bitrate cap, or a client that can't
|
||||||
|
direct-play). Transcoding currently runs entirely on CPU.
|
||||||
|
|
||||||
|
jupiter's Intel iGPU is already usable at the OS level:
|
||||||
|
|
||||||
|
- `hardware.graphics.enable = true` with `intel-media-driver` (the `iHD`
|
||||||
|
VAAPI driver) is configured in
|
||||||
|
`machines/jupiter/hardware-configuration.nix:20-27`.
|
||||||
|
- The commented-out `i915.force_probe = "9a49"` kernel param there
|
||||||
|
corresponds to a Quick-Sync-capable Intel UHD iGPU, confirming the
|
||||||
|
hardware supports it.
|
||||||
|
|
||||||
|
But `modules/environments/jellyfin/default.nix` never grants the
|
||||||
|
`jellyfin` systemd service access to `/dev/dri`, so Jellyfin has no path
|
||||||
|
to the GPU and silently falls back to software transcoding.
|
||||||
|
|
||||||
|
## Goal
|
||||||
|
|
||||||
|
Give the Jellyfin service access to the iGPU's VAAPI render node, so
|
||||||
|
Quick Sync can be enabled in Jellyfin's own dashboard and transcodes are
|
||||||
|
offloaded from the CPU.
|
||||||
|
|
||||||
|
## Non-goals
|
||||||
|
|
||||||
|
- Remote/external access or reverse-proxy tuning.
|
||||||
|
- General CPU/RAM headroom review of jupiter.
|
||||||
|
- A toggle option (`my.profiles.jellyfin.hardwareAcceleration.enable`) —
|
||||||
|
jupiter only has the one iGPU, so this is hardcoded on rather than
|
||||||
|
made configurable.
|
||||||
|
|
||||||
|
## Design
|
||||||
|
|
||||||
|
### NixOS change (declarative)
|
||||||
|
|
||||||
|
In `modules/environments/jellyfin/default.nix`, inside the existing
|
||||||
|
`config = lib.mkIf cfg.enable { ... }` block, grant the systemd service
|
||||||
|
supplementary access to the `video` and `render` groups (the groups that
|
||||||
|
own `/dev/dri/card*` and `/dev/dri/renderD*`):
|
||||||
|
|
||||||
|
```nix
|
||||||
|
systemd.services.jellyfin.serviceConfig.SupplementaryGroups = [
|
||||||
|
"video"
|
||||||
|
"render"
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
This is additive to the existing `systemd.services.jellyfin.after = [
|
||||||
|
"network-online.target" ];` block already in the file — both apply to
|
||||||
|
the same service.
|
||||||
|
|
||||||
|
Also add `libva-utils` to `environment.systemPackages` (or scoped to
|
||||||
|
this module) so `vainfo` is available on jupiter to verify the driver
|
||||||
|
loads correctly.
|
||||||
|
|
||||||
|
### Manual step (not declarative)
|
||||||
|
|
||||||
|
Jellyfin stores its transcoding/hardware-acceleration choice in its own
|
||||||
|
internal `encoding.xml`, which the NixOS module does not expose as an
|
||||||
|
option. After deploying the Nix change, one-time manual configuration in
|
||||||
|
the Jellyfin dashboard is required:
|
||||||
|
|
||||||
|
1. **Dashboard → Playback**.
|
||||||
|
2. Hardware acceleration: **Intel QuickSync (QSV)**.
|
||||||
|
3. VA-API device: `/dev/dri/renderD128`.
|
||||||
|
4. Enable hardware decoding for the codecs your library actually uses
|
||||||
|
(H264 at minimum; HEVC/VP9 depending on iGPU generation).
|
||||||
|
5. If any HDR content exists in the library, enable tone-mapping — this
|
||||||
|
is one of the more CPU-expensive operations Quick Sync can offload.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
Build-time (from the Mac, no SSH needed):
|
||||||
|
|
||||||
|
```
|
||||||
|
nix eval '.#nixosConfigurations.jupiter.config.systemd.services.jellyfin.serviceConfig.SupplementaryGroups' \
|
||||||
|
--extra-experimental-features 'nix-command flakes'
|
||||||
|
```
|
||||||
|
|
||||||
|
Expect `[ "video" "render" ]`.
|
||||||
|
|
||||||
|
On jupiter after `sudo nixos-rebuild switch --flake '.#jupiter'`:
|
||||||
|
|
||||||
|
```
|
||||||
|
systemctl status jellyfin
|
||||||
|
journalctl -u jellyfin -n 50 --no-pager
|
||||||
|
vainfo
|
||||||
|
```
|
||||||
|
|
||||||
|
`vainfo` should list the `iHD` driver and print supported VAEntrypoints
|
||||||
|
(VLD decode / encode profiles for H264/HEVC).
|
||||||
|
|
||||||
|
Functional check: play a file on a client that forces transcoding (or
|
||||||
|
force it manually via Jellyfin's playback quality setting), then in
|
||||||
|
Jellyfin's dashboard **Activity/Now Playing** panel confirm the
|
||||||
|
transcode reason and check that CPU usage on jupiter (`htop`) stays low
|
||||||
|
during playback rather than pegging a core — Quick Sync offload should
|
||||||
|
show up as low CPU, some GPU (`intel_gpu_top`) activity instead.
|
||||||
|
|
||||||
|
## Open items
|
||||||
|
|
||||||
|
- Exact supported codec list depends on the iGPU generation (device ID
|
||||||
|
`9a49`) — confirm via `vainfo` output once run, and enable only the
|
||||||
|
hardware decode paths it actually reports.
|
||||||
|
|
||||||
|
## Post-deploy fix: two additional runtime packages required
|
||||||
|
|
||||||
|
After the initial deploy (Task 1's `SupplementaryGroups` grant) and
|
||||||
|
enabling QSV in the dashboard, HEVC HDR playback hung indefinitely
|
||||||
|
(Direct Play worked for some titles; titles that needed a real
|
||||||
|
transcode+tonemap never produced output). Root-caused via
|
||||||
|
`journalctl -u jellyfin` and the per-session ffmpeg transcode log
|
||||||
|
(`find / -xdev -iname '*ffmpeg-transcode*'`) — two separate runtimes
|
||||||
|
were missing beyond `intel-media-driver` (which only provides VAAPI):
|
||||||
|
|
||||||
|
1. **QSV session creation failed:** `Error creating a MFX session: -9`
|
||||||
|
/ `Error initializing an MFX session: -3` on
|
||||||
|
`-init_hw_device qsv=qs@va`. VAAPI and QSV are separate runtimes on
|
||||||
|
Linux — QSV needs the oneVPL/MFX GPU implementation. Fix: added
|
||||||
|
`pkgs.vpl-gpu-rt` ("oneAPI Video Processing Library Intel GPU
|
||||||
|
implementation"; note `onevpl-intel-gpu` is the old, renamed
|
||||||
|
attribute) to `hardware.graphics.extraPackages` in
|
||||||
|
`machines/jupiter/hardware-configuration.nix`.
|
||||||
|
|
||||||
|
2. **OpenCL device creation failed:** `Failed to get number of OpenCL
|
||||||
|
platforms: -1001` (`CL_PLATFORM_NOT_FOUND_KHR`) on
|
||||||
|
`-init_hw_device opencl=ocl@va`. The `tonemap_opencl` filter jellyfin
|
||||||
|
uses for HDR→SDR tone-mapping needs a working OpenCL ICD, which
|
||||||
|
nothing installed so far provides. Fix: added
|
||||||
|
`pkgs.intel-compute-runtime` ("Intel Graphics Compute Runtime oneAPI
|
||||||
|
Level Zero and OpenCL, supporting 12th Gen and newer" — matches
|
||||||
|
jupiter's Tiger Lake/Xe iGPU) to the same `extraPackages` list.
|
||||||
|
|
||||||
|
Confirmed working end-to-end: HEVC HDR transcode with QSV encode +
|
||||||
|
OpenCL tone-map runs at `speed=2.68x` realtime on jupiter's iGPU, and
|
||||||
|
plays smoothly on Apple TV (JellyTV app).
|
||||||
|
|
||||||
|
Both packages live in `machines/jupiter/hardware-configuration.nix`
|
||||||
|
(`hardware.graphics.extraPackages`), alongside `intel-media-driver`,
|
||||||
|
rather than in the jellyfin module itself — they're iGPU runtime
|
||||||
|
capabilities, not something specific to the jellyfin service.
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
# Immich: Docker → NixOS module migration
|
||||||
|
|
||||||
|
**Date:** 2026-08-05
|
||||||
|
**Machine:** jupiter (home server, Intel iGPU)
|
||||||
|
**Status:** Design approved, pending implementation plan
|
||||||
|
|
||||||
|
## Goal
|
||||||
|
|
||||||
|
Replace the existing docker-compose Immich deployment on jupiter with the
|
||||||
|
native `services.immich` NixOS module, wrapped in the repo's standard
|
||||||
|
`my.profiles.*` pattern. Preserve all existing data (albums, faces, shared
|
||||||
|
links, metadata) and photo/video library.
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
| Topic | Decision |
|
||||||
|
|-------|----------|
|
||||||
|
| Approach | Native `services.immich` (nixpkgs), not `oci-containers` |
|
||||||
|
| Version target | **Resolved: docker runs 2.7.5 == stable nixpkgs 2.7.5.** Use the stable module as-is; no `package` override. Same-version restore, no forward schema migration |
|
||||||
|
| Media location | Default local path `/var/lib/immich`. NAS deferred to a future read-only external library |
|
||||||
|
| Database | Migrate via dump/restore — keep everything |
|
||||||
|
| HW acceleration | Video transcoding only (VAAPI/QSV via existing Intel graphics stack). ML on CPU |
|
||||||
|
| Access | LAN + VPN only: open port 2283, register on homepage dashboard. No reverse proxy/TLS |
|
||||||
|
|
||||||
|
### Deliberately deferred (YAGNI)
|
||||||
|
- OpenVINO ML acceleration
|
||||||
|
- NAS-backed external library
|
||||||
|
- Reverse proxy / TLS / public hostname
|
||||||
|
|
||||||
|
## Part 1 — The module
|
||||||
|
|
||||||
|
New file `modules/environments/immich/default.nix` following the profile
|
||||||
|
pattern; add `./environments/immich` to `modules/environments/default.nix`;
|
||||||
|
enable `my.profiles.immich.enable = true` in
|
||||||
|
`machines/jupiter/environments.nix`.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.my.profiles.immich;
|
||||||
|
hostName = config.networking.hostName;
|
||||||
|
port = 2283;
|
||||||
|
in {
|
||||||
|
options.my.profiles.immich.enable = lib.mkEnableOption "Immich photo server";
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.immich = {
|
||||||
|
enable = true;
|
||||||
|
# package = pkgs.unstable.immich; # only if docker :release is > 2.7.5
|
||||||
|
host = "0.0.0.0";
|
||||||
|
inherit port;
|
||||||
|
openFirewall = true;
|
||||||
|
mediaLocation = "/var/lib/immich";
|
||||||
|
machine-learning.enable = true;
|
||||||
|
accelerationDevices = [ "/dev/dri/renderD128" ];
|
||||||
|
settings.server.externalDomain = "http://${hostName}:${toString port}";
|
||||||
|
};
|
||||||
|
|
||||||
|
# native module does not add GPU groups; needed for VAAPI/QSV transcoding
|
||||||
|
users.users.immich.extraGroups = [ "video" "render" ];
|
||||||
|
|
||||||
|
my.homepage.services = [{
|
||||||
|
group = "Media";
|
||||||
|
name = "Immich";
|
||||||
|
description = "Photo & video server";
|
||||||
|
href = "http://${hostName}:${toString port}";
|
||||||
|
icon = "immich.png";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Provided for free by the native module:** local PostgreSQL with the required
|
||||||
|
vector extension over a **unix socket + peer auth** (so no DB password / sops
|
||||||
|
secret needed), Redis, `immich-server` and `immich-machine-learning` systemd
|
||||||
|
units, the `immich` system user, and `mediaLocation` created via tmpfiles.
|
||||||
|
|
||||||
|
**Transcoding is two parts:** (a) NixOS exposes the GPU device + `video`/`render`
|
||||||
|
groups (above); (b) the hwaccel backend (QSV/VAAPI) is chosen in Immich's
|
||||||
|
**admin → video transcoding** settings after cutover — a UI toggle, not Nix.
|
||||||
|
|
||||||
|
## Part 2 — Migration runbook (on jupiter)
|
||||||
|
|
||||||
|
### Pre-flight (hard blocker)
|
||||||
|
1. Get running docker Immich version (`docker exec <server> immich --version` or web UI footer).
|
||||||
|
2. **Resolved 2026-08-05: running version is 2.7.5, equal to stable nixpkgs.**
|
||||||
|
Use the stable module as-is (no `package` override). Kept for reference:
|
||||||
|
- running ≤ 2.7.5 → stable module as-is ← **this case**
|
||||||
|
- 2.7.6–3.0.3 → set `package = pkgs.unstable.immich`
|
||||||
|
- `> 3.0.3` → bump nixpkgs first; **stop and re-plan**
|
||||||
|
3. Record docker `UPLOAD_LOCATION` and DB container name/credentials.
|
||||||
|
|
||||||
|
### Backup (before touching anything)
|
||||||
|
4. `docker compose down` (DB may stay up for the dump).
|
||||||
|
5. Dump DB: `docker exec -t <db> pg_dumpall --clean --if-exists --username=postgres > immich-db.sql`
|
||||||
|
6. Verify upload folder intact; note size (no copy yet).
|
||||||
|
|
||||||
|
### Cutover
|
||||||
|
7. Add the module to jupiter's `environments.nix` (leave `database.createDB` default).
|
||||||
|
8. `sudo nixos-rebuild switch --flake '.#jupiter'` → creates user, empty DB + role, `mediaLocation`. Then `systemctl stop immich-server immich-machine-learning`.
|
||||||
|
9. Restore the DB into the NixOS Postgres (drop the freshly-created empty `immich` DB, load `immich-db.sql`) per Immich's restore docs.
|
||||||
|
10. Move media into `/var/lib/immich` (subfolders `library/`, `upload/`, `thumbs/`, `encoded-video/`, `profile/`); `chown -R immich:immich /var/lib/immich`.
|
||||||
|
11. `systemctl start immich-server`; it runs schema migrations forward. Watch `journalctl -u immich-server -f`.
|
||||||
|
|
||||||
|
### Verify
|
||||||
|
12. UI at `http://jupiter:2283` loads; log in; spot-check albums, faces, a shared link, and that thumbnails/originals actually load.
|
||||||
|
13. Homepage tile works.
|
||||||
|
14. Enable QSV/VAAPI in admin settings; transcode one video; confirm `journalctl` shows the hw path, not a CPU fallback error.
|
||||||
|
|
||||||
|
### Rollback
|
||||||
|
Before deleting any docker data: `systemctl stop immich-*`, disable the profile,
|
||||||
|
`nixos-rebuild switch`, `docker compose up -d`. Original docker DB + upload
|
||||||
|
folder remain untouched until explicitly removed after a few days of confidence.
|
||||||
|
|
||||||
|
## Known risk — RESOLVED
|
||||||
|
|
||||||
|
The main risk was step 9 crossing the **pgvecto.rs → VectorChord** vector-extension
|
||||||
|
boundary. With source and target both at **2.7.5**, both use VectorChord — no
|
||||||
|
boundary crossing and no forward schema migration. The restore is a same-version
|
||||||
|
dump/load. Residual risk is limited to routine dump/restore mechanics
|
||||||
|
(roles, extension availability in the NixOS Postgres, ownership on restore).
|
||||||
Generated
+54
-38
@@ -21,11 +21,11 @@
|
|||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778716662,
|
"lastModified": 1785627969,
|
||||||
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
"narHash": "sha256-4dtXQk/NMePegK/nWp5NSeuZKLATItOq61lpEvmXqGw=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
"rev": "427bf4bd9435fdf21321c8cc628c24efc14c0f7a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -42,11 +42,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1778716662,
|
"lastModified": 1782949081,
|
||||||
"narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=",
|
"narHash": "sha256-vp6Y/Grm98ESt6ceOkWiHWyZRDV3J1RID4w+6NWK9yA=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb",
|
"rev": "17c9d6cdfc60c64f4ee8d306f9bc0b4ccb51481e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -60,20 +60,17 @@
|
|||||||
"flake-compat": [
|
"flake-compat": [
|
||||||
"nix"
|
"nix"
|
||||||
],
|
],
|
||||||
"gitignore": [
|
|
||||||
"nix"
|
|
||||||
],
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nix",
|
"nix",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1781733627,
|
"lastModified": 1783008725,
|
||||||
"narHash": "sha256-U3yTuGBnmXvXoQI3qkpfEDsn9RovQPAjN7ndRco+3u0=",
|
"narHash": "sha256-jGiy6+sxjNWXSjp25uoJuNfyH9zBK1PEDY0lVoL4ibQ=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "git-hooks.nix",
|
"repo": "git-hooks.nix",
|
||||||
"rev": "3bbec39bc90eadfa031e6f3b77272f3f60803e39",
|
"rev": "bca82caa46d5ec0f5d422c61fb1e30bc51313cbe",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -92,11 +89,11 @@
|
|||||||
"nixpkgs-regression": "nixpkgs-regression"
|
"nixpkgs-regression": "nixpkgs-regression"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1782211048,
|
"lastModified": 1787274306,
|
||||||
"narHash": "sha256-WKITtytZtfU6m24eK/WVI0QHZpHv4VtTpDCR3414Q70=",
|
"narHash": "sha256-Qg9f9td5iphUWSQS6zmvyZWO1F+D7j8Z3U6dGyUTg08=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nix",
|
"repo": "nix",
|
||||||
"rev": "cdf3b417b272ce2c1de41445378c17f4bebf6fb6",
|
"rev": "649e823fb24ed118d72e613be35fa8ea1b64afe7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -146,11 +143,11 @@
|
|||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1782166108,
|
"lastModified": 1787144466,
|
||||||
"narHash": "sha256-/EtnQBcKbsaCAGQ5VRcplrHRkR4ryqyLMpBfkVuG9Xw=",
|
"narHash": "sha256-HHfv2/HkNSKbbSyU9iD/g8lbP6r4tl33sSw1W4rXCk0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "875776f0252fcb8618bb948640a0d1f7a5b362be",
|
"rev": "0471accf8d0a8210b31d947497d179ecc99e0021",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -161,11 +158,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1780902259,
|
"lastModified": 1783148766,
|
||||||
"narHash": "sha256-YMnBf9lk/LYgvqfmSSJuOGigtRs5Lsy26pJHVlR9yMY=",
|
"narHash": "sha256-H9+N+GFtsbVC8ZniHliChM7ndizxtqVZs6bnGOLM3WQ=",
|
||||||
"rev": "bd0ff2d3eac24699c3664d5966b9ef36f388e2ca",
|
"rev": "a50de1b7d8a586adc18d2395c19de7d6058e6030",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.1550.bd0ff2d3eac2/nixexprs.tar.xz"
|
"url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.4193.a50de1b7d8a5/nixexprs.tar.xz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
@@ -190,11 +187,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1777168982,
|
"lastModified": 1785031560,
|
||||||
"narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=",
|
"narHash": "sha256-OmshNvn2vupOFpYinLUu+1Dnpu4n7Q5N3ggGVNHpkUI=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14",
|
"rev": "0e79af5e3d4dcfcd676ab5ba3f95d2e3352e078c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -221,12 +218,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1781577229,
|
"lastModified": 1787135253,
|
||||||
"narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=",
|
"narHash": "sha256-M5/r2v++FjVhdsxXYMb4BDJ5YLAdCWFt3aZotcshocA=",
|
||||||
"owner": "NixOS",
|
"rev": "ffb3c9b700e759be2ef13237c9d8f953b32a1e46",
|
||||||
"repo": "nixpkgs",
|
"type": "tarball",
|
||||||
"rev": "567a49d1913ce81ac6e9582e3553dd90a955875f",
|
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1058091.ffb3c9b700e7/nixexprs.tar.xz"
|
||||||
"type": "github"
|
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
@@ -249,12 +245,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1782116945,
|
"lastModified": 1787101114,
|
||||||
"narHash": "sha256-G3tw/IXmaH6IQ2upZvhuN9sG8CkuX+BLuJDpE8hz0Ds=",
|
"narHash": "sha256-BA7sSNjLDuPGSOYBGpr6WQjke1MQ8AZpJ8GlYZM/mOc=",
|
||||||
"owner": "NixOS",
|
"rev": "b18a4b905f8d028dc4476412e6d6891728695379",
|
||||||
"repo": "nixpkgs",
|
"type": "tarball",
|
||||||
"rev": "34268251cf5547d39063f2c5ea9a196246f7f3a6",
|
"url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.8045.b18a4b905f8d/nixexprs.tar.xz"
|
||||||
"type": "github"
|
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
@@ -269,7 +264,28 @@
|
|||||||
"nixos-generators": "nixos-generators",
|
"nixos-generators": "nixos-generators",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs_3",
|
"nixpkgs": "nixpkgs_3",
|
||||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
|
"sops-nix": "sops-nix"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sops-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1788337237,
|
||||||
|
"narHash": "sha256-gkSH8VUtCo6hnysNmb9DbTuDepH2t5pv+QWjP75xKAk=",
|
||||||
|
"owner": "Mic92",
|
||||||
|
"repo": "sops-nix",
|
||||||
|
"rev": "fbf759290e0cb0a98dfc813a4eb7d53ad1dacb57",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Mic92",
|
||||||
|
"repo": "sops-nix",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,6 +11,10 @@
|
|||||||
url = "github:nix-community/nixos-generators";
|
url = "github:nix-community/nixos-generators";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
sops-nix = {
|
||||||
|
url = "github:Mic92/sops-nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -36,6 +40,15 @@
|
|||||||
_module.args.pkgs = import inputs.nixpkgs {
|
_module.args.pkgs = import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [
|
||||||
|
sops
|
||||||
|
age
|
||||||
|
ssh-to-age
|
||||||
|
nixfmt
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systems = [ "x86_64-linux" ];
|
systems = [ "x86_64-linux" ];
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ let
|
|||||||
nixpkgs
|
nixpkgs
|
||||||
nixpkgs-unstable
|
nixpkgs-unstable
|
||||||
nixos-hardware
|
nixos-hardware
|
||||||
|
sops-nix
|
||||||
#hyprland
|
#hyprland
|
||||||
;
|
;
|
||||||
nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem;
|
nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem;
|
||||||
@@ -40,6 +41,7 @@ let
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
../modules
|
../modules
|
||||||
|
sops-nix.nixosModules.sops
|
||||||
# ../profiles
|
# ../profiles
|
||||||
];
|
];
|
||||||
defaultModules = baseModules ++ customModules;
|
defaultModules = baseModules ++ customModules;
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
./modules.nix
|
./modules.nix
|
||||||
./network.nix
|
./network.nix
|
||||||
./nix.nix
|
./nix.nix
|
||||||
|
./sops.nix
|
||||||
./users.nix
|
./users.nix
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# sops-nix plumbing — applied to every machine.
|
||||||
|
# See docs/secrets.md for the day-to-day workflow.
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
# Each host defaults to its own secrets/<hostname>.yaml. Override per-secret
|
||||||
|
# with sops.secrets.<name>.sopsFile for shared files.
|
||||||
|
sops.defaultSopsFile = lib.mkDefault (../../secrets + "/${config.networking.hostName}.yaml");
|
||||||
|
sops.defaultSopsFormat = "yaml";
|
||||||
|
sops.validateSopsFiles = true;
|
||||||
|
|
||||||
|
# Decrypt with the host's own SSH host key, converted to age.
|
||||||
|
# Explicit rather than inheriting the openssh-derived default, so this does
|
||||||
|
# not silently break if services.openssh is ever disabled.
|
||||||
|
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||||
|
sops.age.generateKey = false;
|
||||||
|
|
||||||
|
# Age only. The default here is the RSA host key imported as a GPG key,
|
||||||
|
# which is deprecated and an extra failure surface.
|
||||||
|
sops.gnupg.sshKeyPaths = [ ];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
sops
|
||||||
|
age
|
||||||
|
ssh-to-age
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
./disks.nix
|
./disks.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./environments.nix
|
./environments.nix
|
||||||
# ./network.nix
|
./network.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
networking.hostName = "jupiter";
|
networking.hostName = "jupiter";
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
# enabled profiles
|
# enabled profiles
|
||||||
{ config, lib, ... }:
|
_: {
|
||||||
let
|
|
||||||
secrets = config.sops.secrets;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
my.profiles = {
|
my.profiles = {
|
||||||
hyprland.enable = false;
|
hyprland.enable = false;
|
||||||
zsh.enable = true;
|
zsh.enable = true;
|
||||||
@@ -21,6 +17,7 @@ in
|
|||||||
sonarr.enable = true;
|
sonarr.enable = true;
|
||||||
jellyfin.enable = true;
|
jellyfin.enable = true;
|
||||||
jellyseerr.enable = true;
|
jellyseerr.enable = true;
|
||||||
|
immich.enable = true;
|
||||||
development.enable = true;
|
development.enable = true;
|
||||||
home-assistant.enable = true;
|
home-assistant.enable = true;
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
|
#vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
|
||||||
libva-vdpau-driver
|
libva-vdpau-driver
|
||||||
libvdpau-va-gl
|
libvdpau-va-gl
|
||||||
|
vpl-gpu-rt # oneVPL/MFX runtime, required for QSV (h264_qsv/hevc_qsv) session creation
|
||||||
|
intel-compute-runtime # OpenCL runtime, required for tonemap_opencl (HDR tone-mapping)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
./disks.nix
|
./disks.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./environments.nix
|
./environments.nix
|
||||||
|
./network.nix
|
||||||
|
./secrets.nix
|
||||||
# ./system.nix use docker here
|
# ./system.nix use docker here
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -20,7 +22,6 @@
|
|||||||
useOSProber = true;
|
useOSProber = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
# Configure keymap in X11
|
# Configure keymap in X11
|
||||||
services.xserver.xkb = {
|
services.xserver.xkb = {
|
||||||
layout = "de";
|
layout = "de";
|
||||||
@@ -34,7 +35,6 @@
|
|||||||
services.printing.enable = true;
|
services.printing.enable = true;
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
|
||||||
hardware.nvidia.prime = {
|
hardware.nvidia.prime = {
|
||||||
sync.enable = false;
|
sync.enable = false;
|
||||||
|
|
||||||
@@ -44,6 +44,14 @@
|
|||||||
|
|
||||||
services.openssh.enable = true;
|
services.openssh.enable = true;
|
||||||
|
|
||||||
|
# KDE (PowerDevil) power settings: do nothing on lid close while on AC power.
|
||||||
|
# Shipped as a system-wide default; KConfig cascades so a user's own
|
||||||
|
# ~/.config/powerdevilrc will override this if present.
|
||||||
|
environment.etc."xdg/powerdevilrc".text = ''
|
||||||
|
[AC][SuspendAndShutdown]
|
||||||
|
LidAction=0
|
||||||
|
'';
|
||||||
|
|
||||||
system = {
|
system = {
|
||||||
stateVersion = "23.05";
|
stateVersion = "23.05";
|
||||||
autoUpgrade.enable = true;
|
autoUpgrade.enable = true;
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
# enabled profiles
|
# enabled profiles
|
||||||
{ config, lib, ... }:
|
_: {
|
||||||
let
|
|
||||||
secrets = config.sops.secrets;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
my.profiles = {
|
my.profiles = {
|
||||||
kde-desktop.enable = true;
|
kde-desktop.enable = true;
|
||||||
zsh.enable = true;
|
zsh.enable = true;
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
_: {
|
||||||
|
# Athena (local AI): allow LAN access to the Hermes web dashboard.
|
||||||
|
# Bound to 0.0.0.0:9119 in the athena docker stack; NixOS default-deny
|
||||||
|
# firewall otherwise blocks inbound connections from other devices.
|
||||||
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
9119 # athena hermes dashboard
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Secrets decrypted on mibook. sopsFile defaults to secrets/mibook.yaml
|
||||||
|
# via machines/core/sops.nix.
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
# Pipeline smoke test — proves host-key decryption works end to end.
|
||||||
|
# Safe to delete once a real secret is in place.
|
||||||
|
sops.secrets.placeholder = {
|
||||||
|
mode = "0400";
|
||||||
|
owner = "root";
|
||||||
|
group = "root";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
let
|
let
|
||||||
cfg = config.my.profiles.audiobookshelf;
|
cfg = config.my.profiles.audiobookshelf;
|
||||||
hostName = config.networking.hostName;
|
hostName = config.networking.hostName;
|
||||||
|
domain = config.networking.domain;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.profiles.audiobookshelf = with lib; {
|
options.my.profiles.audiobookshelf = with lib; {
|
||||||
@@ -32,7 +33,7 @@ in
|
|||||||
group = "Media";
|
group = "Media";
|
||||||
name = "Audiobookshelf";
|
name = "Audiobookshelf";
|
||||||
description = "Audiobooks and podcasts";
|
description = "Audiobooks and podcasts";
|
||||||
href = "http://${hostName}:63834";
|
href = "http://${domain}:63834";
|
||||||
icon = "audiobookshelf.png";
|
icon = "audiobookshelf.png";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -19,5 +19,6 @@
|
|||||||
./sonarr
|
./sonarr
|
||||||
./jellyfin
|
./jellyfin
|
||||||
./jellyseerr
|
./jellyseerr
|
||||||
|
./immich
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ in
|
|||||||
"otbr"
|
"otbr"
|
||||||
"thread"
|
"thread"
|
||||||
"xiaomi_miio"
|
"xiaomi_miio"
|
||||||
|
"apple_tv" # Apple TV (pyatv); pair via UI PIN flow
|
||||||
|
"tuya" # Tuya/SmartLife cloud; Unistyle WLAN irrigation computer
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
services.home-assistant.config = {
|
services.home-assistant.config = {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
let
|
let
|
||||||
cfg = config.my.profiles.homepage;
|
cfg = config.my.profiles.homepage;
|
||||||
dashboardPort = 8082;
|
dashboardPort = 8082;
|
||||||
dashboardHost = config.networking.hostName;
|
dashboardHost = config.networking.domain;
|
||||||
dashboardUrl = "http://${dashboardHost}:${toString dashboardPort}";
|
dashboardUrl = "http://${dashboardHost}:${toString dashboardPort}";
|
||||||
manualServices = import ./manual-services.nix;
|
manualServices = import ./manual-services.nix;
|
||||||
manualWidgets = import ./manual-widgets.nix;
|
manualWidgets = import ./manual-widgets.nix;
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# Immich self-hosted photo & video server
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.my.profiles.immich;
|
||||||
|
hostName = config.networking.hostName;
|
||||||
|
port = 2283;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.my.profiles.immich = with lib; {
|
||||||
|
enable = mkEnableOption "Immich photo server";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.immich = {
|
||||||
|
enable = true;
|
||||||
|
host = "0.0.0.0";
|
||||||
|
inherit port;
|
||||||
|
openFirewall = true;
|
||||||
|
mediaLocation = "/var/lib/immich";
|
||||||
|
machine-learning.enable = true;
|
||||||
|
accelerationDevices = [ "/dev/dri/renderD128" ];
|
||||||
|
# Setting `settings` puts Immich in config-file mode: the admin settings
|
||||||
|
# UI becomes read-only and system config is managed declaratively here.
|
||||||
|
settings = {
|
||||||
|
server.externalDomain = "http://${hostName}:${toString port}";
|
||||||
|
# Intel Quick Sync hardware transcoding (jupiter's iGPU).
|
||||||
|
ffmpeg.accel = "qsv";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# The native module does not add GPU groups; required for VAAPI/QSV transcoding.
|
||||||
|
users.users.immich.extraGroups = [
|
||||||
|
"video"
|
||||||
|
"render"
|
||||||
|
];
|
||||||
|
|
||||||
|
my.homepage.services = [
|
||||||
|
{
|
||||||
|
group = "Media";
|
||||||
|
name = "Immich";
|
||||||
|
description = "Photo & video server";
|
||||||
|
href = "http://${hostName}:${toString port}";
|
||||||
|
icon = "immich.png";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -22,6 +22,8 @@ in
|
|||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.libva-utils ];
|
||||||
|
|
||||||
my.homepage.services = [
|
my.homepage.services = [
|
||||||
{
|
{
|
||||||
group = "Media";
|
group = "Media";
|
||||||
@@ -34,6 +36,10 @@ in
|
|||||||
|
|
||||||
systemd.services.jellyfin = {
|
systemd.services.jellyfin = {
|
||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
|
serviceConfig.SupplementaryGroups = [
|
||||||
|
"video"
|
||||||
|
"render"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
placeholder: ENC[AES256_GCM,data:tji/6di1F2GsD60TEBGAVvZR9m4jxQ8=,iv:BoBQVR735vq38iGx40VHIpk185ylf79mKmnpewcq/+o=,tag:lXNNk4/HYB0sw44KaQ2KYg==,type:str]
|
||||||
|
sops:
|
||||||
|
age:
|
||||||
|
- enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA4ZUk5cjhGTlVveUFRdHdS
|
||||||
|
elpVV0pZVU54U3plYjNBai9ZZVBxTDhyRFFnCmpGWW81VGJoMnd4eWxCWnovQnFF
|
||||||
|
WXR1MVBTZ3VRUnNMUjI5Rko4NHpBdjQKLS0tIDkxYWNxTmhUS2dYTkFnTWZXaS9V
|
||||||
|
ejdtSmF2M1ZVdFNiWENMWlNraUYxVzAKdlz4xLhTKjJfFESDcym2xCOa71rXj6BE
|
||||||
|
mdeaCDhE11CAXqrpKU+j0/kwTsZRzyqlwQsfeI4ratu1K1vY66ONsw==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
recipient: age1a0v442ct2qfjcdhyktn25spw02yq4fl08plrrvuradwwxzsle4mq8thln4
|
||||||
|
- enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBYT1hRSGt6TDRSMklQNDA3
|
||||||
|
Z2lYS2pMRWxxeEtGRGJSeXRDSlY5UTFBNEZvCm5RK0huT282MXpwWjdrTHByY3Ev
|
||||||
|
bTBMczR1MzVEcnNDVUxadlREbGg3UUUKLS0tIHhydUlmRExkbmNNNkVTcW1OSnpZ
|
||||||
|
aEtLZkRTRE9GZ0I1bEN0ZEl3RjVMeDgKoCY7NyxFMS+WuBUez2Irf91Xuy9QpM5g
|
||||||
|
RTmhK6mw2wd8oUMdgPOUESNwh1xkCz4hDHPrDQnfd4sPhSAvh28jwg==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
recipient: age1n3uqtee5ymykrls6k04dznq50cwmj99hw7ny83yxjndt4y2ncf5qhjwa2p
|
||||||
|
lastmodified: "2026-09-08T13:29:12Z"
|
||||||
|
mac: ENC[AES256_GCM,data:YjMMIUdfCl8dkuvtvBZTFIhLwsUjI6iSeN929O4igbwpRTyGVxgLmAMl81YYHJSyEibelT7ZBKiuVVnL2KjLvAKTj3H1O+AQrcAEJDPC9NwPJwbtAIpLl2li5060Kdj4kr8AY+UJ2kHycuS9dg6wPZTLBJcM/YCw0AoVftvzryM=,iv:GEQZF9RvW+MJlMIjn1ToD74RubWMQtCyE5LqW9KQQfA=,tag:NR6u88eBY1asQZM6f45hTw==,type:str]
|
||||||
|
unencrypted_suffix: _unencrypted
|
||||||
|
version: 3.13.3
|
||||||
Reference in New Issue
Block a user