screencap-bot/flake.nix

47 lines
1.3 KiB
Nix
Raw Normal View History

{
description = "Screencap bot for Cohost";
outputs = { self, nixpkgs }: let
pkgs = import nixpkgs {
system = "x86_64-linux";
};
2023-06-30 16:33:41 -04:00
buildDeps = {
buildInputs = with pkgs; [ ffmpeg openssl ];
2023-10-16 03:14:42 -04:00
nativeBuildInputs = with pkgs; [ rustc cargo pkg-config clang ];
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
};
2023-07-05 02:22:09 -04:00
cargoData = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pname = cargoData.package.name;
version = cargoData.package.version;
2023-06-30 16:33:41 -04:00
in rec {
packages.x86_64-linux."${pname}-unwrapped" = pkgs.rustPlatform.buildRustPackage ({
inherit pname version;
src = ./.;
2023-07-01 20:05:33 -04:00
cargoLock = {
lockFile = ./Cargo.lock;
};
2023-06-30 16:33:41 -04:00
} // 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};
2023-07-01 19:03:41 -04:00
devShells.x86_64-linux.default = pkgs.mkShell {
inherit (buildDeps) buildInputs LIBCLANG_PATH;
nativeBuildInputs = buildDeps.nativeBuildInputs ++ (with pkgs; [
cargo-audit
clippy
rustfmt
]);
};
};
}