Files
homelab/pkgs/tome.nix
T
darmanandClaude Sonnet 5 caab166af8 terra: package Tome, add vivaldi + dotnet dev tools
Tome (née AudibleLibrary) is darman's own Photino/.NET desktop app, private
repo on our own gitea. Fetched as a flake input over ssh with darman's
ambient key — same mechanism as any other git input, private or not.

buildDotnetModule package: the Preact/Vite frontend (Tome.App/ClientApp)
builds as its own buildNpmPackage derivation and gets copied into the
published app's wwwroot, since upstream's in-project MSBuild npm target has
no network access in the Nix sandbox. Photino.Native's runtime deps (gtk3,
webkitgtk_4_1, libnotify) are wrapped in — confirmed via readelf/ldd that
this Photino build already targets webkit2gtk-4.1, not the now-removed 4.0.

Also added dotnet-sdk + nodejs to terra for developing Tome locally, and
vivaldi (unfree, extends the existing allowUnfreePredicate).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-24 00:35:13 +02:00

83 lines
2.1 KiB
Nix

{ lib
, buildDotnetModule
, buildNpmPackage
, importNpmLock
, dotnetCorePackages
, gtk3
, webkitgtk_4_1
, libnotify
, makeDesktopItem
, copyDesktopItems
, 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;
dotnet-runtime = dotnetCorePackages.runtime_10_0;
dotnetFlags = [ "-p:SkipNpmBuild=true" ];
executables = [ "Tome.App" ];
nativeBuildInputs = [ copyDesktopItems ];
runtimeDeps = [
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";
};
})