Unverified Commit eed6c1aa authored by Cosima Neidahl's avatar Cosima Neidahl Committed by GitHub
Browse files

treewide: Fix passthru.updateScripts of NGI-maintained derivations (#444745)

parents 76bec615 fbb4b240
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -27,7 +27,11 @@ buildNpmPackage (finalAttrs: {
    cp ${./package-lock.json} ./package-lock.json
  '';

  passthru.updateScript = nix-update-script { };
  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--generate-lockfile"
    ];
  };

  meta = {
    description = "Concise multiwriter for data structures with Hypercore";
+18 −3
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  unstableGitUpdater,
  makeWrapper,
  nix-update-script,
  writeShellApplication,
  _experimental-update-script-combinators,
  nix,
  serve,
  stdenv,
  xsel,
@@ -48,8 +51,20 @@ stdenv.mkDerivation (finalAttrs: {
      --chdir $out
  '';

  passthru.updateScript = nix-update-script {
    extraArgs = [ "--version=branch" ];
  passthru = {
    updateScriptSrc = unstableGitUpdater { };
    updateScriptDeps = writeShellApplication {
      name = "update-dokieli-berry-deps";
      runtimeInputs = [
        nix
        yarn-berry.yarn-berry-fetcher
      ];
      text = lib.strings.readFile ./updateDeps.sh;
    };
    updateScript = _experimental-update-script-combinators.sequence [
      finalAttrs.passthru.updateScriptSrc
      (lib.getExe finalAttrs.passthru.updateScriptDeps)
    ];
  };

  meta = {
+28 −0
Original line number Diff line number Diff line
#!usr/bin/env bash

export UPDATE_NIX_ATTR_PATH="${UPDATE_NIX_ATTR_PATH:-dokieli}"

oldversion="${UPDATE_NIX_OLD_VERSION-}"
newversion="$(nix-instantiate . --eval --strict -A "$UPDATE_NIX_ATTR_PATH.version" | cut -d'"' -f2)"

if [ "$oldversion" == "$newversion" ]; then
  echo "No new version."
  exit 0
fi

workdir="$(mktemp -d)"

# File to replace stuff in
fname="$(nix-instantiate --eval -E "with import ./. {}; (builtins.unsafeGetAttrPos \"version\" $UPDATE_NIX_ATTR_PATH).file" | cut -d'"' -f2)"

oldhash="$(nix-instantiate . --eval --strict -A "$UPDATE_NIX_ATTR_PATH.offlineCache.outputHash" | cut -d'"' -f2)"

newsource="$(nix-build -A "$UPDATE_NIX_ATTR_PATH".src)"

yarn-berry-fetcher missing-hashes "$newsource"/yarn.lock > "$workdir"/missing-hashes.json
newhash="$(yarn-berry-fetcher prefetch "$newsource"/yarn.lock "$workdir"/missing-hashes.json)"

sed -i "$fname" \
  -e "s|$oldhash|$newhash|g"

mv "$workdir"/missing-hashes.json "$(dirname "$fname")"/missing-hashes.json
+5 −1
Original line number Diff line number Diff line
@@ -24,7 +24,11 @@ buildNpmPackage (finalAttrs: {
    cp ${./package-lock.json} ./package-lock.json
  '';

  passthru.updateScript = nix-update-script { };
  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--generate-lockfile"
    ];
  };

  meta = {
    description = "Secure, distributed append-only log";
+5 −1
Original line number Diff line number Diff line
@@ -24,7 +24,11 @@ buildNpmPackage (finalAttrs: {
    cp ${./package-lock.json} ./package-lock.json
  '';

  passthru.updateScript = nix-update-script { };
  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--generate-lockfile"
    ];
  };

  meta = {
    description = "Distributed Networking Stack for Connecting Peers";
Loading