-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy pathflake.nix
More file actions
170 lines (158 loc) · 4.34 KB
/
Copy pathflake.nix
File metadata and controls
170 lines (158 loc) · 4.34 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
{
description = "revolutionary new technology that turns any image into obama";
inputs = {
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
rust-overlay,
...
}:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
self.overlays.default
];
};
systemStr = system;
}
);
in
{
overlays.default = final: prev: {
rustToolchain =
let
rust = prev.rust-bin;
in
if builtins.pathExists ./rust-toolchain.toml then
rust.fromRustupToolchainFile ./rust-toolchain.toml
else if builtins.pathExists ./rust-toolchain then
rust.fromRustupToolchainFile ./rust-toolchain
else
rust.stable.latest.default.override {
extensions = [
"rust-src"
"rustfmt"
];
};
};
packages = forEachSupportedSystem (
{ pkgs, systemStr }:
{
default = pkgs.rustPlatform.buildRustPackage {
pname = "obamify";
version = "1.1";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = with pkgs; [
pkg-config
makeWrapper
];
buildInputs = [
pkgs.openssl
]
++ pkgs.lib.optionals pkgs.stdenv.isLinux (
with pkgs;
[
wayland
libxkbcommon
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
vulkan-loader
libglvnd
mesa
egl-wayland
]
);
postFixup = pkgs.lib.optionalString pkgs.stdenv.isLinux ''
wrapProgram $out/bin/obamify \
--set-default WINIT_UNIX_BACKEND wayland \
--set-default WGPU_BACKEND vulkan \
--set LD_LIBRARY_PATH ${
pkgs.lib.makeLibraryPath [
pkgs.wayland
pkgs.libxkbcommon
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXrandr
pkgs.xorg.libXi
pkgs.vulkan-loader
pkgs.libglvnd
pkgs.mesa
pkgs.egl-wayland
]
}
'';
enableParallelBuild = true;
meta = {
description = "revolutionary new technology that turns any image into obama";
homepage = "htpps://github/Spu7Nix/obamify";
license = pkgs.lib.licenses.mit;
mainProgram = "obamify";
};
};
}
);
apps = forEachSupportedSystem (
{ pkgs, systemStr }:
{
default = {
type = "app";
program = nixpkgs.lib.getExe self.packages.${systemStr}.default;
};
}
);
devShells = forEachSupportedSystem (
{ pkgs, ... }:
{
default = pkgs.mkShell {
packages =
with pkgs;
[
rustToolchain
openssl
pkg-config
cargo-deny
cargo-edit
cargo-watch
rust-analyzer
]
++ pkgs.lib.optionals pkgs.stdenv.isLinux [
wayland
libxkbcommon
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
];
env = {
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
};
};
}
);
};
}