-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathflake.nix
More file actions
112 lines (106 loc) · 3.37 KB
/
Copy pathflake.nix
File metadata and controls
112 lines (106 loc) · 3.37 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
description = "audio.cpp - High-performance C++ audio inference framework";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
version = self.shortRev or self.dirtyShortRev or "dirty";
pkgs = forAllSystems (system: import nixpkgs { inherit system; });
pkgsCuda = forAllSystems (
system:
import nixpkgs {
inherit system;
config.cudaSupport = true;
config.allowUnfreePredicate =
p:
builtins.all (
l:
l.free
|| builtins.elem l.shortName [
"CUDA EULA"
"cuDNN EULA"
"cuSPARSELt EULA"
]
) (p.meta.licenses or (nixpkgs.lib.toList (p.meta.license or [ ])));
}
);
audioPackages = forAllSystems (
system:
pkgs.${system}.callPackage .devops/nix/scope.nix {
inherit version;
python-scripts = pythonScripts.${system};
}
);
audioPackagesCuda = forAllSystems (
system:
pkgsCuda.${system}.callPackage .devops/nix/scope.nix {
inherit version;
python-scripts = pythonScripts.${system};
}
);
pythonScripts = forAllSystems (
system: pkgs.${system}.callPackage .devops/nix/python-scripts.nix { }
);
in
{
packages = forAllSystems (
system:
let
base = audioPackages.${system}.audiocpp;
baseCuda = audioPackagesCuda.${system}.audiocpp;
in
{
cpu = base;
vulkan = base.override { vulkanSupport = true; };
python-scripts = pythonScripts.${system};
default =
if pkgs.${system}.stdenv.isDarwin then
self.packages.${system}.metal
else
self.packages.${system}.cpu;
}
// nixpkgs.lib.optionalAttrs pkgs.${system}.stdenv.isLinux {
cuda = baseCuda.override { cudaSupport = true; };
rocm = base.override { rocmSupport = true; };
rocm-gfx1151 = base.override {
rocmSupport = true;
rocmGpuTargets = [ "gfx1151" ];
strixHaloOptimizations = true;
};
}
// nixpkgs.lib.optionalAttrs pkgs.${system}.stdenv.isDarwin {
metal = base.override { metalSupport = true; };
}
);
devShells = forAllSystems (
system:
{
default = pkgs.${system}.mkShell {
inputsFrom = [ self.packages.${system}.default ];
};
}
// nixpkgs.lib.optionalAttrs pkgs.${system}.stdenv.isLinux {
cuda = pkgsCuda.${system}.mkShell {
inputsFrom = [ self.packages.${system}.cuda ];
};
}
# ROCm's Nix toolchain is currently supported on x86_64 Linux only.
# Keep the shell off aarch64 rather than exposing an unevaluable output.
// nixpkgs.lib.optionalAttrs (system == "x86_64-linux") {
rocm = pkgs.${system}.mkShell {
inputsFrom = [ self.packages.${system}.rocm ];
};
rocm-gfx1151 = pkgs.${system}.mkShell {
inputsFrom = [ self.packages.${system}.rocm-gfx1151 ];
};
}
);
};
}