Skip to content

Commit 373054f

Browse files
hutlihodlen
authored andcommitted
nix: .#widnows: init
initial nix build for windows using zig mingwW64 build removes nix zig windows build removes nix zig windows build removed unnessesary glibc.static removed unnessesary import of pkgs in nix fixed missing trailing newline on non-windows nix builds overriding stdenv when building for crosscompiling to windows in nix better variables when crosscompiling windows in nix cross compile windows on macos removed trailing whitespace remove unnessesary overwrite of "CMAKE_SYSTEM_NAME" in nix windows build nix: keep file extension when copying result files during cross compile for windows nix: better checking for file extensions when using MinGW nix: using hostPlatform instead of targetPlatform when cross compiling for Windows using hostPlatform.extensions.executable to extract executable format
1 parent 9ad4385 commit 373054f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.devops/nix/package.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ let
6767
strings.optionalString (suffices != [ ])
6868
", accelerated with ${strings.concatStringsSep ", " suffices}";
6969

70+
executableSuffix = effectiveStdenv.hostPlatform.extensions.executable;
71+
7072
# TODO: package the Python in this repository in a Nix-like way.
7173
# It'd be nice to migrate to buildPythonPackage, as well as ensure this repo
7274
# is PEP 517-compatible, and ensure the correct .dist-info is generated.
@@ -244,8 +246,8 @@ effectiveStdenv.mkDerivation (
244246
# TODO(SomeoneSerge): It's better to add proper install targets at the CMake level,
245247
# if they haven't been added yet.
246248
postInstall = ''
247-
mv $out/bin/main $out/bin/llama
248-
mv $out/bin/server $out/bin/llama-server
249+
mv $out/bin/main${executableSuffix} $out/bin/llama${executableSuffix}
250+
mv $out/bin/server${executableSuffix} $out/bin/llama-server${executableSuffix}
249251
mkdir -p $out/include
250252
cp $src/llama.h $out/include/
251253
'';

flake.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@
155155
{
156156
default = config.legacyPackages.llamaPackages.llama-cpp;
157157
vulkan = config.packages.default.override { useVulkan = true; };
158+
windows = config.legacyPackages.llamaPackages.llama-cpp.override {
159+
stdenv = pkgs.pkgsCross.mingwW64.stdenv;
160+
};
158161
}
159162
// lib.optionalAttrs pkgs.stdenv.isLinux {
160163
opencl = config.packages.default.override { useOpenCL = true; };

0 commit comments

Comments
 (0)