Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / by-name / gi / gitmoji-cli / package.nix
blob7787bd4ccf81961d33dcc2760cf34fb6a21a0397
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchYarnDeps
5 , makeWrapper
6 , nodejs
7 , prefetch-yarn-deps
8 , yarn
9 }:
11 stdenv.mkDerivation (finalAttrs: {
12   pname = "gitmoji-cli";
13   version = "9.0.0";
15   src = fetchFromGitHub {
16     owner = "carloscuesta";
17     repo = "gitmoji-cli";
18     rev = "v${finalAttrs.version}";
19     hash = "sha256-cIc0AaP1AwhoVJLnonC9qvDWNZW4L6/jsQ3Q6z5VXI0=";
20   };
22   offlineCache = fetchYarnDeps {
23     yarnLock = "${finalAttrs.src}/yarn.lock";
24     hash = "sha256-HXMRCTiUti/GZ1dzd+XbFOao3+QLC1t7H0TT9MS5lz4=";
25   };
27   nativeBuildInputs = [
28     makeWrapper
29     nodejs
30     prefetch-yarn-deps
31     yarn
32   ];
34   configurePhase = ''
35     runHook preConfigure
37     export HOME=$(mktemp -d)
38     yarn config --offline set yarn-offline-mirror $offlineCache
39     fixup-yarn-lock yarn.lock
40     yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
41     patchShebangs node_modules
43     runHook postConfigure
44   '';
46   buildPhase = ''
47     runHook preBuild
49     yarn --offline build
51     runHook postBuild
52   '';
54   installPhase = ''
55     runHook preInstall
57     yarn --offline --production install
59     mkdir -p "$out/lib/node_modules/gitmoji-cli"
60     cp -r lib node_modules "$out/lib/node_modules/gitmoji-cli"
62     makeWrapper "${nodejs}/bin/node" "$out/bin/gitmoji" \
63       --add-flags "$out/lib/node_modules/gitmoji-cli/lib/cli.js"
65     runHook postInstall
66   '';
68   meta = {
69     description = "Gitmoji client for using emojis on commit messages";
70     homepage = "https://github.com/carloscuesta/gitmoji-cli";
71     license = lib.licenses.mit;
72     mainProgram = "gitmoji";
73     maintainers = with lib.maintainers; [ nequissimus ];
74   };