2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, mkYarnPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, nodejs
|
|
|
|
, fetchYarnDeps
|
|
|
|
,
|
|
|
|
}:
|
|
|
|
mkYarnPackage rec {
|
|
|
|
pname = "prettierd";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.25.1";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fsouza";
|
|
|
|
repo = "prettierd";
|
|
|
|
rev = "v${version}";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-aoRfZ9SJazz0ir1fyHypn3aYqK9DJOLLVPMuFcOm/20=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
offlineCache = fetchYarnDeps {
|
|
|
|
yarnLock = src + "/yarn.lock";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-HsWsRIONRNY9akZ2LXlWcPhH6N5qCKnesaDX1gQp+NU=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
yarn --offline build
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
# prettierd needs to be wrapped with nodejs so that it can be executed
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram "$out/bin/prettierd" --prefix PATH : "${nodejs}/bin"
|
|
|
|
'';
|
|
|
|
|
|
|
|
doDist = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2023-08-04 22:07:22 +00:00
|
|
|
mainProgram = "prettierd";
|
2023-07-15 17:15:38 +00:00
|
|
|
description = "Prettier, as a daemon, for improved formatting speed";
|
|
|
|
homepage = "https://github.com/fsouza/prettierd";
|
|
|
|
license = licenses.isc;
|
|
|
|
changelog = "https://github.com/fsouza/prettierd/blob/${src.rev}/CHANGELOG.md";
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
|
|
|
maintainers = with maintainers; [ NotAShelf n3oney ];
|
|
|
|
};
|
|
|
|
}
|