nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 61 lines 1.7 kB view raw
1{ yarn2nix-moretea 2, fetchFromGitHub, applyPatches 3}: 4 5yarn2nix-moretea.mkYarnPackage rec { 6 pname = "gotify-ui"; 7 8 packageJSON = ./package.json; 9 yarnNix = ./yarndeps.nix; 10 11 version = import ./version.nix; 12 13 src_all = applyPatches { 14 src = fetchFromGitHub { 15 owner = "gotify"; 16 repo = "server"; 17 rev = "v${version}"; 18 sha256 = import ./source-sha.nix; 19 }; 20 postPatch = '' 21 substituteInPlace ui/yarn.lock \ 22 --replace \ 23 "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001237.tgz" \ 24 "https___registry.npmjs.org_caniuse_lite___caniuse_lite_1.0.30001237.tgz" 25 ''; 26 }; 27 src = "${src_all}/ui"; 28 29 buildPhase = '' 30 export HOME=$(mktemp -d) 31 export WRITABLE_NODE_MODULES="$(pwd)/tmp" 32 mkdir -p "$WRITABLE_NODE_MODULES" 33 34 # react-scripts requires a writable node_modules/.cache, so we have to copy the symlink's contents back 35 # into `node_modules/`. 36 # See https://github.com/facebook/create-react-app/issues/11263 37 cd deps/gotify-ui 38 node_modules="$(readlink node_modules)" 39 rm node_modules 40 mkdir -p "$WRITABLE_NODE_MODULES"/.cache 41 cp -r $node_modules/* "$WRITABLE_NODE_MODULES" 42 43 # In `node_modules/.bin` are relative symlinks that would be broken after copying them over, 44 # so we take care of them here. 45 mkdir -p "$WRITABLE_NODE_MODULES"/.bin 46 for x in "$node_modules"/.bin/*; do 47 ln -sfv "$node_modules"/.bin/"$(readlink "$x")" "$WRITABLE_NODE_MODULES"/.bin/"$(basename "$x")" 48 done 49 50 ln -sfv "$WRITABLE_NODE_MODULES" node_modules 51 cd ../.. 52 53 yarn build 54 55 cd deps/gotify-ui 56 rm -rf node_modules 57 ln -sf $node_modules node_modules 58 cd ../.. 59 ''; 60 61}