nixos-config/pkgs/commitgpt/default.nix

66 lines
1.4 KiB
Nix
Raw Normal View History

2022-12-05 11:02:12 +01:00
{ lib, pkgs, ... }:
let
nodeEnv = import ./node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript nodejs;
inherit pkgs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
};
nodePkg = import ./node-packages.nix {
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
inherit nodeEnv;
};
inherit (nodePkg) nodeDependencies;
pname = "commitgpt";
2022-12-07 20:26:29 +01:00
version = "1.0.2";
2022-12-05 11:02:12 +01:00
in
pkgs.stdenv.mkDerivation {
inherit pname version;
src = pkgs.fetchFromGitHub {
owner = "RomanHotsiy";
repo = "commitgpt";
2022-12-07 20:26:29 +01:00
rev = "fdb93d495d2a314cef055ea0765f08209701b097";
sha256 = "bmXTPSkeEUw4q8v8Qqm+JvnyDw4jXlJTk7Px04KmOTs=";
2022-12-05 11:02:12 +01:00
};
buildInputs = [ pkgs.nodejs ];
nativeBuildInputs = [ pkgs.makeWrapper ];
buildPhase = ''
runHook preBuild
ln -s ${nodeDependencies}/lib/node_modules ./node_modules
export PATH="${nodeDependencies}/bin:$PATH"
npm run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/lib
cp package.json $out/package.json
cp -r dist $out/dist
chmod +x $out/dist/index.js
ln -s ${nodeDependencies}/lib/node_modules $out/node_modules
ln -s $out/dist/index.js $out/bin/commitgpt
runHook postInstall
'';
meta = with lib; {
description = "";
homepage = "";
license = licenses.mit;
platforms = [ "x86_64-linux" ];
maintainers = [ ];
};
}