-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
71 lines (66 loc) · 1.75 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
{
description = "Nix package of LocalAI";
inputs = {
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
};
outputs =
{
self,
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-unstable = import nixpkgs-unstable {
inherit system;
overlays = builtins.attrValues self.overlays;
config = {
allowUnfree = true;
};
};
in
{
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"
]
)
);
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))
);
};
}