subtitle-merge/flake.nix

42 lines
1.4 KiB
Nix
Raw Normal View History

2024-11-13 20:35:07 +00:00
{
2024-11-14 21:41:02 +00:00
inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; };
2024-11-13 20:35:07 +00:00
outputs = { self, nixpkgs }:
2024-11-14 21:41:02 +00:00
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
inherit (pkgs) lib;
system = "x86_64-linux";
2024-11-13 20:35:07 +00:00
in rec {
formatter."${system}" = pkgs.nixfmt-rfc-style;
2024-11-14 21:41:02 +00:00
devShells."${system}".default =
pkgs.mkShell { packages = [ pkgs.mkvtoolnix-cli ]; };
2024-11-13 20:35:07 +00:00
overlays.default = final: prev:
let cargo-toml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in {
subtitle-merge = final.rustPlatform.buildRustPackage {
pname = cargo-toml.package.name;
version = cargo-toml.package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
buildInputs = builtins.attrValues {
inherit (final) installShellFiles;
};
env.mkvmerge = "${final.mkvtoolnix-cli}/bin/mkvmerge";
postInstall = ''
installShellCompletion --cmd subtitle-merge \
--bash ./target/release-tmp/build/*/out/subtitle-merge.bash \
--fish ./target/release-tmp/build/*/out/subtitle-merge.fish \
--zsh ./target/release-tmp/build/*/out/_subtitle-merge
'';
};
2024-11-13 20:35:07 +00:00
};
packages."${system}" = rec {
inherit (overlays.default pkgs pkgs) subtitle-merge;
2024-11-13 20:35:07 +00:00
default = subtitle-merge;
};
};
}