lisp-scripts/nix/sync-music.nix
2024-11-11 18:36:30 -08:00

72 lines
1.3 KiB
Nix

{
sbcl,
lib,
writeText,
libcue,
ffmpeg-headless,
makeWrapper,
}: let
sync-music = sbcl.buildASDFSystem rec {
pname = "sync-music";
version = "dev";
src = lib.cleanSource ../.;
lispLibs = with sbcl.pkgs; [
alexandria
babel
cffi
cffi-grovel
cl-ppcre
fset
lparallel
pathname-utils
serapeum
trivial-features
uax-15
unix-opts
];
nativeBuildInputs = [
makeWrapper
];
nativeLibs = [
(libcue.overrideAttrs {
cmakeFlags = [
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
];
})
];
runtimeInputs = [
ffmpeg-headless
];
buildScript = writeText "build-sync-music.lisp" ''
(load "${sync-music.asdfFasl}/asdf.${sync-music.faslExt}")
(asdf:load-system :sync-music/cli)
(setf uiop:*image-entry-point* #'sync-music/cli:main)
(uiop:dump-image "main" :executable t)
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -va main $out/bin/sync-music
runHook postInstall
'';
postFixup = ''
wrapProgram $out/bin/sync-music \
--prefix PATH : ${lib.makeBinPath runtimeInputs} \
--prefix LD_LIBRARY_PATH : $LD_LIBRARY_PATH
'';
meta.mainProgram = "sync-music";
};
in
sync-music