nixos-config/pkgs/pdsadmin/default.nix
2024-12-03 23:41:09 +01:00

60 lines
1.1 KiB
Nix

{
stdenvNoCC,
bash,
pds,
makeBinaryWrapper,
jq,
curl,
openssl,
lib,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "pdsadmin";
inherit (pds) version src;
patches = [ ./pdsadmin-offline.patch ];
buildInputs = [
bash
];
nativeBuildInputs = [
makeBinaryWrapper
];
buildPhase = ''
runHook preBuild
substituteInPlace pdsadmin.sh \
--replace-fail NIXPKGS_PDSADMIN_ROOT $out
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/lib/pds
install -Dm755 pdsadmin.sh $out/lib/pds/
install -Dm755 pdsadmin/*.sh $out/lib/pds/
makeBinaryWrapper "$out/lib/pds/pdsadmin.sh" "$out/bin/pdsadmin" \
--prefix PATH : "${
lib.makeBinPath [
jq
curl
openssl
]
}"
runHook postInstall
'';
meta = {
description = "Admin scripts for Bluesky Personal Data Server (PDS)";
inherit (pds.meta) homepage license;
maintainers = with lib.maintainers; [ t4ccer ];
platforms = lib.platforms.unix;
mainProgram = "pdsadmin";
};
})