Skip to content

Commit

Permalink
prettierd: remove mkYarnPackage usage (NixOS#341902)
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegendeWurst authored Dec 20, 2024
2 parents 3d04b77 + bda399c commit 629b1a1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 69 deletions.
45 changes: 0 additions & 45 deletions pkgs/by-name/pr/prettierd/package.json

This file was deleted.

42 changes: 18 additions & 24 deletions pkgs/by-name/pr/prettierd/package.nix
Original file line number Diff line number Diff line change
@@ -1,55 +1,49 @@
{
lib,
mkYarnPackage,
stdenv,
fetchFromGitHub,
makeWrapper,
nodejs,
fetchYarnDeps,
yarnConfigHook,
yarnBuildHook,
yarnInstallHook,
nodejs,
}:
mkYarnPackage rec {

stdenv.mkDerivation (finalAttrs: {
pname = "prettierd";
version = "0.25.3";

src = fetchFromGitHub {
owner = "fsouza";
repo = "prettierd";
rev = "v${version}";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-3lvFZ5/p+1kPnHIR2PlQtCY3SVo1rs8IuBigLaabxAE=";
};

offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
yarnLock = finalAttrs.src + "/yarn.lock";
hash = "sha256-Ti2b102pzUKB6Xy3LwZ7DlrnW0cRscgNLTUIAKz+6Us=";
};

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"
'';
strictDeps = true;

doDist = false;
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
yarnInstallHook
nodejs
];

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/${src.rev}/CHANGELOG.md";
changelog = "https://github.com/fsouza/prettierd/blob/${finalAttrs.src.rev}/CHANGELOG.md";
platforms = with lib.platforms; linux ++ darwin;
maintainers = with lib.maintainers; [
NotAShelf
n3oney
];
};
}
})

0 comments on commit 629b1a1

Please sign in to comment.