Skip to content

Commit

Permalink
add ffmpeg zig dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
azuline committed May 12, 2024
1 parent ad36e48 commit c6a3548
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ clean:
nixify-zig-deps:
cd rose-zig && zon2nix > deps.nix

.PHONY: build-zig check test typecheck lintcheck lint clean nixify-zig-deps
.PHONY: help check build-zig test-py test-zig test typecheck lintcheck lint clean nixify-zig-deps
45 changes: 44 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
# Bug in upstream: https://github.com/nix-community/zon2nix/pull/8.
zon2nix-src.url = "github:azuline/zon2nix";
zon2nix-src.inputs.nixpkgs.follows = "nixpkgs";
};

outputs =
{ self
, nixpkgs
, flake-utils
, zon2nix-src
}:
flake-utils.lib.eachDefaultSystem (system:
let
Expand Down Expand Up @@ -52,6 +56,7 @@
python-with-deps = python-pin.withPackages (_:
pkgs.lib.attrsets.mapAttrsToList (a: b: b) py-deps
);
zon2nix = zon2nix-src.packages.${system}.default;
in
{
devShells.default = pkgs.mkShell {
Expand All @@ -73,13 +78,13 @@
buildInputs = [
(pkgs.buildEnv {
name = "rose-devshell";
paths = with pkgs; [
paths = [
pkgs.ruff
pkgs.nodePackages.pyright
pkgs.nodePackages.prettier
pkgs.zig
pkgs.zls
python-with-deps
ruff
nodePackages.pyright
nodePackages.prettier
zig
zls
zon2nix
];
})
Expand Down
5 changes: 5 additions & 0 deletions rose-zig/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
const ffmpeg = b.dependency("ffmpeg", .{
.target = target,
.optimize = optimize,
});

// Specify the core library module.
const rose = b.addModule("rose", .{
.root_source_file = b.path("rose/root.zig"),
.target = target,
.optimize = optimize,
.imports = &[_]std.Build.Module.Import{
.{ .name = "av", .module = ffmpeg.module("av") },
.{ .name = "sqlite", .module = sqlite.module("sqlite") },
},
});
Expand Down
4 changes: 4 additions & 0 deletions rose-zig/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
.url = "https://github.com/vrischmann/zig-sqlite/archive/dc339b7cf3bca82a12c2169231dd247587766781.tar.gz",
.hash = "1220e0961c135c5aa3af77a043dbc5890a18235a157238df0e2882fe84a8c8439c7a",
},
.ffmpeg = .{
.url = "https://github.com/andrewrk/ffmpeg/archive/1704e8898ea6217df91e6afc2a2de3f2b82a98d9.tar.gz",
.hash = "1220dd6f0bbf4614f338d632473e4b0a879ec26eca445ed305dcdbc6b5cb6405e3cd",
},
},
.paths = .{""},
}
49 changes: 49 additions & 0 deletions rose-zig/deps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,55 @@
{ linkFarm, fetchzip }:

linkFarm "zig-packages" [
{
name = "122004fa7e2ff0b3d472049743358f8fdf065cdf63bc0e5e3d54c6bb8d81d93e40da";
path = fetchzip {
url = "https://github.com/andrewrk/nasm/archive/b5f62392d56baf6aa02567f28e0da70664609262.tar.gz";
hash = "sha256-tPBQixxG+phvEfRHeOLHMjY1Ynp7r9zNSgRy4R/ILQM=";
};
}
{
name = "1220138f4aba0c01e66b68ed9e1e1e74614c06e4743d88bc58af4f1c3dd0aae5fea7";
path = fetchzip {
url = "https://github.com/allyourcodebase/zlib/archive/refs/tags/1.3.1-3.tar.gz";
hash = "sha256-R1tB+ORO3qeV/cNxsp5GqsiOyKUXjaj4Pd1v5AfWYz4=";
};
}
{
name = "122074e0bf09c3622780e697c11c6744e763dd63777e480baf2b583ee3ab6a02ff14";
path = fetchzip {
url = "https://github.com/andrewrk/libvorbis/archive/refs/tags/1.3.8-3.tar.gz";
hash = "sha256-KHKYT3tmab9qYu8N2iJwm1rS+mU7Cwnn8Jp0cfOdnIg=";
};
}
{
name = "12207d353609d95cee9da7891919e6d9582e97b7aa2831bd50f33bf523a582a08547";
path = fetchzip {
url = "https://github.com/madler/zlib/archive/refs/tags/v1.3.tar.gz";
hash = "sha256-eUuXV5zfy+fmiMNdWw5QCqDloBkaxy1tgi7by9nYHNA=";
};
}
{
name = "1220b3e1fb33317c92f9ead09630f6b4be59e80d0a8780754f8aa4ee7da61cb7b47a";
path = fetchzip {
url = "https://github.com/andrewrk/libogg/archive/refs/tags/1.3.6-2.tar.gz";
hash = "sha256-3dFDBo4Af58bW8Gf+sHLigwo8CO2siwzWWtAoYe5opI=";
};
}
{
name = "1220bee0fcf98bf6ad75b7bb09ff1f873ca38547a15b1e7a4532d20d94107d8d330a";
path = fetchzip {
url = "https://github.com/andrewrk/libmp3lame/archive/refs/tags/3.100.1-3.tar.gz";
hash = "sha256-kMI7JACnIVAdUHp5DUKx2XfKgIb1ftr6x/oYJdsTKyI=";
};
}
{
name = "1220dd6f0bbf4614f338d632473e4b0a879ec26eca445ed305dcdbc6b5cb6405e3cd";
path = fetchzip {
url = "https://github.com/andrewrk/ffmpeg/archive/1704e8898ea6217df91e6afc2a2de3f2b82a98d9.tar.gz";
hash = "sha256-6EYu1QT76cJQMW9F41DvXsVLulH1YwGrkhwSV6IsBes=";
};
}
{
name = "1220e0961c135c5aa3af77a043dbc5890a18235a157238df0e2882fe84a8c8439c7a";
path = fetchzip {
Expand Down

0 comments on commit c6a3548

Please sign in to comment.