Skip to content

Commit aef2182

Browse files
committed
feat(nix): replace shell.nix with flake.nix
1 parent 8f72146 commit aef2182

File tree

3 files changed

+180
-21
lines changed

3 files changed

+180
-21
lines changed

flake.lock

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
4+
utils.url = "github:numtide/flake-utils";
5+
oxalica-rust = {
6+
url = "github:oxalica/rust-overlay";
7+
inputs.nixpkgs.follows = "nixpkgs";
8+
};
9+
};
10+
11+
outputs = inputs@{ self, nixpkgs, utils, oxalica-rust }:
12+
utils.lib.eachDefaultSystem (system:
13+
let
14+
pkgs = nixpkgs.legacyPackages.${system}.extend oxalica-rust.overlays.default;
15+
rustStable = pkgs.rust-bin.stable.latest;
16+
rustNightly = pkgs.rust-bin.nightly.latest;
17+
rust = rustStable.minimal;
18+
19+
unpack = drv: pkgs.runCommand "${drv.name}-unpacked" {} ''
20+
mkdir extracted
21+
cd extracted
22+
unpackFile ${drv}
23+
cp -a ./* $out
24+
'';
25+
26+
gdb = pkgs.gdb.overrideAttrs (old: {
27+
patches = pkgs.fetchpatch {
28+
url = "https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=562403d4f5483e0787219fdb88da72c707c8d7f6";
29+
hash = "sha256-l4zWMJ0LFAWSRQmb+ixD84yxrXe2OaX8CPxsAlu93jw=";
30+
};
31+
});
32+
in {
33+
devShell = with pkgs; mkShell {
34+
buildInputs = [
35+
clang pkg-config
36+
(enableDebugging ffmpeg_6).out
37+
(enableDebugging ffmpeg_6).dev
38+
39+
(rust.override {
40+
extensions = [
41+
"rust-src"
42+
"clippy"
43+
];
44+
})
45+
46+
# necessary for unstable format options
47+
rustNightly.rustfmt
48+
49+
(writeShellScriptBin "gdb" ''
50+
RUSTC_COMMIT="$(rustc -vV | awk '/commit-hash: (.+)/ { print $2 }')"
51+
echo $RUSTC_COMMIT
52+
53+
exec ${gdb}/bin/gdb \
54+
-ex "set substitute-path '/rustc/$RUSTC_COMMIT' '${rustStable.rust-src}/lib/rustlib/src/rust'" \
55+
-d ${unpack ffmpeg_6.src} \
56+
"$@"
57+
'')
58+
];
59+
60+
RUST_BACKTRACE = 1;
61+
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
62+
};
63+
});
64+
}

shell.nix

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)