mirror of
https://github.com/encounter/rust-ffmpeg.git
synced 2026-07-10 21:18:39 -07:00
feat(nix): replace shell.nix with flake.nix
This commit is contained in:
Generated
+116
@@ -0,0 +1,116 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1682109806,
|
||||
"narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2362848adf8def2866fabbffc50462e929d7fffb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"oxalica-rust": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1682129965,
|
||||
"narHash": "sha256-1KRPIorEL6pLpJR04FwAqqnt4Tzcm4MqD84yhlD+XSk=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "2c417c0460b788328220120c698630947547ee83",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"oxalica-rust": "oxalica-rust",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_2": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,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";
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
let
|
||||
mozilla = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
|
||||
in
|
||||
|
||||
with (import <nixpkgs> {
|
||||
overlays = [mozilla];
|
||||
});
|
||||
|
||||
mkShell {
|
||||
name = "ffmpeg-sys";
|
||||
|
||||
buildInputs = [
|
||||
# For building.
|
||||
clang rustChannels.nightly.rust pkg-config ffmpeg
|
||||
];
|
||||
|
||||
RUST_BACKTRACE = 1;
|
||||
RUSTFLAGS = "-C target-cpu=native";
|
||||
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
}
|
||||
Reference in New Issue
Block a user