Read nix package name and version from Cargo.toml

This commit is contained in:
Skye 2024-11-14 16:53:43 -05:00
parent d41aa2ab41
commit c642e25256

View file

@ -11,24 +11,26 @@
devShells."${system}".default = devShells."${system}".default =
pkgs.mkShell { packages = [ pkgs.mkvtoolnix-cli ]; }; pkgs.mkShell { packages = [ pkgs.mkvtoolnix-cli ]; };
overlays.default = final: prev: { overlays.default = final: prev:
subtitle-merge = final.rustPlatform.buildRustPackage { let cargo-toml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
name = "subtitle-merge"; in {
version = "0.1"; subtitle-merge = final.rustPlatform.buildRustPackage {
src = ./.; pname = cargo-toml.package.name;
cargoLock.lockFile = ./Cargo.lock; version = cargo-toml.package.version;
buildInputs = builtins.attrValues { src = ./.;
inherit (final) installShellFiles mkvtoolnix-cli; cargoLock.lockFile = ./Cargo.lock;
}; buildInputs = builtins.attrValues {
inherit (final) installShellFiles mkvtoolnix-cli;
};
postInstall = '' postInstall = ''
installShellCompletion --cmd subtitle-merge \ installShellCompletion --cmd subtitle-merge \
--bash ./target/release-tmp/build/*/out/subtitle-merge.bash \ --bash ./target/release-tmp/build/*/out/subtitle-merge.bash \
--fish ./target/release-tmp/build/*/out/subtitle-merge.fish \ --fish ./target/release-tmp/build/*/out/subtitle-merge.fish \
--zsh ./target/release-tmp/build/*/out/_subtitle-merge --zsh ./target/release-tmp/build/*/out/_subtitle-merge
''; '';
};
}; };
};
packages."${system}" = rec { packages."${system}" = rec {
inherit (overlays.default pkgs pkgs) subtitle-merge; inherit (overlays.default pkgs pkgs) subtitle-merge;