Unverified Commit 230bb1ac authored by annalee's avatar annalee
Browse files

warp-terminal: fix update.sh

can not use `import <nixpkgs>` on update machine as `<nixpkgs>` does not
exist. therefore cd to the `warp-terminal` directory and use the
relative path to nixpkgs root.

https://r.ryantm.com/log/warp-terminal/2024-03-19.log
parent e1ad9897
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -3,7 +3,8 @@
#shellcheck shell=bash
set -eu -o pipefail

dirname="$(dirname "$0")"
cd "$(dirname "$0")"
nixpkgs=../../../../.

err() {
    echo "$*" >&2
@@ -11,11 +12,11 @@ err() {
}

json_get() {
    jq -r "$1" < "$dirname/versions.json"
    jq -r "$1" < "./versions.json"
}

json_set() {
    jq --arg x "$2" "$1 = \$x" < "$dirname/versions.json" | sponge "$dirname/versions.json"
    jq --arg x "$2" "$1 = \$x" < "./versions.json" | sponge "./versions.json"
}

resolve_url() {
@@ -53,10 +54,10 @@ get_version() {
sri_get() {
    local ouput sri
    output=$(nix-build  --expr \
        'with import <nixpkgs>{};
        "with import $nixpkgs {};
         fetchurl {
           url = "'"$1"'";
         }' 2>&1 || true)
           url = \"$1\";
         }" 2>&1 || true)
    sri=$(echo "$output" | awk '/^\s+got:\s+/{ print $2 }')
    [[ -z "$sri" ]] && err "$output"
    echo "$sri"