lisp-scripts/nix/sync-music.nix

72 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2024-10-27 23:44:59 -07:00
{
sbcl,
lib,
writeText,
libcue,
ffmpeg-headless,
2024-10-27 23:44:59 -07:00
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
2024-10-27 23:44:59 -07:00
fset
lparallel
pathname-utils
serapeum
trivial-features
2024-10-27 23:44:59 -07:00
uax-15
unix-opts
];
nativeBuildInputs = [
makeWrapper
];
nativeLibs = [
(libcue.overrideAttrs {
cmakeFlags = [
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
];
})
];
2024-10-27 23:44:59 -07:00
runtimeInputs = [
ffmpeg-headless
2024-10-27 23:44:59 -07:00
];
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)
2024-10-28 16:00:52 -07:00
(uiop:dump-image "main" :executable t)
2024-10-27 23:44:59 -07:00
'';
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
2024-10-27 23:44:59 -07:00
'';
meta.mainProgram = "sync-music";
};
in
sync-music