|
| 1 | +{ |
| 2 | + description = "Media over QUIC - Gstreamer plugin"; |
| 3 | + |
| 4 | + inputs = { |
| 5 | + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; |
| 6 | + flake-utils.url = "github:numtide/flake-utils"; |
| 7 | + crane.url = "github:ipetkov/crane"; |
| 8 | + rust-overlay = { |
| 9 | + url = "github:oxalica/rust-overlay"; |
| 10 | + inputs.nixpkgs.follows = "nixpkgs"; |
| 11 | + }; |
| 12 | + }; |
| 13 | + |
| 14 | + outputs = { self, nixpkgs, flake-utils, crane, rust-overlay}: |
| 15 | + flake-utils.lib.eachDefaultSystem ( |
| 16 | + system: |
| 17 | + let |
| 18 | + pkgs = import nixpkgs { |
| 19 | + inherit system; |
| 20 | + overlays = [ (import rust-overlay) ]; |
| 21 | + }; |
| 22 | + rust-toolchain = pkgs.rust-bin.stable.latest.default.override { |
| 23 | + extensions = [ |
| 24 | + "rust-src" |
| 25 | + "rust-analyzer" |
| 26 | + ]; |
| 27 | + }; |
| 28 | + craneLib = (crane.mkLib pkgs).overrideToolchain rust-toolchain; |
| 29 | + |
| 30 | + # Helper function to get crate info from Cargo.toml |
| 31 | + crateInfo = cargoTomlPath: craneLib.crateNameFromCargoToml { cargoToml = cargoTomlPath; }; |
| 32 | + |
| 33 | + gstreamerLib = with pkgs ; [ |
| 34 | + gst_all_1.gstreamer.out |
| 35 | + gst_all_1.gst-plugins-base |
| 36 | + gst_all_1.gst-plugins-good |
| 37 | + gst_all_1.gst-plugins-bad |
| 38 | + ]; |
| 39 | + gstreamerSearch = with pkgs; [ |
| 40 | + gst_all_1.gst-plugins-ugly |
| 41 | + gst_all_1.gst-plugins-rs |
| 42 | + ] ++ gstreamerLib; |
| 43 | + |
| 44 | + shell-deps = with pkgs; [ |
| 45 | + rust-toolchain |
| 46 | + just |
| 47 | + pkg-config |
| 48 | + glib |
| 49 | + cargo-sort |
| 50 | + cargo-shear |
| 51 | + cargo-edit |
| 52 | + gst_all_1.gstreamer |
| 53 | + ]; |
| 54 | + |
| 55 | + gstPluginPath = nixpkgs.lib.makeSearchPath "lib/gstreamer-1.0" gstreamerSearch + ":" + nixpkgs.lib.makeLibraryPath gstreamerLib; |
| 56 | + in { |
| 57 | + devShell = pkgs.mkShell { |
| 58 | + packages = shell-deps; |
| 59 | + |
| 60 | + env = { |
| 61 | + GST_PLUGIN_PATH_1_0 = gstPluginPath; |
| 62 | + #PKG_CONFIG_PATH = pkgConfigPath; |
| 63 | + GST_REGISTRY = "./gst-registry.bin"; |
| 64 | + }; |
| 65 | + |
| 66 | + # if you want zsh instead of bash, uncomment this |
| 67 | + #shellHook = '' |
| 68 | + # exec zsh |
| 69 | + #''; |
| 70 | + }; |
| 71 | + packages = { |
| 72 | + hang-gst = craneLib.buildPackage ( |
| 73 | + crateInfo ./Cargo.toml |
| 74 | + // { |
| 75 | + src = craneLib.cleanCargoSource ./.; |
| 76 | + nativeBuildInputs = with pkgs; [ |
| 77 | + pkg-config |
| 78 | + glib |
| 79 | + glib.dev |
| 80 | + gst_all_1.gstreamer.dev |
| 81 | + ]; |
| 82 | + cargoExtraArgs = "-p hang-gst"; |
| 83 | + } |
| 84 | + ); |
| 85 | + default = self.packages.${system}.hang-gst; |
| 86 | + }; |
| 87 | + }); |
| 88 | +} |
0 commit comments