Files
nixpkgs/pkgs/by-name/gp/gpt2tc/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

57 lines
1.4 KiB
Nix

{
lib,
stdenv,
fetchurl,
autoPatchelfHook,
python3,
}:
stdenv.mkDerivation {
pname = "gpt2tc";
version = "2021-04-24";
src = fetchurl {
url = "https://web.archive.org/web/20220603034455/https://bellard.org/libnc/gpt2tc-2021-04-24.tar.gz";
hash = "sha256-6oTxnbBwjHAXVrWMjOQVwdODbqLRoinx00pi29ff5w0=";
};
patches = [
# Add a shebang to the python script so that nix detects it as such and
# wraps it properly. Otherwise, it runs in shell and freezes the system.
./0001-add-python-shebang.patch
];
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
(python3.withPackages (
p: with p; [
numpy
tensorflow
]
))
];
installPhase = ''
runHook preInstall
install -D -m755 -t $out/lib libnc${stdenv.hostPlatform.extensions.sharedLibrary}
addAutoPatchelfSearchPath $out/lib
install -D -m755 -t $out/bin gpt2tc
install -T -m755 download_model.sh $out/bin/gpt2-download-model
install -T -m755 gpt2convert.py $out/bin/gpt2-convert
install -D -m644 -t $out/share/gpt2tc readme.txt gpt2vocab.txt Changelog
runHook postInstall
'';
meta = with lib; {
description = "Text completion and compression using GPT-2";
homepage = "https://bellard.org/libnc/gpt2tc.html";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ anna328p ];
};
}