Merge pull request #132791 from kidonng/now-cli
This commit is contained in:
commit
52b03ba7d2
@ -1,87 +0,0 @@
|
|||||||
{ stdenv, lib, fetchurl }:
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "now-cli";
|
|
||||||
version = "15.8.7";
|
|
||||||
|
|
||||||
# TODO: switch to building from source, if possible
|
|
||||||
src = fetchurl {
|
|
||||||
url = "https://github.com/zeit/now-cli/releases/download/${version}/now-linux.gz";
|
|
||||||
sha256 = "1x6nsn9qmsy4hk7l2dsyabc7fxkwwwl1y1852vs4dgxi8w1hax93";
|
|
||||||
};
|
|
||||||
|
|
||||||
sourceRoot = ".";
|
|
||||||
unpackCmd = ''
|
|
||||||
gunzip -c $curSrc > now-linux
|
|
||||||
'';
|
|
||||||
|
|
||||||
dontBuild = true;
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir $out
|
|
||||||
mkdir $out/bin
|
|
||||||
cp now-linux $out/bin/now
|
|
||||||
'';
|
|
||||||
|
|
||||||
# now is a node program packaged using zeit/pkg.
|
|
||||||
# thus, it contains hardcoded offsets.
|
|
||||||
# patchelf shifts these locations when it expands headers.
|
|
||||||
|
|
||||||
# this could probably be generalised into allowing any program packaged
|
|
||||||
# with zeit/pkg to be run on nixos.
|
|
||||||
|
|
||||||
preFixup = let
|
|
||||||
libPath = lib.makeLibraryPath [stdenv.cc.cc];
|
|
||||||
in ''
|
|
||||||
|
|
||||||
orig_size=$(stat --printf=%s $out/bin/now)
|
|
||||||
|
|
||||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/now
|
|
||||||
patchelf --set-rpath ${libPath} $out/bin/now
|
|
||||||
chmod +x $out/bin/now
|
|
||||||
|
|
||||||
new_size=$(stat --printf=%s $out/bin/now)
|
|
||||||
|
|
||||||
###### zeit-pkg fixing starts here.
|
|
||||||
# we're replacing plaintext js code that looks like
|
|
||||||
# PAYLOAD_POSITION = '1234 ' | 0
|
|
||||||
# [...]
|
|
||||||
# PRELUDE_POSITION = '1234 ' | 0
|
|
||||||
# ^-----20-chars-----^^------22-chars------^
|
|
||||||
# ^-- grep points here
|
|
||||||
#
|
|
||||||
# var_* are as described above
|
|
||||||
# shift_by seems to be safe so long as all patchelf adjustments occur
|
|
||||||
# before any locations pointed to by hardcoded offsets
|
|
||||||
|
|
||||||
var_skip=20
|
|
||||||
var_select=22
|
|
||||||
shift_by=$(expr $new_size - $orig_size)
|
|
||||||
|
|
||||||
function fix_offset {
|
|
||||||
# $1 = name of variable to adjust
|
|
||||||
location=$(grep -obUam1 "$1" $out/bin/now | cut -d: -f1)
|
|
||||||
location=$(expr $location + $var_skip)
|
|
||||||
|
|
||||||
value=$(dd if=$out/bin/now iflag=count_bytes,skip_bytes skip=$location \
|
|
||||||
bs=1 count=$var_select status=none)
|
|
||||||
value=$(expr $shift_by + $value)
|
|
||||||
|
|
||||||
echo -n $value | dd of=$out/bin/now bs=1 seek=$location conv=notrunc
|
|
||||||
}
|
|
||||||
|
|
||||||
fix_offset PAYLOAD_POSITION
|
|
||||||
fix_offset PRELUDE_POSITION
|
|
||||||
|
|
||||||
'';
|
|
||||||
dontStrip = true;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
homepage = "https://zeit.co/now";
|
|
||||||
description = "The Command Line Interface for Now - Global Serverless Deployments";
|
|
||||||
license = licenses.asl20;
|
|
||||||
platforms = platforms.linux;
|
|
||||||
maintainers = [ maintainers.bhall ];
|
|
||||||
};
|
|
||||||
}
|
|
@ -526,6 +526,7 @@ mapAliases ({
|
|||||||
nmap-unfree = nmap; # added 2021-04-06
|
nmap-unfree = nmap; # added 2021-04-06
|
||||||
nologin = shadow; # added 2018-04-25
|
nologin = shadow; # added 2018-04-25
|
||||||
nordic-polar = throw "nordic-polar was removed on 2021-05-27, now integrated in nordic"; # added 2021-05-27
|
nordic-polar = throw "nordic-polar was removed on 2021-05-27, now integrated in nordic"; # added 2021-05-27
|
||||||
|
now-cli = throw "now-cli has been replaced with nodePackages.vercel"; # added 2021-08-05
|
||||||
nxproxy = nx-libs; # added 2019-02-15
|
nxproxy = nx-libs; # added 2019-02-15
|
||||||
nylas-mail-bin = throw "nylas-mail-bin was deprecated on 2019-09-11: abandoned by upstream";
|
nylas-mail-bin = throw "nylas-mail-bin was deprecated on 2019-09-11: abandoned by upstream";
|
||||||
oauth2_proxy = oauth2-proxy; # added 2021-04-18
|
oauth2_proxy = oauth2-proxy; # added 2021-04-18
|
||||||
|
@ -6701,8 +6701,6 @@ with pkgs;
|
|||||||
nodejs = pkgs.nodejs;
|
nodejs = pkgs.nodejs;
|
||||||
});
|
});
|
||||||
|
|
||||||
now-cli = callPackage ../development/web/now-cli {};
|
|
||||||
|
|
||||||
np2kai = callPackage ../misc/emulators/np2kai { };
|
np2kai = callPackage ../misc/emulators/np2kai { };
|
||||||
|
|
||||||
ox = callPackage ../applications/editors/ox { };
|
ox = callPackage ../applications/editors/ox { };
|
||||||
|
Loading…
Reference in New Issue
Block a user