-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
68 lines (68 loc) · 2.9 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
{
nixConfig = {
bash-prompt = "[devshell] ";
extra-trusted-substituters = [
"https://ai.cachix.org"
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
"https://cuda-maintainers.cachix.org"
"https://nix.cache.vapor.systems"
"https://numtide.cachix.org"
];
extra-substituters = [
"https://ai.cachix.org"
"https://cache.nixos.org/"
"https://nix-community.cachix.org"
"https://cuda-maintainers.cachix.org"
"https://nix.cache.vapor.systems"
"https://numtide.cachix.org"
];
extra-trusted-public-keys = [
"ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
"nix.cache.vapor.systems-1:OjV+eZuOK+im1n8tuwHdT+9hkQVoJORdX96FvWcMABk="
"numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE="
];
};
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
# inputs.nixpkgs.url = "github:nixos/nixpkgs/2726f127c15a4cc9810843b96cad73c7eb39e443";
# inputs.nixpkgs.url = "github:nixos/nixpkgs/c708923";
outputs = { self, nixpkgs, ... }:
let
pkgs = import nixpkgs { system = "x86_64-linux"; config.cudaSupport = true; config.allowUnfree = true; config.allowBroken = true;
overlays = [ (final: prev: {
# cudaPackages = final.cudaPackages_11;
# onnxruntime = (prev.onnxruntime.overrideAttrs (old: { cmakeFlags = old.cmakeFlags ++ [ (pkgs.lib.cmakeFeature "onnxruntime_NVCC_THREADS" "1") ]; }));
# python3Packages = final.python3.pkgs;
cudaPackages = prev.cudaPackages.overrideScope (cfinal: cprev: {
tensorrt = cprev.tensorrt.override { cudaMajorMinorVersion = "12.0"; };
});
python3 = prev.python3.override {
packageOverrides = pfinal: pprev: {
# torch = pprev.torch-bin;
# torchvision = pprev.torchvision-bin;
diffusers = final.python3.pkgs.callPackage ./diffusers.nix {};
};
};
}) ];
};
morpheusPython = (pkgs.python3.withPackages (p: [ self.packages.x86_64-linux.stream-diffusion p.av p.gradio (p.opencv4.override {enableGtk3=true;}) ]));
in
rec {
packages.x86_64-linux.stream-diffusion = pkgs.python3.pkgs.callPackage ./streamDiffusion.nix {};
packages.x86_64-linux.morpheus = pkgs.writeShellScriptBin "morpheus" ''
export LD_LIBRARY_PATH=/run/opengl-driver/lib:${pkgs.cudaPackages.cudatoolkit}/lib
${morpheusPython}/bin/python3 ${./demo_webcam_morph.py}
'';
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = with pkgs; [
morpheusPython
];
shellHook = ''
export LD_LIBRARY_PATH=/run/opengl-driver/lib:${pkgs.cudaPackages.cudatoolkit}/lib
'';
};
};
}