-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
81 lines (75 loc) · 2.26 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
description = "Nix package of LocalAI";
inputs = {
nixpkgs-2411.url = "github:nixos/nixpkgs/nixos-24.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs =
{
self,
nixpkgs-2411,
nixpkgs-unstable,
}:
let
inherit (nixpkgs-unstable) lib;
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
in
{
overlays.default = import ./overlay.nix;
formatter = forAllSystems (system: nixpkgs-unstable.legacyPackages.${system}.nixfmt-rfc-style);
packages = forAllSystems (
system:
let
pkgs-2411 = import nixpkgs-2411 {
inherit system;
overlays = builtins.attrValues self.overlays;
config.allowUnfree = true;
};
pkgs-unstable = import nixpkgs-unstable {
inherit system;
overlays = builtins.attrValues self.overlays;
config.allowUnfree = true;
};
in
{
local-ai-nixos2411 = pkgs-2411.nix-local-ai.local-ai;
local-ai-openblas-nixos2411 = pkgs-2411.nix-local-ai.local-ai.override { with_openblas = true; };
local-ai-cublas-nixos2411 = pkgs-2411.nix-local-ai.local-ai.override { with_cublas = true; };
default = pkgs-unstable.nix-local-ai.local-ai;
}
// pkgs-unstable.nix-local-ai
// builtins.listToAttrs (
map
(type: {
name = "local-ai-" + type;
value = pkgs-unstable.nix-local-ai.local-ai.override {
"with_${type}" = true;
# tinydream can not compiled with cublas gcc
with_tinydream = type != "cublas";
};
})
[
"cublas"
"clblas"
"openblas"
"vulkan"
]
)
);
checks = forAllSystems (
system:
let
packages = self.packages.${system};
in
packages
// (builtins.foldl' (
acc: package:
acc
// (lib.mapAttrs' (test: value: {
name = package + "-test-" + test;
inherit value;
}) (packages.${package}.tests or { }))
) { } (builtins.attrNames packages))
);
};
}