From db373a8c727cad91d375b40a6c70b11ed73bdafb Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 1 Apr 2024 13:30:45 -0400 Subject: Add nixfmt to Lint.hs nixfmt is the soon-to-be official formatter for Nix code, as per the NixOS GitHub group. So I figure I should just adopt it without worrying too much about the specifics of the formatting. I just formatted everything in one go, hence the huge diff, oh well. --- Biz/Bild/Deps/C.nix | 4 +-- Biz/Bild/Deps/accelerate.nix | 12 ++------ Biz/Bild/Deps/autogen.nix | 61 +++++++++++++++++++++------------------- Biz/Bild/Deps/bitsandbytes.nix | 48 ++++++++++++------------------- Biz/Bild/Deps/exllama.nix | 20 ++++--------- Biz/Bild/Deps/guile-opengl.nix | 10 +------ Biz/Bild/Deps/inspekt3d.nix | 14 ++------- Biz/Bild/Deps/interegular.nix | 11 ++------ Biz/Bild/Deps/lion-pytorch.nix | 9 ++---- Biz/Bild/Deps/llama-cpp.nix | 12 ++------ Biz/Bild/Deps/nostr-rs-relay.nix | 5 +--- Biz/Bild/Deps/outlines.nix | 23 +++------------ Biz/Bild/Deps/perscache.nix | 22 +++------------ 13 files changed, 77 insertions(+), 174 deletions(-) (limited to 'Biz/Bild/Deps') diff --git a/Biz/Bild/Deps/C.nix b/Biz/Bild/Deps/C.nix index 45cae1b..3f670cd 100644 --- a/Biz/Bild/Deps/C.nix +++ b/Biz/Bild/Deps/C.nix @@ -1,3 +1 @@ -[ - "libsodium" -] +[ "libsodium" ] diff --git a/Biz/Bild/Deps/accelerate.nix b/Biz/Bild/Deps/accelerate.nix index 5d00f14..be1d2fd 100644 --- a/Biz/Bild/Deps/accelerate.nix +++ b/Biz/Bild/Deps/accelerate.nix @@ -1,18 +1,10 @@ -{ fetchFromGitHub -, buildPythonPackage -, numpy -, packaging -, psutil -, pyyaml -, torch +{ fetchFromGitHub, buildPythonPackage, numpy, packaging, psutil, pyyaml, torch }: buildPythonPackage rec { name = "accelerate"; version = "0.15.0"; - propagatedBuildInputs = [ - numpy packaging psutil pyyaml torch - ]; + propagatedBuildInputs = [ numpy packaging psutil pyyaml torch ]; doCheck = false; src = fetchFromGitHub { owner = "huggingface"; diff --git a/Biz/Bild/Deps/autogen.nix b/Biz/Bild/Deps/autogen.nix index b7b034d..fc95b14 100644 --- a/Biz/Bild/Deps/autogen.nix +++ b/Biz/Bild/Deps/autogen.nix @@ -1,5 +1,6 @@ # From: https://github.com/NixOS/nixpkgs/pull/139361 -{ lib, stdenv, buildPackages, fetchurl, fetchpatch, autoreconfHook, which, pkg-config, perl, guile, libxml2 }: +{ lib, stdenv, buildPackages, fetchurl, fetchpatch, autoreconfHook, which +, pkg-config, perl, guile, libxml2 }: stdenv.mkDerivation rec { pname = "autogen"; @@ -11,11 +12,12 @@ stdenv.mkDerivation rec { }; patches = let - dp = { ver ? "1%255.18.16-4", pname, name ? (pname + ".diff"), sha256 }: fetchurl { - url = "https://salsa.debian.org/debian/autogen/-/raw/debian/${ver}" + dp = { ver ? "1%255.18.16-4", pname, name ? (pname + ".diff"), sha256 }: + fetchurl { + url = "https://salsa.debian.org/debian/autogen/-/raw/debian/${ver}" + "/debian/patches/${pname}.diff?inline=false"; - inherit name sha256; - }; + inherit name sha256; + }; in [ (dp { pname = "20_no_Werror"; @@ -33,7 +35,8 @@ stdenv.mkDerivation rec { # patch meanwhile. (fetchpatch { name = "guile-3.patch"; - url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-devel/autogen/files/autogen-5.18.16-guile-3.patch?id=43bcc61c56a5a7de0eaf806efec7d8c0e4c01ae7"; + url = + "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-devel/autogen/files/autogen-5.18.16-guile-3.patch?id=43bcc61c56a5a7de0eaf806efec7d8c0e4c01ae7"; sha256 = "18d7y1f6164dm1wlh7rzbacfygiwrmbc35a7qqsbdawpkhydm5lr"; }) ]; @@ -41,37 +44,37 @@ stdenv.mkDerivation rec { outputs = [ "bin" "dev" "lib" "out" "man" "info" ]; nativeBuildInputs = [ - which pkg-config perl autoreconfHook/*patches applied*/ + which + pkg-config + perl + autoreconfHook # patches applied ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ # autogen needs a build autogen when cross-compiling - buildPackages.buildPackages.autogen buildPackages.texinfo - ]; - buildInputs = [ - guile libxml2 + buildPackages.buildPackages.autogen + buildPackages.texinfo ]; + buildInputs = [ guile libxml2 ]; preConfigure = '' export MAN_PAGE_DATE=$(date '+%Y-%m-%d' -d "@$SOURCE_DATE_EPOCH") ''; - configureFlags = - [ - # Make sure to use a static value for the timeout. If we do not set a value - # here autogen will select one based on the execution time of the configure - # phase which is not really reproducible. - # - # If you are curious about the number 78, it has been cargo-culted from - # Debian: https://salsa.debian.org/debian/autogen/-/blob/master/debian/rules#L21 - "--enable-timeout=78" - ] - ++ (lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "--with-libxml2=${libxml2.dev}" - "--with-libxml2-cflags=-I${libxml2.dev}/include/libxml2" - # the configure check for regcomp wants to run a host program - "libopts_cv_with_libregex=yes" - #"MAKEINFO=${buildPackages.texinfo}/bin/makeinfo" - ]) - # See: https://sourceforge.net/p/autogen/bugs/187/ + configureFlags = [ + # Make sure to use a static value for the timeout. If we do not set a value + # here autogen will select one based on the execution time of the configure + # phase which is not really reproducible. + # + # If you are curious about the number 78, it has been cargo-culted from + # Debian: https://salsa.debian.org/debian/autogen/-/blob/master/debian/rules#L21 + "--enable-timeout=78" + ] ++ (lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "--with-libxml2=${libxml2.dev}" + "--with-libxml2-cflags=-I${libxml2.dev}/include/libxml2" + # the configure check for regcomp wants to run a host program + "libopts_cv_with_libregex=yes" + #"MAKEINFO=${buildPackages.texinfo}/bin/makeinfo" + ]) + # See: https://sourceforge.net/p/autogen/bugs/187/ ++ lib.optionals stdenv.isDarwin [ "ac_cv_func_utimensat=no" ]; #doCheck = true; # not reliable diff --git a/Biz/Bild/Deps/bitsandbytes.nix b/Biz/Bild/Deps/bitsandbytes.nix index b87c0c4..eb32aac 100644 --- a/Biz/Bild/Deps/bitsandbytes.nix +++ b/Biz/Bild/Deps/bitsandbytes.nix @@ -1,16 +1,5 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, python -, pythonOlder -, pytestCheckHook -, setuptools -, torch -, einops -, lion-pytorch -, scipy -, symlinkJoin -}: +{ lib, buildPythonPackage, fetchFromGitHub, python, pythonOlder, pytestCheckHook +, setuptools, torch, einops, lion-pytorch, scipy, symlinkJoin }: let pname = "bitsandbytes"; @@ -31,10 +20,11 @@ let cuda-native-redist = symlinkJoin { name = "cuda-native-redist-${cudaVersion}"; - paths = with cudaPackages; [ - cuda_cudart # cuda_runtime.h cuda_runtime_api.h - cuda_nvcc - ] ++ cuda-common-redist; + paths = with cudaPackages; + [ + cuda_cudart # cuda_runtime.h cuda_runtime_api.h + cuda_nvcc + ] ++ cuda-common-redist; }; cuda-redist = symlinkJoin { @@ -42,8 +32,7 @@ let paths = cuda-common-redist; }; -in -buildPythonPackage { +in buildPythonPackage { inherit pname version; format = "pyproject"; @@ -70,24 +59,23 @@ buildPythonPackage { preBuild = if torch.cudaSupport then with torch.cudaPackages; - let cudaVersion = lib.concatStrings (lib.splitVersion torch.cudaPackages.cudaMajorMinorVersion); in - ''make CUDA_VERSION=${cudaVersion} cuda${cudaMajorVersion}x'' + let + cudaVersion = lib.concatStrings + (lib.splitVersion torch.cudaPackages.cudaMajorMinorVersion); + in "make CUDA_VERSION=${cudaVersion} cuda${cudaMajorVersion}x" else - ''make CUDA_VERSION=CPU cpuonly''; + "make CUDA_VERSION=CPU cpuonly"; - nativeBuildInputs = [ setuptools ] ++ lib.optionals torch.cudaSupport [ cuda-native-redist ]; + nativeBuildInputs = [ setuptools ] + ++ lib.optionals torch.cudaSupport [ cuda-native-redist ]; buildInputs = lib.optionals torch.cudaSupport [ cuda-redist ]; - propagatedBuildInputs = [ - torch - ]; + propagatedBuildInputs = [ torch ]; - doCheck = false; # tests require CUDA and also GPU access + doCheck = false; # tests require CUDA and also GPU access nativeCheckInputs = [ pytestCheckHook einops lion-pytorch scipy ]; - pythonImportsCheck = [ - "bitsandbytes" - ]; + pythonImportsCheck = [ "bitsandbytes" ]; meta = with lib; { homepage = "https://github.com/TimDettmers/bitsandbytes"; diff --git a/Biz/Bild/Deps/exllama.nix b/Biz/Bild/Deps/exllama.nix index 1f7e529..51a05e9 100644 --- a/Biz/Bild/Deps/exllama.nix +++ b/Biz/Bild/Deps/exllama.nix @@ -1,14 +1,6 @@ -{ lib -, sources -, buildPythonPackage -, pythonOlder +{ lib, sources, buildPythonPackage, pythonOlder , torch # tested on 2.0.1 and 2.1.0 (nightly) with cu118 -, safetensors -, sentencepiece -, ninja -, cudaPackages -, addOpenGLRunpath -, which +, safetensors, sentencepiece, ninja, cudaPackages, addOpenGLRunpath, which , gcc11 # cuda 11.7 requires g++ <12 }: @@ -36,12 +28,10 @@ buildPythonPackage rec { cudaPackages.cuda_cudart ]; - propagatedBuildInputs = [ - torch safetensors sentencepiece ninja - cudaPackages.cudatoolkit - ]; + propagatedBuildInputs = + [ torch safetensors sentencepiece ninja cudaPackages.cudatoolkit ]; - doCheck = false; # no tests currently + doCheck = false; # no tests currently pythonImportsCheck = [ "exllama" "exllama.cuda_ext" diff --git a/Biz/Bild/Deps/guile-opengl.nix b/Biz/Bild/Deps/guile-opengl.nix index 34019d5..d547042 100644 --- a/Biz/Bild/Deps/guile-opengl.nix +++ b/Biz/Bild/Deps/guile-opengl.nix @@ -1,12 +1,4 @@ -{ stdenv -, lib -, fetchurl -, pkgconfig -, guile -, libGL -, libGLU -, freeglut -}: +{ stdenv, lib, fetchurl, pkgconfig, guile, libGL, libGLU, freeglut }: let name = "guile-opengl-${version}"; diff --git a/Biz/Bild/Deps/inspekt3d.nix b/Biz/Bild/Deps/inspekt3d.nix index 78393ee..d1cf60e 100644 --- a/Biz/Bild/Deps/inspekt3d.nix +++ b/Biz/Bild/Deps/inspekt3d.nix @@ -1,15 +1,5 @@ -{ stdenv -, lib -, autoreconfHook -, pkgconfig -, guile -, guile-opengl -, mesa -, glibcLocales -, libfive -, sources -}: - +{ stdenv, lib, autoreconfHook, pkgconfig, guile, guile-opengl, mesa +, glibcLocales, libfive, sources }: stdenv.mkDerivation { name = "inspekt3d-unstable"; diff --git a/Biz/Bild/Deps/interegular.nix b/Biz/Bild/Deps/interegular.nix index 8b0bc86..24065d8 100644 --- a/Biz/Bild/Deps/interegular.nix +++ b/Biz/Bild/Deps/interegular.nix @@ -1,7 +1,4 @@ -{ lib -, sources -, buildPythonPackage -}: +{ lib, sources, buildPythonPackage }: buildPythonPackage rec { pname = "interegular"; @@ -12,10 +9,8 @@ buildPythonPackage rec { propagatedBuildInputs = [ ]; - doCheck = false; # no tests currently - pythonImportsCheck = [ - "interegular" - ]; + doCheck = false; # no tests currently + pythonImportsCheck = [ "interegular" ]; meta = with lib; { description = "Allows to check regexes for overlaps."; diff --git a/Biz/Bild/Deps/lion-pytorch.nix b/Biz/Bild/Deps/lion-pytorch.nix index e23011a..7b06e78 100644 --- a/Biz/Bild/Deps/lion-pytorch.nix +++ b/Biz/Bild/Deps/lion-pytorch.nix @@ -1,9 +1,4 @@ -{ lib -, buildPythonPackage -, pythonOlder -, fetchFromGitHub -, torch -}: +{ lib, buildPythonPackage, pythonOlder, fetchFromGitHub, torch }: buildPythonPackage rec { pname = "lion-pytorch"; @@ -21,7 +16,7 @@ buildPythonPackage rec { propagatedBuildInputs = [ torch ]; pythonImportsCheck = [ "lion_pytorch" ]; - doCheck = false; # no tests currently + doCheck = false; # no tests currently meta = with lib; { description = "Optimizer tuned by Google Brain using genetic algorithms"; diff --git a/Biz/Bild/Deps/llama-cpp.nix b/Biz/Bild/Deps/llama-cpp.nix index b247252..2e2aae7 100644 --- a/Biz/Bild/Deps/llama-cpp.nix +++ b/Biz/Bild/Deps/llama-cpp.nix @@ -1,13 +1,5 @@ -{ stdenv -, sources -, python3 -, cmake -, pkgconfig -, openmpi -, cudaPackages -}: -let - llama-python = python3.withPackages (ps: with ps; [ numpy sentencepiece ]); +{ stdenv, sources, python3, cmake, pkgconfig, openmpi, cudaPackages }: +let llama-python = python3.withPackages (ps: with ps; [ numpy sentencepiece ]); in stdenv.mkDerivation { name = "llama.cpp"; version = sources.llama-cpp.rev; diff --git a/Biz/Bild/Deps/nostr-rs-relay.nix b/Biz/Bild/Deps/nostr-rs-relay.nix index bb0a1cd..0eef13f 100644 --- a/Biz/Bild/Deps/nostr-rs-relay.nix +++ b/Biz/Bild/Deps/nostr-rs-relay.nix @@ -13,10 +13,7 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "sha256-3593pjc4A4NsEnE/ZYsR1vSMCvw2ZJue4EIY6cFa2WA="; - nativeBuildInputs = [ - pkg-config - openssl.dev - ]; + nativeBuildInputs = [ pkg-config openssl.dev ]; buildInputs = [ openssl.dev ]; } diff --git a/Biz/Bild/Deps/outlines.nix b/Biz/Bild/Deps/outlines.nix index 013581b..29ef41b 100644 --- a/Biz/Bild/Deps/outlines.nix +++ b/Biz/Bild/Deps/outlines.nix @@ -1,18 +1,5 @@ -{ lib -, sources -, buildPythonPackage -, interegular -, jinja2 -, lark -, numpy -, perscache -, pillow -, pydantic -, regex -, scipy -, tenacity -, torch -}: +{ lib, sources, buildPythonPackage, interegular, jinja2, lark, numpy, perscache +, pillow, pydantic, regex, scipy, tenacity, torch }: buildPythonPackage rec { pname = "outlines"; @@ -35,10 +22,8 @@ buildPythonPackage rec { torch ]; - doCheck = false; # no tests currently - pythonImportsCheck = [ - "outlines" - ]; + doCheck = false; # no tests currently + pythonImportsCheck = [ "outlines" ]; meta = with lib; { description = "Probabilistic Generative Model Programming"; diff --git a/Biz/Bild/Deps/perscache.nix b/Biz/Bild/Deps/perscache.nix index d757e1a..508a261 100644 --- a/Biz/Bild/Deps/perscache.nix +++ b/Biz/Bild/Deps/perscache.nix @@ -1,11 +1,4 @@ -{ lib -, sources -, buildPythonPackage -, beartype -, cloudpickle -, icontract -, pbr -}: +{ lib, sources, buildPythonPackage, beartype, cloudpickle, icontract, pbr }: buildPythonPackage rec { pname = "perscache"; @@ -13,18 +6,11 @@ buildPythonPackage rec { src = sources.perscache; - propagatedBuildInputs = [ - beartype - cloudpickle - icontract - pbr - ]; + propagatedBuildInputs = [ beartype cloudpickle icontract pbr ]; PBR_VERSION = version; - doCheck = false; # no tests currently - pythonImportsCheck = [ - "perscache" - ]; + doCheck = false; # no tests currently + pythonImportsCheck = [ "perscache" ]; meta = with lib; { description = '' -- cgit v1.2.3