Unverified Commit 1f41e4ff authored by Wael Nasreddine's avatar Wael Nasreddine Committed by GitHub
Browse files

ncps: install dbmate-wrapper for ncps as dbmate-ncps (#478002)

parents 24e632b5 45b9bf98
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -5,15 +5,32 @@
  fetchFromGitHub,
  jq,
  lib,
  makeWrapper,
  mariadb,
  minio,
  minio-client,
  postgresql,
  python3,
  redis,
  writeShellScriptBin,
}:

let
  dbmate-real = writeShellScriptBin "dbmate.real" ''
    exec ${dbmate}/bin/dbmate "$@"
  '';

  dbmate-wrapper = buildGoModule {
    pname = "ncps-dbmate-wrapper";
    inherit (finalAttrs) version;

    src = "${finalAttrs.src}/nix/dbmate-wrapper/src";

    vendorHash = null;

    subPackages = [ "." ];
  };

  finalAttrs = {
    pname = "ncps";
    version = "0.6.0";
@@ -46,6 +63,7 @@ let
      postgresql # PostgreSQL for integration tests
      python3 # used for generating the ports
      redis # Redis for distributed locking integration tests
      makeWrapper # For wrapping dbmate.
    ];

    # pre and post checks
@@ -68,6 +86,11 @@ let
    postInstall = ''
      mkdir -p $out/share/ncps
      cp -r db $out/share/ncps/db

      makeWrapper ${dbmate-wrapper}/bin/dbmate-wrapper \
        $out/bin/dbmate-ncps \
        --prefix PATH : ${dbmate-real}/bin \
        --set NCPS_DB_MIGRATIONS_DIR $out/share/ncps/db/migrations
    '';

    meta = {