Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
140 lines (127 loc) · 4.31 KB
/
Copy pathflake.nix
File metadata and controls
140 lines (127 loc) · 4.31 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
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
{
description = "A data driven CAD program";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
crane.url = "github:ipetkov/crane";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
flake-utils,
crane,
fenix,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
};
fenix-pkgs = fenix.packages.${system};
fenix-channel = fenix-pkgs.stable;
fenix-toolchain = fenix-channel.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
"rust-analyzer"
];
craneLib = (crane.mkLib pkgs).overrideScope (
final: prev: {
cargo = fenix-channel.cargo;
rustc = fenix-channel.rustc;
}
);
core-dependencies = with pkgs; [
bashInteractive
nodejs_24
tree-sitter
fenix-toolchain
cargo-expand
openssl
pkg-config
];
gui-dependencies = with pkgs; [
wayland
libxkbcommon
libX11
libXcursor
libXi
vulkan-loader
libGL
alsa-lib
alsa-plugins
pipewire
udev
mesa
libglvnd
];
in
{
packages.default =
with pkgs;
craneLib.buildPackage {
nativeBuildInputs = [
openssl
pkg-config
];
buildInputs = [
openssl
];
src = craneLib.cleanCargoSource ./.;
strictDeps = true;
};
devShells = with pkgs; rec {
common = mkShell {
buildInputs = core-dependencies;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
openssl
];
shellHook = ''
export SHELL=${pkgs.bashInteractive}/bin/bash
export NIX_HARDENING_ENABLE=""
'';
};
gui = mkShell {
buildInputs = core-dependencies ++ gui-dependencies;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (
[
openssl
]
++ gui-dependencies
);
shellHook = ''
export SHELL=${pkgs.bashInteractive}/bin/bash
export NIX_HARDENING_ENABLE=""
export LD_LIBRARY_PATH="${mesa.outPath}/lib:${libglvnd.outPath}/lib:${alsa-plugins.outPath}/lib/alsa-lib:${pipewire.outPath}/lib/alsa-lib:$LD_LIBRARY_PATH"
export LIBGL_DRIVERS_PATH="${mesa.outPath}/lib/dri"
export GBM_BACKENDS_PATH="${mesa.outPath}/lib/gbm"
export __EGL_VENDOR_LIBRARY_FILENAMES="${mesa.outPath}/share/glvnd/egl_vendor.d/50_mesa.json"
export VK_ICD_FILENAMES="${mesa.outPath}/share/vulkan/icd.d/radeon_icd.x86_64.json:${mesa.outPath}/share/vulkan/icd.d/intel_icd.x86_64.json:${mesa.outPath}/share/vulkan/icd.d/nouveau_icd.x86_64.json"
export VK_LAYER_PATH="${mesa.outPath}/share/vulkan/implicit_layer.d"
export LIBVA_DRIVERS_PATH="${mesa.outPath}/lib/dri"
# nixGL wrapper for Vulkan-on-OpenGL rendering on SteamOS
nixGL() {
export LD_LIBRARY_PATH="${mesa.outPath}/lib:${libglvnd.outPath}/lib:${alsa-plugins.outPath}/lib/alsa-lib:${pipewire.outPath}/lib/alsa-lib:$LD_LIBRARY_PATH"
export LIBGL_DRIVERS_PATH="${mesa.outPath}/lib/dri"
export GBM_BACKENDS_PATH="${mesa.outPath}/lib/gbm"
export __EGL_VENDOR_LIBRARY_FILENAMES="${mesa.outPath}/share/glvnd/egl_vendor.d/50_mesa.json"
export VK_ICD_FILENAMES="${mesa.outPath}/share/vulkan/icd.d/radeon_icd.x86_64.json:${mesa.outPath}/share/vulkan/icd.d/intel_icd.x86_64.json:${mesa.outPath}/share/vulkan/icd.d/nouveau_icd.x86_64.json"
export VK_LAYER_PATH="${mesa.outPath}/share/vulkan/implicit_layer.d"
export LIBVA_DRIVERS_PATH="${mesa.outPath}/lib/dri"
exec "$@"
}
'';
};
default = gui;
};
}
);
}