Commit 01f85c14 authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt
Browse files

spade: update updateScript

parent 7638a48c
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
  rustPlatform,
  fetchFromGitLab,
  stdenv,
  _experimental-update-script-combinators,
  nix-update-script,
  nix-update,
  writeScript,
  git,
@@ -30,16 +32,23 @@ rustPlatform.buildRustPackage rec {
    };
  };

  # rust + gitlab is a rare combo
  passthru.updateScript = [
  # TODO: somehow respect https://nixos.org/manual/nixpkgs/stable/#var-passthru-updateScript-commit
  passthru.updateScript = _experimental-update-script-combinators.sequence [
    # rust + gitlab + fetchgit is a rare combo
    (writeScript "update-spade" ''
      VERSION="$(
        ${lib.getExe git} ls-remote --tags --sort -version:refname ${lib.escapeShellArg src.gitRepoUrl} \
          | cut -f2 | grep ^refs/tags/v | cut -d/ -f3- | cut -c2- \
          | sort --version-sort --reverse | head -n1
      )"
      exec ${lib.getExe nix-update} --version "$VERSION" "$@"
      exec ${lib.getExe nix-update} spade --version "$VERSION" "$@" --commit
    '')
    (nix-update-script {
      extraArgs = [
        "swim"
        "--commit"
      ];
    })
  ];

  buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ python312 ];
+3 −6
Original line number Diff line number Diff line
@@ -8,8 +8,6 @@
  stdenv,
  darwin,
  git,
  _experimental-update-script-combinators,
  nix-update-script,
}:

rustPlatform.buildRustPackage rec {
@@ -56,10 +54,9 @@ rustPlatform.buildRustPackage rec {
    "--skip=plugin::test::deny_changes_to_plugins::restores_work"
  ];

  passthru.updateScript = _experimental-update-script-combinators.sequence [
    (nix-update-script { extraArgs = [ "spade" "--commit" "--use-update-script" "--update-script-args" "--argstr skip-prompt true" ]; })
    (nix-update-script { extraArgs = [ "swim" ]; })
  ];
  passthru = {
    inherit (spade) updateScript;
  };

  meta = {
    description = "Build tool for spade";