Compare commits

..
1 Commits
Author SHA1 Message Date
dckc bb1fbbdc00 build(diigo-cache): ship the docs, and name the commit a build came from
systemctl status's Docs: line now leads to the README, at a profile
path that survives upgrades, and, for a build from a clean tree, to the
commit's source on git.inference.coop. The version ends in the short
rev (-dirty for a dirty tree), and share/doc/diigo-cache/REVISION holds
the full one. pnpmDeps keeps version 0.0.0, so a new commit doesn't
refetch the deps.

Generated-by: Claude Opus 5.5
2026-11-19 14:29:16 -06:00
2 changed files with 21 additions and 3 deletions

No files matched your search

+19 -3
View File
@@ -10,6 +10,12 @@
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
# the commit a build came from; a dirty tree's ends in -dirty
shortRev = self.shortRev or self.dirtyShortRev or "unknown";
# a clean tree's commit, whose source anyone can read; systemctl
# status lists it under Docs:
sourceUrl = lib.optionalString (self ? rev) "https://git.inference.coop/dckc/captoys/src/commit/${self.rev}/diigo-cache";
# nixpkgs has no workerd of its own; wrangler carries a patched one
workerd =
pkgs.runCommand "workerd-${version}" { } ''
@@ -39,7 +45,7 @@
diigo-cache = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "diigo-cache";
version = "0.0.0";
version = "0.0.0-${shortRev}";
inherit src;
sourceRoot = "${finalAttrs.src.name}/diigo-cache";
@@ -50,7 +56,9 @@
pkgs.wrangler
];
pnpmDeps = pkgs.fetchPnpmDeps {
inherit (finalAttrs) pname version src sourceRoot;
inherit (finalAttrs) pname src sourceRoot;
# not the rev: the deps don't change with each commit
version = "0.0.0";
pnpm = pkgs.pnpm_10;
fetcherVersion = 3;
hash = "sha256-sn/juOL2mhyy3i57GCUKA2X8SPyR9FwY4KoxdkgZa0M=";
@@ -82,7 +90,15 @@
EOF
chmod +x $out/bin/diigo-cache-serve
cp ${./nix/diigo-cache.socket} $out/lib/systemd/system/diigo-cache.socket
cp ${./nix/diigo-cache.service} $out/lib/systemd/system/diigo-cache.service
substitute ${./nix/diigo-cache.service} $out/lib/systemd/system/diigo-cache.service \
--replace-fail '@source@' '${sourceUrl}'
# the docs, at a path the profile keeps across upgrades
doc=$out/share/doc/diigo-cache
mkdir -p $doc
cp ${./README.md} $doc/README.md
cp ${./CONTRIBUTING.md} $doc/CONTRIBUTING.md
cp -r ${./doc} $doc/doc
echo ${self.rev or self.dirtyRev or "unknown"} > $doc/REVISION
runHook postInstall
'';
});
+2
View File
@@ -1,5 +1,7 @@
[Unit]
Description=diigo-cache and webapp (workerd)
# the profile's README, and the commit's source (a clean build's only)
Documentation=file:///nix/var/nix/profiles/diigo-cache/share/doc/diigo-cache/README.md @source@
Requires=diigo-cache.socket
[Service]