Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
72 lines
1.8 KiB
Nix
72 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
fetchYarnDeps,
|
|
yarnConfigHook,
|
|
yarnBuildHook,
|
|
yarnInstallHook,
|
|
nodejs,
|
|
nix-update-script,
|
|
runCommand,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "prettierd";
|
|
version = "0.26.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "fsouza";
|
|
repo = "prettierd";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-KvFOvWQZBppvHbvUvGQu39j8aV/pQFwfuqjFQqdb7lI=";
|
|
};
|
|
|
|
offlineCache = fetchYarnDeps {
|
|
yarnLock = finalAttrs.src + "/yarn.lock";
|
|
hash = "sha256-Rf7km2WUODqWu8U8iiHNrb5dMamIm1XCsRnldO71j5A=";
|
|
};
|
|
|
|
strictDeps = true;
|
|
|
|
nativeBuildInputs = [
|
|
yarnConfigHook
|
|
yarnBuildHook
|
|
yarnInstallHook
|
|
nodejs
|
|
];
|
|
|
|
# launch the daemon with the same node version used to run the CLI
|
|
# fixes "Error: spawn node ENOENT" if node isn't available on the user's path
|
|
postInstall = ''
|
|
wrapProgram $out/bin/prettierd \
|
|
--prefix PATH : ${lib.makeBinPath [ nodejs ]}
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
|
|
tests = lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) {
|
|
format =
|
|
runCommand "prettierd-format-file-test" { nativeBuildInputs = [ finalAttrs.finalPackage ]; }
|
|
''
|
|
export HOME=$(mktemp -d)
|
|
prettierd ${finalAttrs.src}/package.json < ${finalAttrs.src}/package.json > $out
|
|
'';
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
mainProgram = "prettierd";
|
|
description = "Prettier, as a daemon, for improved formatting speed";
|
|
homepage = "https://github.com/fsouza/prettierd";
|
|
license = lib.licenses.isc;
|
|
changelog = "https://github.com/fsouza/prettierd/blob/${finalAttrs.src.rev}/CHANGELOG.md";
|
|
platforms = with lib.platforms; linux ++ darwin;
|
|
maintainers = with lib.maintainers; [
|
|
NotAShelf
|
|
n3oney
|
|
];
|
|
};
|
|
})
|