Skip to content

Commit

Permalink
spade: update updateScript
Browse files Browse the repository at this point in the history
  • Loading branch information
pbsds committed Sep 28, 2024
1 parent 7638a48 commit 01f85c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
15 changes: 12 additions & 3 deletions pkgs/by-name/sp/spade/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
rustPlatform,
fetchFromGitLab,
stdenv,
_experimental-update-script-combinators,
nix-update-script,
nix-update,
writeScript,
git,
Expand Down Expand Up @@ -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 ];
Expand Down
9 changes: 3 additions & 6 deletions pkgs/by-name/sw/swim/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
stdenv,
darwin,
git,
_experimental-update-script-combinators,
nix-update-script,
}:

rustPlatform.buildRustPackage rec {
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 01f85c1

Please sign in to comment.