generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
161 lines (149 loc) · 5.1 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
{
description = "some-pkgs: sci-comp packages that have no place in nixpkgs";
inputs.dream2nix.url = "github:nix-community/dream2nix";
inputs.dream2nix.inputs.nixpkgs.follows = "nixpkgs";
inputs.nix-gl-host.url = "github:SomeoneSerge/nix-gl-host"; # the jetson PR
inputs.nix-gl-host.inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/master";
outputs = { self, dream2nix, nix-gl-host, nixpkgs }@inputs:
let
inherit (import ./lib/extend-lib.nix {
inherit inputs;
oldLib = nixpkgs.lib;
})
lib;
systems =
builtins.filter (name: builtins.hasAttr name nixpkgs.legacyPackages) [
"x86_64-linux"
"i686-linux"
"x86_64-darwin"
"aarch64-linux"
"armv6l-linux"
"armv7l-linux"
];
forAllSystems = f: lib.genAttrs systems (system: f system);
defaultPlatforms = [ "x86_64-linux" "aarch64-linux" ];
supportsPlatform = system: name: package:
let
s = builtins.elem system (package.meta.platforms or defaultPlatforms);
in
s;
reservedName = name: builtins.elem name [ "lib" "python" "python3" ];
filterUnsupported = system: packages:
let
filters = [
(name: _: !reservedName name)
(name: attr: attr ? type && attr.type == "derivation")
(supportsPlatform system)
];
f = name: package: builtins.all (f: f name package) filters;
in
lib.filterAttrs f packages;
overlay = import ./overlay.nix { inherit inputs; };
pkgs = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = [ overlay ];
});
newAttrs = forAllSystems (system:
pkgs.${system}.some-pkgs // pkgs.${system}.some-pkgs.some-pkgs-py);
supportedPkgs = lib.mapAttrs filterUnsupported newAttrs;
outputs = {
inherit overlay lib;
packages = supportedPkgs;
legacyPackages = newAttrs // (forAllSystems (system: {
pkgs = pkgs.${system};
pkgsUnfree =
import nixpkgs {
inherit system;
config = { allowUnfree = true; };
overlays = [ overlay ];
};
pkgsCuda =
import nixpkgs {
inherit system;
config = {
allowUnfree = true;
cudaSupport = true;
};
overlays = [ overlay ];
};
pkgsCudaCluster =
import nixpkgs {
inherit system;
config = {
allowUnfree = true;
cudaSupport = true;
# Support V100s and A100s on the Aalto's "Triton" and RTX3090 at the lab:
cudaCapabilities = [ "6.0" "7.0" "8.0" "8.6" ];
cudaEnableForwardCompat = false;
};
overlays = [
overlay
(final: prev: {
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
(py-final: py-prev: {
torch = py-prev.torch.override { MPISupport = true; };
})
];
})
];
};
pkgsCudaCompat =
import nixpkgs {
inherit system;
config = {
allowUnfree = true;
cudaSupport = true;
cudaCapabilities = [ "5.2" ];
};
overlays = [ overlay ];
};
pkgsRocm =
import nixpkgs {
inherit system;
config = {
allowUnfree = true;
rocmSupport = true;
};
overlays = [ overlay ];
};
pkgsInsecureUnfree =
import nixpkgs {
inherit system;
config = {
allowUnfree = true;
permittedInsecurePackages = [ "openssl-1.1.1w" ];
};
overlays = [ overlay ];
};
} // lib.optionalAttrs (system == "aarch64-linux") {
pkgsXavier =
import nixpkgs {
inherit system;
config = {
allowUnfree = true;
cudaSupport = true;
# Jetson AGX Xavier
cudaCapabilities = [ "7.2" ];
cudaEnableForwardCompat = false;
};
overlays = [ overlay ];
};
}));
herculesCI.onPush.default.outputs =
{
fatCuda = with self.legacyPackages.x86_64-linux.pkgsCuda; {
inherit (some-pkgs-py) stable-diffusion-webui instant-ngp nvdiffrast edm;
};
aalto = with self.legacyPackages.x86_64-linux.pkgsCudaCluster; {
inherit (some-pkgs-py) stable-diffusion-webui instant-ngp nvdiffrast edm;
};
jetsons.xavier = with self.legacyPackages.aarch64-linux.pkgsXavier; {
inherit (some-pkgs-py) edm nvdiffrast instant-ngp;
};
};
};
in
outputs;
}