feat: stable-diffussion & updates
This commit is contained in:
@@ -13,13 +13,13 @@ let
|
||||
in
|
||||
buildGoModule (finalAttrs: {
|
||||
pname = "llama-swap";
|
||||
version = "179";
|
||||
version = "180";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mostlygeek";
|
||||
repo = "llama-swap";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-7iftF1KMz+2DUifRG/ESHcWXYsOJ3NiEF7oHuJKxmUE=";
|
||||
hash = "sha256-WPDmENGH1uwNrobcIPA2vuNEsb9sP7Wl7T0wtUv1H/s=";
|
||||
# populate values that require us to use git. By doing this in postFetch we
|
||||
# can delete .git afterwards and maintain better reproducibility of the src.
|
||||
leaveDotGit = true;
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
}:
|
||||
let
|
||||
pname = "opencode";
|
||||
version = "1.0.170";
|
||||
version = "1.0.223";
|
||||
src = fetchFromGitHub {
|
||||
owner = "sst";
|
||||
repo = "opencode";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-Y0thIZ20p0FSBAH0mJfFn8e+OEUvlZyTuk+/yEt8Sy8=";
|
||||
hash = "sha256-CzbWv48UySgXfNgtWdIdFBcqx8GHT4rSJNDdpn39b0c="; # "sha256-Y0thIZ20p0FSBAH0mJfFn8e+OEUvlZyTuk+/yEt8Sy8=";
|
||||
};
|
||||
|
||||
node_modules = stdenvNoCC.mkDerivation {
|
||||
@@ -75,7 +75,7 @@ let
|
||||
# NOTE: Required else we get errors that our fixed-output derivation references store paths
|
||||
dontFixup = true;
|
||||
|
||||
outputHash = "sha256-Aq774bgU12HkrF2oAtfu9kyQFlxUeDbmwlS9lz4Z4ZI=";
|
||||
outputHash = "sha256-+HEd3I11VqejTi7cikbTL5+DmNGyvUC4Cm4ysfujwes=";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
};
|
||||
|
||||
118
packages/stable-diffusion-cpp/default.nix
Normal file
118
packages/stable-diffusion-cpp/default.nix
Normal file
@@ -0,0 +1,118 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, ninja
|
||||
, pkg-config
|
||||
, autoAddDriverRunpath
|
||||
, config ? { }
|
||||
, cudaSupport ? (config.cudaSupport or false)
|
||||
, cudaPackages ? { }
|
||||
, rocmSupport ? (config.rocmSupport or false)
|
||||
, rocmPackages ? { }
|
||||
, rocmGpuTargets ? (rocmPackages.clr.localGpuTargets or rocmPackages.clr.gpuTargets or [ ])
|
||||
, openclSupport ? false
|
||||
, clblast
|
||||
, vulkanSupport ? false
|
||||
, shaderc
|
||||
, vulkan-headers
|
||||
, vulkan-loader
|
||||
, spirv-tools
|
||||
, metalSupport ? (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
|
||||
, apple-sdk
|
||||
,
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
cmakeBool
|
||||
cmakeFeature
|
||||
optionals
|
||||
;
|
||||
|
||||
effectiveStdenv = if cudaSupport then cudaPackages.backendStdenv else stdenv;
|
||||
in
|
||||
effectiveStdenv.mkDerivation (finalAttrs: {
|
||||
pname = "stable-diffusion-cpp";
|
||||
version = "master-453-4ff2c8c";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "leejet";
|
||||
repo = "stable-diffusion.cpp";
|
||||
rev = "master-453-4ff2c8c";
|
||||
hash = "sha256-8cN6dYOQAKnJpuQdtayp6+o71s64lG+FcTn8GsIM4jI=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
pkg-config
|
||||
]
|
||||
++ optionals cudaSupport [
|
||||
(cudaPackages.cuda_nvcc)
|
||||
autoAddDriverRunpath
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
(optionals cudaSupport (
|
||||
with cudaPackages;
|
||||
[
|
||||
cuda_cccl
|
||||
cuda_cudart
|
||||
libcublas
|
||||
]
|
||||
))
|
||||
++ (optionals rocmSupport (
|
||||
with rocmPackages;
|
||||
[
|
||||
clr
|
||||
hipblas
|
||||
rocblas
|
||||
]
|
||||
))
|
||||
++ (optionals vulkanSupport [
|
||||
shaderc
|
||||
vulkan-headers
|
||||
vulkan-loader
|
||||
spirv-tools
|
||||
])
|
||||
++ (optionals openclSupport [
|
||||
clblast
|
||||
])
|
||||
++ (optionals metalSupport [
|
||||
apple-sdk
|
||||
]);
|
||||
|
||||
cmakeFlags = [
|
||||
(cmakeBool "SD_BUILD_EXAMPLES" true)
|
||||
(cmakeBool "SD_BUILD_SHARED_LIBS" true)
|
||||
(cmakeBool "SD_USE_SYSTEM_GGML" false)
|
||||
(cmakeBool "SD_CUDA" cudaSupport)
|
||||
(cmakeBool "SD_HIPBLAS" rocmSupport)
|
||||
(cmakeBool "SD_VULKAN" vulkanSupport)
|
||||
(cmakeBool "SD_OPENCL" openclSupport)
|
||||
(cmakeBool "SD_METAL" metalSupport)
|
||||
(cmakeBool "SD_FAST_SOFTMAX" false)
|
||||
]
|
||||
++ optionals cudaSupport [
|
||||
(cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaPackages.flags.cmakeCudaArchitecturesString)
|
||||
]
|
||||
++ optionals rocmSupport [
|
||||
(cmakeFeature "CMAKE_HIP_ARCHITECTURES" (builtins.concatStringsSep ";" rocmGpuTargets))
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Stable Diffusion inference in pure C/C++";
|
||||
homepage = "https://github.com/leejet/stable-diffusion.cpp";
|
||||
license = licenses.mit;
|
||||
mainProgram = "sd";
|
||||
maintainers = with lib.maintainers; [
|
||||
dit7ya
|
||||
adriangl
|
||||
];
|
||||
platforms = platforms.unix;
|
||||
badPlatforms = optionals (cudaSupport || openclSupport) platforms.darwin;
|
||||
broken = metalSupport && !stdenv.hostPlatform.isDarwin;
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user