66 lines
1.4 KiB
Nix
66 lines
1.4 KiB
Nix
|
{ 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";
|
||
|
version = "1.0.1";
|
||
|
in
|
||
|
pkgs.stdenv.mkDerivation {
|
||
|
inherit pname version;
|
||
|
|
||
|
src = pkgs.fetchFromGitHub {
|
||
|
owner = "RomanHotsiy";
|
||
|
repo = "commitgpt";
|
||
|
rev = "f6e524342f35e34faea83ce7046f15d022ff2da8";
|
||
|
sha256 = "Vt5q8/wtbPgaYnjwFdrdgCibgA+RcN6c3/nQpqxwjSA=";
|
||
|
};
|
||
|
|
||
|
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 = [ ];
|
||
|
};
|
||
|
}
|