For self-hosting i would like to wrap a db migration application like dbmate
with data (sql scripts); my goal is to write a one-off migration systemd service. I tried
pkgs.stdenv.mkDerivation {
pname = "dbmigrate";
version = "1.0.0";
src = ./.;
buildInputs = [ pkgs.dbmate pkgs.makeWrapper ];
installPhase = ''
mkdir -p $out/db/migrations
cp -r ${./db/migrations}/* $out/db/migrations/
'';
postFixup = ''
makeWrapper "${pkgs.dbmate}/bin/dbmate" $out/bin/dbmigrate \
--set DBMATE_MIGRATIONS_DIR $out/db/migrations \
--add-flags "--no-dump-schema" \
--add-flags "--wait" \
--add-flags "up"
'';
};
which builds ./result
folder structure that looks correct, but doesn’t do anything when run (or at least i don’t receive any error message). What am i doing wrong or rather what is the best approach for such a setup?