-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
106 lines (98 loc) · 2.68 KB
/
flake.nix
File metadata and controls
106 lines (98 loc) · 2.68 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
{
description = "metatron devenv";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
tsssni = {
url = "github:tsssni/tsssni.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixgl = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
tsssni,
nixgl,
...
}:
let
lib = nixpkgs.lib;
systems = [
"aarch64-darwin"
"x86_64-linux"
"aarch64-linux"
];
systemAttrs = f: system: { ${system} = f system; };
mapSystems = f: systems |> lib.map (systemAttrs f) |> lib.mergeAttrsList;
packages = mapSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = tsssni.pkgs;
};
in
{
default = pkgs.callPackage ./nix { };
}
);
devShells = mapSystems (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = tsssni.pkgs;
config.allowUnfree = true;
};
glpkgs =
let
isx86 = system == "x86_64-linux";
in
import nixgl {
inherit pkgs nvidiaVersion;
enable32bits = isx86;
enableIntelX86Extensions = isx86;
};
externalNvidiaVersion = builtins.getEnv "MTT_IMPURE_NVIDIA_VERSION";
nvidiaVersion = if externalNvidiaVersion == "" then null else externalNvidiaVersion;
in
rec {
default = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
inputsFrom = [ packages.${system}.default ];
packages = with pkgs; [
clang-tools
cmake-language-server
] ++ lib.optionals pkgs.stdenv.isLinux [
hotspot
perf
vulkan-validation-layers
];
shellHook = ''
export CMAKE_INSTALL_PREFIX=$HOME/metatron/out
export SHELL=nu
''
+ lib.optionalString pkgs.stdenv.isLinux ''
export VK_LAYER_PATH=${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d
''
+ lib.optionalString pkgs.stdenv.isDarwin ''
export MTL_DEBUG_LAYER=1
'';
};
impure = default.overrideAttrs (oldAttrs: {
nativeBuildInputs =
oldAttrs.nativeBuildInputs
++ (with glpkgs; [
nixVulkanIntel
nixVulkanNvidia
]);
});
}
);
in
{
inherit packages devShells;
};
}