Revamp nix packaging

This commit is contained in:
2025-03-21 15:12:06 +01:00
parent 07e842660b
commit bbe4cf05cb
3 changed files with 28 additions and 16 deletions

View File

@@ -1,22 +1,35 @@
{
lib
, fetchFromGitHub
, stdenv
, buildPackages
, rustPlatform
, makeWrapper
, mpv
, installShellFiles
}:
let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in
rustPlatform.buildRustPackage rec {
pname = "thumbctl";
version = "0.1.0";
pname = cargoToml.package.name;
version = cargoToml.package.version;
src = lib.cleanSource ./.;
nativeBuildInputs = [ makeWrapper ];
cargoLock.lockFile = ./Cargo.lock;
cargoHash = "";
nativeBuildInputs = [
installShellFiles
];
postInstall = let
emulator = stdenv.hostPlatform.emulator buildPackages;
in ''
installShellCompletion --cmd thumbctl \
--bash <(${emulator} $out/bin/thumbctl generate-completions --shell bash) \
--zsh <(${emulator} $out/bin/thumbctl generate-completions --shell zsh) \
--fish <(${emulator} $out/bin/thumbctl generate-completions --shell fish)
'';
meta = with lib; {
license = licenses.mit;
license = licenses.gpl3Only;
maintainers = with maintainers; [ h7x4 ];
platforms = platforms.linux;
mainProgram = "thumbctl";