mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-26 10:14:48 +00:00
radicle-ci-broker: init at 0.21.0
(cherry picked from commit 9a70845186)
This commit is contained in:
73
pkgs/by-name/ra/radicle-ci-broker/package.nix
Normal file
73
pkgs/by-name/ra/radicle-ci-broker/package.nix
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromRadicle,
|
||||
stdenv,
|
||||
jq,
|
||||
gitMinimal,
|
||||
sqlite,
|
||||
radicle-node,
|
||||
versionCheckHook,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "radicle-ci-broker";
|
||||
version = "0.21.0";
|
||||
|
||||
src = fetchFromRadicle {
|
||||
seed = "seed.radicle.xyz";
|
||||
repo = "zwTxygwuz5LDGBq255RA2CbNGrz8";
|
||||
node = "z6MkgEMYod7Hxfy9qCvDv5hYHkZ4ciWmLFgfvm3Wn1b2w2FV";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-c0Qo6dnR9rP4mLXODkNZp+AnhKS0tqJeh1KgzfHBRV4=";
|
||||
leaveDotGit = true;
|
||||
postFetch = ''
|
||||
git -C $out rev-parse --short HEAD > $out/.git_head
|
||||
rm -rf $out/.git
|
||||
'';
|
||||
};
|
||||
|
||||
cargoHash = "sha256-9MkZh1hlHgLC9rGmLx5ehtLtZfhXsCqrJrCJNr1edBU=";
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace build.rs \
|
||||
--replace-fail "let hash = " "let hash = \"$(<$src/.git_head)\"; "
|
||||
'';
|
||||
|
||||
preCheck = ''
|
||||
ln -s "$PWD/target/${stdenv.hostPlatform.rust.rustcTarget}/$cargoBuildType" target/debug
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [
|
||||
jq
|
||||
gitMinimal
|
||||
sqlite
|
||||
radicle-node
|
||||
];
|
||||
|
||||
checkFlags = [
|
||||
"--skip=acceptance_criteria_for_upgrades"
|
||||
"--skip=logs_adapter_stderr_output"
|
||||
"--skip=process_queued_events"
|
||||
"--skip=runs_adapter_with_configuration"
|
||||
];
|
||||
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
versionCheckProgram = "${placeholder "out"}/bin/cib";
|
||||
versionCheckProgramArg = "--version";
|
||||
doInstallCheck = true;
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = {
|
||||
description = "Radicle CI broker";
|
||||
homepage = "https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:zwTxygwuz5LDGBq255RA2CbNGrz8";
|
||||
changelog = "https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:zwTxygwuz5LDGBq255RA2CbNGrz8/tree/NEWS.md";
|
||||
license = with lib.licenses; [
|
||||
mit
|
||||
asl20
|
||||
];
|
||||
maintainers = with lib.maintainers; [ defelo ];
|
||||
mainProgram = "cib";
|
||||
};
|
||||
})
|
||||
18
pkgs/by-name/ra/radicle-ci-broker/update.sh
Executable file
18
pkgs/by-name/ra/radicle-ci-broker/update.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p coreutils gnused gitMinimal nix-update
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
dirname="$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
url=$(nix-instantiate --eval --raw -A radicle-ci-broker.src.url)
|
||||
old_node=$(nix-instantiate --eval --raw -A radicle-ci-broker.src.node)
|
||||
|
||||
ref=$(git ls-remote "$url" 'refs/namespaces/*/refs/tags/v*' \
|
||||
| cut -f2 | grep -Ev '\^\{\}$' | sort -t/ -k6rV | head -1)
|
||||
[[ "$ref" =~ ^refs/namespaces/([^/]+)/refs/tags/v([^/]+)$ ]]
|
||||
new_node="${BASH_REMATCH[1]}"
|
||||
version="${BASH_REMATCH[2]}"
|
||||
|
||||
sed -i "s/${old_node}/${new_node}/g" "${dirname}/package.nix"
|
||||
nix-update --version="$version" radicle-ci-broker
|
||||
Reference in New Issue
Block a user