-
Notifications
You must be signed in to change notification settings - Fork 97
/
flake.nix
60 lines (51 loc) · 1.67 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
oxalica-rust = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, utils, oxalica-rust }:
utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend oxalica-rust.overlays.default;
rustStable = pkgs.rust-bin.stable.latest;
rustNightly = pkgs.rust-bin.nightly.latest;
rust = rustStable.minimal;
unpack = drv: pkgs.runCommand "${drv.name}-unpacked" {} ''
mkdir extracted
cd extracted
unpackFile ${drv}
cp -a ./* $out
'';
ffmpeg = pkgs.ffmpeg_6;
in {
devShell = with pkgs; mkShell {
buildInputs = [
clang pkg-config
nasm
(enableDebugging ffmpeg).out
(enableDebugging ffmpeg).dev
(rust.override {
extensions = [
"rust-src"
"clippy"
];
})
# necessary for unstable format options
rustNightly.rustfmt
(writeShellScriptBin "gdb" ''
RUSTC_COMMIT="$(rustc -vV | awk '/commit-hash: (.+)/ { print $2 }')"
exec ${gdb}/bin/gdb \
-ex "set substitute-path '/rustc/$RUSTC_COMMIT' '${rustStable.rust-src}/lib/rustlib/src/rust'" \
-d ${unpack ffmpeg.src} \
"$@"
'')
];
RUST_BACKTRACE = 1;
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
};
});
}