1
0

hosts/web-2: Publish mitel-ommclient2 documentation using update-from-hydra

This commit is contained in:
clerie 2023-09-09 14:15:24 +02:00
parent e515212708
commit e2f58fd25c
4 changed files with 39 additions and 3 deletions

View File

@ -16,6 +16,7 @@
./legal.nix ./legal.nix
./meow.nix ./meow.nix
./milchinsel.nix ./milchinsel.nix
./mitel-ommclient2.nix
./ping.nix ./ping.nix
./prediger.nix ./prediger.nix
./public.nix ./public.nix

View File

@ -0,0 +1,20 @@
{ ... }: {
services.update-from-hydra.paths.mitel-ommclient2 = {
enable = true;
hydraUrl = "https://hydra.clerie.de";
hydraProject = "clerie";
hydraJobset = "mitel_ommclient2";
hydraJob = "packages.x86_64-linux.mitel-ommclient2";
buildOutput = "doc";
nixStoreUri = "https://nix-cache.clerie.de";
resultPath = "/srv/mitel-ommclient2";
};
services.nginx.virtualHosts = {
"mitel-ommclient2.clerie.de" = {
enableACME = true;
forceSSL = true;
root = "/srv/mitel-ommclient2/share/doc/mitel-ommclient2/html";
};
};
}

View File

@ -45,6 +45,14 @@ let
''; '';
}; };
buildOutput = mkOption {
type = with types; nullOr str;
default = null;
description = ''
Build output name
'';
};
nixStoreUri = mkOption { nixStoreUri = mkOption {
type = types.str; type = types.str;
description = '' description = ''
@ -85,7 +93,7 @@ in {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
script = '' script = ''
${pkgs.update-from-hydra}/bin/update-from-hydra --hydra-url "${path.hydraUrl}" --hydra-project "${path.hydraProject}" --hydra-jobset "${path.hydraJobset}" --hydra-job "${path.hydraJob}" --nix-store-uri "${path.nixStoreUri}" --gcroot-name "${name}" "${path.resultPath}" ${pkgs.update-from-hydra}/bin/update-from-hydra --hydra-url "${path.hydraUrl}" --hydra-project "${path.hydraProject}" --hydra-jobset "${path.hydraJobset}" --hydra-job "${path.hydraJob}" ${optionalString (path.buildOutput != null) "--build-output ${path.buildOutput}"} --nix-store-uri "${path.nixStoreUri}" --gcroot-name "${name}" "${path.resultPath}"
''; '';
}) })
) cfg.paths); ) cfg.paths);

View File

@ -2,6 +2,8 @@
set -euo pipefail set -euo pipefail
BUILD_OUTPUT="out"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
--hydra-url) --hydra-url)
@ -29,6 +31,11 @@ while [[ $# -gt 0 ]]; do
shift shift
shift shift
;; ;;
--build-output)
BUILD_OUTPUT="$2"
shift
shift
;;
--gcroot-name) --gcroot-name)
GCROOT_NAME="$2" GCROOT_NAME="$2"
shift shift
@ -50,13 +57,13 @@ set -- "${ARGS[@]}"
HYDRA_JOB_URL="${HYDRA_URL}/job/${HYDRA_PROJECT}/${HYDRA_JOBSET}/${HYDRA_JOB}/latest-finished" HYDRA_JOB_URL="${HYDRA_URL}/job/${HYDRA_PROJECT}/${HYDRA_JOBSET}/${HYDRA_JOB}/latest-finished"
RESULT_PATH="$1" RESULT_PATH="$1"
echo "Updating ${RESULT_PATH} from ${HYDRA_PROJECT}:${HYDRA_JOBSET}:${HYDRA_JOB}" echo "Updating ${RESULT_PATH} from ${HYDRA_PROJECT}:${HYDRA_JOBSET}:${HYDRA_JOB} output ${BUILD_OUTPUT}"
echo "Make sure symlink directory exist" echo "Make sure symlink directory exist"
mkdir -p "$(dirname "${RESULT_PATH}")" mkdir -p "$(dirname "${RESULT_PATH}")"
echo "Fetching job output" echo "Fetching job output"
STORE_PATH="$(curl -s -L -H "Accept: application/json" "${HYDRA_JOB_URL}" | jq -r .buildoutputs.out.path)" STORE_PATH="$(curl -s -L -H "Accept: application/json" "${HYDRA_JOB_URL}" | jq -r ".buildoutputs.${BUILD_OUTPUT}.path")"
echo "Copying path" echo "Copying path"
nix copy --from "${NIX_STORE_URI}" "${STORE_PATH}" nix copy --from "${NIX_STORE_URI}" "${STORE_PATH}"