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
This commit is contained in:
1 parent
3c4915f5ad
commit
bb1fbbdc00
2 files changed
+21
-3
No files matched your search
+19
-3
@@ -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
|
||||
'';
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user