diff --git a/nix/pkg.nix b/nix/pkg.nix index 6ad5b564..5224e5b9 100644 --- a/nix/pkg.nix +++ b/nix/pkg.nix @@ -1,4 +1,4 @@ -cfg: {stdenv, fetchzip, file, curl, inotifyTools, fetchurl, jdk11, bash}: +cfg: {stdenv, fetchzip, file, curl, inotifyTools, fetchurl, jdk11, bash, jq, sqlite}: let meta = with stdenv.lib; { description = "Docspell helps to organize and archive your paper documents."; @@ -60,12 +60,19 @@ in installPhase = '' mkdir -p $out/bin - cp $src/consumedir.sh $out/bin/ cp $src/ds.sh $out/bin/ds - sed -i 's,CURL_CMD="curl",CURL_CMD="${curl}/bin/curl",g' $out/bin/consumedir.sh sed -i 's,CURL_CMD="curl",CURL_CMD="${curl}/bin/curl",g' $out/bin/ds - sed -i 's,INOTIFY_CMD="inotifywait",INOTIFY_CMD="${inotifyTools}/bin/inotifywait",g' $out/bin/consumedir.sh - sed -i 's,FILE_CMD="file",FILE_CMD="${file}/bin/file",g' $out/bin/ds + + while read f; do + target="ds-$(basename "$f" ".sh")" + echo "Installing $f -> $target" + cp "$f" "$out/bin/$target" + sed -i 's,CURL_CMD="curl",CURL_CMD="${curl}/bin/curl",g' $out/bin/$target + sed -i 's,INOTIFY_CMD="inotifywait",INOTIFY_CMD="${inotifyTools}/bin/inotifywait",g' $out/bin/$target + sed -i 's,JQ_CMD="jq",JQ_CMD="${jq}/bin/jq",g' $out/bin/$target + sed -i 's,SQLITE_CMD="sqlite3",SQLITE_CMD="${sqlite}/bin/sqlite3",g' $out/bin/$target + done < <(find . -name "*.sh" -mindepth 2 -not -path "*webextension*") + chmod 755 $out/bin/* '';