pkgs: add woodpecker
This is just the same version as upstream, but following the `next` version.
This commit is contained in:
parent
281d98b295
commit
ea57ad3eb8
|
@ -41,4 +41,12 @@ pkgs.lib.makeScope pkgs.newScope (pkgs: {
|
|||
vimix-cursors = pkgs.callPackage ./vimix-cursors { };
|
||||
|
||||
volantes-cursors = pkgs.callPackage ./volantes-cursors { };
|
||||
|
||||
woodpecker-agent = pkgs.callPackage ./woodpecker/agent.nix { };
|
||||
|
||||
woodpecker-cli = pkgs.callPackage ./woodpecker/cli.nix { };
|
||||
|
||||
woodpecker-frontend = pkgs.callPackage ./woodpecker/frontend.nix { };
|
||||
|
||||
woodpecker-server = pkgs.callPackage ./woodpecker/server.nix { };
|
||||
})
|
||||
|
|
25
pkgs/woodpecker/agent.nix
Normal file
25
pkgs/woodpecker/agent.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ lib, buildGoModule, callPackage, fetchFromGitHub, fetchpatch }:
|
||||
let
|
||||
common = callPackage ./common.nix { };
|
||||
in
|
||||
buildGoModule {
|
||||
pname = "woodpecker-agent";
|
||||
inherit (common) version src ldflags postInstall vendorHash;
|
||||
|
||||
patches = [
|
||||
# https://github.com/woodpecker-ci/woodpecker/pull/1686
|
||||
(fetchpatch {
|
||||
name = "fix-local-pipeline-home.patch";
|
||||
url = "https://github.com/woodpecker-ci/woodpecker/commit/d2c9b73ebf015bfa64062b9855c33e14484ccc3e.patch";
|
||||
hash = "sha256-1wYe4+oCWiV/6W4cIbdDT+mEL9ETQmcYQZhjJASvmUk=";
|
||||
})
|
||||
];
|
||||
|
||||
subPackages = "cmd/agent";
|
||||
|
||||
CGO_ENABLED = 0;
|
||||
|
||||
meta = common.meta // {
|
||||
description = "Woodpecker Continuous Integration agent";
|
||||
};
|
||||
}
|
16
pkgs/woodpecker/cli.nix
Normal file
16
pkgs/woodpecker/cli.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ lib, buildGoModule, callPackage, fetchFromGitHub }:
|
||||
let
|
||||
common = callPackage ./common.nix { };
|
||||
in
|
||||
buildGoModule {
|
||||
pname = "woodpecker-cli";
|
||||
inherit (common) version src ldflags postInstall vendorHash;
|
||||
|
||||
subPackages = "cmd/cli";
|
||||
|
||||
CGO_ENABLED = 0;
|
||||
|
||||
meta = common.meta // {
|
||||
description = "Command line client for the Woodpecker Continuous Integration server";
|
||||
};
|
||||
}
|
38
pkgs/woodpecker/common.nix
Normal file
38
pkgs/woodpecker/common.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ lib, fetchFromGitHub }:
|
||||
let
|
||||
rev = "e7ca28026bc4576b2dd30aa2ab71c2d07dfc7197";
|
||||
srcHash = "sha256-vtttb+tRi3uDFn8liFgZcAqWLENfpTY7lWsNCoTFzEM=";
|
||||
vendorHash = "sha256-u7HT8+LeqS7mCNbUhrvSW0xd/uduL2Kw7A0mUUpW2w4=";
|
||||
yarnHash = "sha256-h+he2VxvZlStIoLb1PPxqKSmTfFNGgJmUXptjtc5xD8=";
|
||||
version = "next-${lib.substring 0 8 rev}";
|
||||
in
|
||||
{
|
||||
inherit version yarnHash vendorHash;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "woodpecker-ci";
|
||||
repo = "woodpecker";
|
||||
inherit rev;
|
||||
hash = srcHash;
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
cd $out/bin
|
||||
for f in *; do
|
||||
mv -- "$f" "woodpecker-$f"
|
||||
done
|
||||
cd -
|
||||
'';
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X github.com/woodpecker-ci/woodpecker/version.Version=${version}"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://woodpecker-ci.org/";
|
||||
license = licenses.asl20;
|
||||
maintainers = with maintainers; [ ambroisie techknowlogick ];
|
||||
};
|
||||
}
|
57
pkgs/woodpecker/frontend.nix
Normal file
57
pkgs/woodpecker/frontend.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ lib, buildPackages, callPackage, fetchFromGitHub, fetchYarnDeps, mkYarnPackage }:
|
||||
let
|
||||
common = callPackage ./common.nix { };
|
||||
|
||||
esbuild_0_17_12 = buildPackages.esbuild.overrideAttrs (oa: rec {
|
||||
version = "0.17.12";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "evanw";
|
||||
repo = "esbuild";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-75qDQWAp6cmuXtq90oIIQCj5IKUoQxNARxhFo2Sm5mk=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
|
||||
});
|
||||
in
|
||||
mkYarnPackage {
|
||||
pname = "woodpecker-frontend";
|
||||
inherit (common) version;
|
||||
|
||||
src = "${common.src}/web";
|
||||
|
||||
packageJSON = ./woodpecker-package.json;
|
||||
yarnLock = ./yarn.lock;
|
||||
|
||||
offlineCache = fetchYarnDeps {
|
||||
yarnLock = ./yarn.lock;
|
||||
hash = common.yarnHash;
|
||||
};
|
||||
|
||||
ESBUILD_BINARY_PATH = lib.getExe esbuild_0_17_12;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
yarn --offline build
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
cp -R deps/woodpecker-ci/dist $out
|
||||
echo "${common.version}" > "$out/version"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
# Do not attempt generating a tarball for woodpecker-frontend again.
|
||||
doDist = false;
|
||||
|
||||
meta = common.meta // {
|
||||
description = "Woodpecker Continuous Integration server frontend";
|
||||
};
|
||||
}
|
26
pkgs/woodpecker/server.nix
Normal file
26
pkgs/woodpecker/server.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ lib, buildGoModule, callPackage, fetchFromGitHub, woodpecker-frontend }:
|
||||
let
|
||||
common = callPackage ./common.nix { };
|
||||
in
|
||||
buildGoModule {
|
||||
pname = "woodpecker-server";
|
||||
inherit (common) version src ldflags postInstall vendorHash;
|
||||
|
||||
postPatch = ''
|
||||
cp -r ${woodpecker-frontend} web/dist
|
||||
'';
|
||||
|
||||
subPackages = "cmd/server";
|
||||
|
||||
CGO_ENABLED = 1;
|
||||
|
||||
passthru = {
|
||||
inherit woodpecker-frontend;
|
||||
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = common.meta // {
|
||||
description = "Woodpecker Continuous Integration server";
|
||||
};
|
||||
}
|
51
pkgs/woodpecker/update.sh
Executable file
51
pkgs/woodpecker/update.sh
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq nix-prefetch
|
||||
# FIXME: add pnpm-lock-export to shell
|
||||
|
||||
# shellcheck shell=bash
|
||||
|
||||
if [ -n "$GITHUB_TOKEN" ]; then
|
||||
TOKEN_ARGS=(--header "Authorization: token $GITHUB_TOKEN")
|
||||
fi
|
||||
|
||||
if [[ $# -gt 1 || $1 == -* ]]; then
|
||||
echo "Regenerates packaging data for the woodpecker packages."
|
||||
echo "Usage: $0 [git release tag]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
rev="$1"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ -z "$rev" ]; then
|
||||
rev="$(wget -O- "${TOKEN_ARGS[@]}" "https://api.github.com/repos/woodpecker-ci/woodpecker/commits?per_page=1" | jq -r '.[0].sha')"
|
||||
fi
|
||||
|
||||
# Woodpecker repository
|
||||
src_hash=$(nix-prefetch-github woodpecker-ci woodpecker --rev "${rev}" | jq -r .sha256)
|
||||
|
||||
# Go modules
|
||||
mod_hash=$(nix-prefetch '{ sha256 }: (callPackage (import ./cli.nix) { }).go-modules.overrideAttrs (_: { modHash = sha256; })')
|
||||
|
||||
# Front-end dependencies
|
||||
woodpecker_src="https://raw.githubusercontent.com/woodpecker-ci/woodpecker/$rev"
|
||||
wget "${TOKEN_ARGS[@]}" "$woodpecker_src/web/package.json" -O woodpecker-package.json
|
||||
|
||||
trap 'rm -rf pnpm-lock.yaml' EXIT
|
||||
wget "${TOKEN_ARGS[@]}" "$woodpecker_src/web/pnpm-lock.yaml"
|
||||
pnpm-lock-export --schema yarn.lock@v1
|
||||
yarn_hash=$(prefetch-yarn-deps yarn.lock)
|
||||
|
||||
# Use friendlier hashes
|
||||
src_hash=$(nix hash to-sri --type sha256 "$src_hash")
|
||||
mod_hash=$(nix hash to-sri --type sha256 "$mod_hash")
|
||||
yarn_hash=$(nix hash to-sri --type sha256 "$yarn_hash")
|
||||
|
||||
sed -i -E -e "s#rev = \".*\"#rev = \"$rev\"#" common.nix
|
||||
sed -i -E -e "s#srcHash = \".*\"#srcHash = \"$src_hash\"#" common.nix
|
||||
sed -i -E -e "s#modHash = \".*\"#modHash = \"$mod_hash\"#" common.nix
|
||||
sed -i -E -e "s#yarnHash = \".*\"#yarnHash = \"$yarn_hash\"#" common.nix
|
71
pkgs/woodpecker/woodpecker-package.json
Normal file
71
pkgs/woodpecker/woodpecker-package.json
Normal file
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"name": "woodpecker-ci",
|
||||
"author": "Woodpecker CI",
|
||||
"version": "0.0.0",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"build": "vite build",
|
||||
"serve": "vite preview",
|
||||
"lint": "eslint --max-warnings 0 --ext .js,.ts,.vue,.json .",
|
||||
"formatcheck": "prettier -c .",
|
||||
"format:fix": "prettier --write .",
|
||||
"typecheck": "vue-tsc --noEmit",
|
||||
"test": "echo 'No tests configured' && exit 0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@intlify/unplugin-vue-i18n": "^0.9.2",
|
||||
"@kyvg/vue3-notification": "^2.9.0",
|
||||
"@vueuse/core": "^9.13.0",
|
||||
"ansi_up": "^5.1.0",
|
||||
"dayjs": "^1.11.7",
|
||||
"floating-vue": "^2.0.0-beta.20",
|
||||
"fuse.js": "^6.6.2",
|
||||
"humanize-duration": "^3.28.0",
|
||||
"javascript-time-ago": "^2.5.9",
|
||||
"lodash": "^4.17.21",
|
||||
"node-emoji": "^1.11.0",
|
||||
"pinia": "^2.0.33",
|
||||
"prismjs": "^1.29.0",
|
||||
"vue": "^3.2.47",
|
||||
"vue-i18n": "^9.2.2",
|
||||
"vue-router": "^4.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify/json": "^2.2.36",
|
||||
"@types/humanize-duration": "^3.27.1",
|
||||
"@types/javascript-time-ago": "^2.0.3",
|
||||
"@types/lodash": "^4.14.191",
|
||||
"@types/node": "^18.15.3",
|
||||
"@types/node-emoji": "^1.8.2",
|
||||
"@types/prismjs": "^1.26.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
||||
"@typescript-eslint/parser": "^5.55.0",
|
||||
"@vitejs/plugin-vue": "^4.1.0",
|
||||
"@vue/compiler-sfc": "^3.2.47",
|
||||
"eslint": "^8.36.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
"eslint-config-prettier": "^8.7.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||
"eslint-plugin-vue": "^9.9.0",
|
||||
"eslint-plugin-vue-scoped-css": "^2.4.0",
|
||||
"prettier": "^2.8.5",
|
||||
"typescript": "5.0.2",
|
||||
"unplugin-icons": "^0.15.3",
|
||||
"unplugin-vue-components": "^0.24.1",
|
||||
"vite": "^4.2.0",
|
||||
"vite-plugin-prismjs": "^0.0.8",
|
||||
"vite-plugin-windicss": "^1.8.10",
|
||||
"vite-svg-loader": "^4.0.0",
|
||||
"vue-eslint-parser": "^9.1.0",
|
||||
"vue-tsc": "^1.2.0",
|
||||
"windicss": "^3.5.6"
|
||||
}
|
||||
}
|
3153
pkgs/woodpecker/yarn.lock
Normal file
3153
pkgs/woodpecker/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue