Comments had drifted into multi-paragraph narrative (git commit lineage, debugging stories, restated code) in several hot spots (scripts/deploy, hermes-agent.nix, flake.nix, gitea.nix, headscale.nix). Trim every comment to its load-bearing "why" — gotchas, safety warnings, and non-obvious rationale survive verbatim in substance, just tightened to 1-2 sentences; historical narrative and anything already covered in CLAUDE.md is cut. No code/logic changed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UJqEmY1y3AYX3JoX4Y6b21
97 lines
2.9 KiB
Nix
97 lines
2.9 KiB
Nix
{ lib
|
|
, buildDotnetModule
|
|
, buildNpmPackage
|
|
, importNpmLock
|
|
, dotnetCorePackages
|
|
, glib
|
|
, gtk3
|
|
, webkitgtk_4_1
|
|
, libnotify
|
|
, makeDesktopItem
|
|
, copyDesktopItems
|
|
, wrapGAppsHook3
|
|
, src
|
|
}:
|
|
|
|
# Tome (née AudibleLibrary) — darman's own Photino/.NET desktop app for
|
|
# converting/managing an Audible library. Private repo on our own gitea;
|
|
# `src` is threaded in by the caller from the `tome` flake input rather than
|
|
# fetched here, so this file has no credentials or URL baked in.
|
|
#
|
|
# Two-stage build: the Preact/Vite frontend (Tome.App/ClientApp) is built as
|
|
# its own npm derivation, then copied into the published app's wwwroot.
|
|
# Upstream normally does this via an in-project MSBuild <Exec> npm target,
|
|
# which has no network access in the Nix sandbox — skipped here
|
|
# (-p:SkipNpmBuild=true) in favor of doing it as a proper Nix derivation.
|
|
let
|
|
frontend = buildNpmPackage {
|
|
pname = "tome-frontend";
|
|
version = "0.0.0";
|
|
src = "${src}/Tome.App/ClientApp";
|
|
npmDeps = importNpmLock { npmRoot = "${src}/Tome.App/ClientApp"; };
|
|
npmConfigHook = importNpmLock.npmConfigHook;
|
|
installPhase = ''
|
|
runHook preInstall
|
|
cp -r dist $out
|
|
runHook postInstall
|
|
'';
|
|
};
|
|
in
|
|
buildDotnetModule (finalAttrs: {
|
|
pname = "tome";
|
|
version = "0-unstable";
|
|
|
|
inherit src;
|
|
|
|
projectFile = "Tome.App/Tome.App.csproj";
|
|
nugetDeps = ./tome-deps.json;
|
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_10_0;
|
|
# aspnetcore_10_0, not runtime_10_0: Tome.App's runtimeconfig.json requires
|
|
# both Microsoft.NETCore.App AND Microsoft.AspNetCore.App (Photino hosts a
|
|
# local Kestrel server), and only the aspnetcore bundle ships the latter.
|
|
dotnet-runtime = dotnetCorePackages.aspnetcore_10_0;
|
|
|
|
dotnetFlags = [ "-p:SkipNpmBuild=true" ];
|
|
|
|
executables = [ "Tome.App" ];
|
|
|
|
# buildDotnetModule sets dontWrapGApps = true by default, but wrapGAppsHook3's
|
|
# own wrap step still splices gappsWrapperArgs in when present (same pattern
|
|
# as nixpkgs' libation). Without it XDG_DATA_DIRS/GSETTINGS_SCHEMA_DIR never
|
|
# get set, so GTK/WebKitGTK can't find the icon theme or settings — missing
|
|
# icons, denser default UI font.
|
|
nativeBuildInputs = [ copyDesktopItems wrapGAppsHook3 ];
|
|
|
|
runtimeDeps = [
|
|
# glib: not pulled in via gtk3/webkitgtk's own RPATH here, because the
|
|
# thing that needs it — Photino.Native.so — is a prebuilt binary shipped
|
|
# in the Photino.Native nuget package, not something Nix built/patched.
|
|
glib
|
|
gtk3
|
|
webkitgtk_4_1
|
|
libnotify
|
|
];
|
|
|
|
postInstall = ''
|
|
cp -r ${frontend} $out/lib/${finalAttrs.pname}/wwwroot
|
|
'';
|
|
|
|
desktopItems = [
|
|
(makeDesktopItem {
|
|
name = "tome";
|
|
exec = "Tome.App";
|
|
desktopName = "Tome";
|
|
comment = "Audible library manager";
|
|
categories = [ "AudioVideo" ];
|
|
})
|
|
];
|
|
|
|
meta = {
|
|
description = "Audible library manager (Photino/.NET desktop app)";
|
|
homepage = "https://git.mgaction.town/darman/TOME";
|
|
platforms = [ "x86_64-linux" ];
|
|
mainProgram = "Tome.App";
|
|
};
|
|
})
|