screencap-bot/flake.nix

47 lines
1.3 KiB
Nix

{
description = "Screencap bot for Cohost";
outputs = { self, nixpkgs }: let
pkgs = import nixpkgs {
system = "x86_64-linux";
};
buildDeps = {
buildInputs = with pkgs; [ ffmpeg openssl ];
nativeBuildInputs = with pkgs; [ rustc cargo pkg-config clang ];
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
};
cargoData = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = cargoData.package.name;
version = cargoData.package.version;
in rec {
packages.x86_64-linux."${pname}-unwrapped" = pkgs.rustPlatform.buildRustPackage ({
inherit pname version;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
} // buildDeps);
packages.x86_64-linux.${pname} = pkgs.symlinkJoin {
name = "${pname}-${version}";
paths = [ packages.x86_64-linux."${pname}-unwrapped" ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/${pname} \
--prefix PATH : ${pkgs.ffmpeg}/bin
'';
};
packages.x86_64-linux.default = packages.x86_64-linux.${pname};
devShells.x86_64-linux.default = pkgs.mkShell {
inherit (buildDeps) buildInputs LIBCLANG_PATH;
nativeBuildInputs = buildDeps.nativeBuildInputs ++ (with pkgs; [
cargo-audit
clippy
rustfmt
]);
};
};
}