Merge pull request #260712 from anton-dessiatov/tilt-assets

tilt: fix missing assets
This commit is contained in:
Guillaume Girol 2023-10-28 18:19:14 +02:00 committed by GitHub
commit 507ced649b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 100 additions and 28 deletions

View File

@ -0,0 +1,53 @@
{ lib
, stdenvNoCC
, version, src
, fetchYarnDeps
, fixup_yarn_lock, yarn, nodejs
}:
stdenvNoCC.mkDerivation rec {
pname = "tilt-assets";
inherit src version;
nativeBuildInputs = [ fixup_yarn_lock yarn nodejs ];
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/web/yarn.lock";
hash = "sha256-UTxglGn3eIgahZg4kxolg2f2MTReCL4r/GyWNg4105E=";
};
configurePhase = ''
export HOME=$(mktemp -d)/yarn_home
'';
buildPhase = ''
runHook preBuild
yarn config --offline set yarn-offline-mirror $yarnOfflineCache
cd web
fixup_yarn_lock yarn.lock
yarn install --offline --frozen-lockfile --ignore-engines
patchShebangs node_modules
export PATH=$PWD/node_modules/.bin:$PATH
./node_modules/.bin/react-scripts build
mkdir -p $out
cd ..
runHook postBuild
'';
installPhase = ''
cp -r web/build/* $out
'';
meta = with lib; {
description = "Assets needed for Tilt";
homepage = "https://tilt.dev/";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ anton-dessiatov ];
platforms = platforms.all;
};
}

View File

@ -0,0 +1,31 @@
{ lib
, buildGoModule
, src, version
, tilt-assets
}:
buildGoModule rec {
pname = "tilt";
/* Do not use "dev" as a version. If you do, Tilt will consider itself
running in development environment and try to serve assets from the
source tree, which is not there once build completes. */
inherit src version;
vendorHash = null;
subPackages = [ "cmd/tilt" ];
ldflags = [ "-X main.version=${version}" ];
preBuild = ''
mkdir -p pkg/assets/build
cp -r ${tilt-assets}/* pkg/assets/build/
'';
meta = {
description = "Local development tool to manage your developer instance when your team deploys to Kubernetes in production";
homepage = "https://tilt.dev/";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ anton-dessiatov ];
};
}

View File

@ -1,32 +1,20 @@
{ lib
, buildGoModule
, fetchFromGitHub
{ fetchFromGitHub
, callPackage
}:
let args = rec {
/* Do not use "dev" as a version. If you do, Tilt will consider itself
running in development environment and try to serve assets from the
source tree, which is not there once build completes. */
version = "0.33.6";
buildGoModule rec {
pname = "tilt";
/* Do not use "dev" as a version. If you do, Tilt will consider itself
running in development environment and try to serve assets from the
source tree, which is not there once build completes. */
version = "0.33.6";
src = fetchFromGitHub {
owner = "tilt-dev";
repo = "tilt";
rev = "v${version}";
hash = "sha256-WtE8ExUKFRtdYeg0+My/DB+L/qT+J1EaKHKChNjC5oI=";
};
};
src = fetchFromGitHub {
owner = "tilt-dev";
repo = "tilt";
rev = "v${version}";
hash = "sha256-WtE8ExUKFRtdYeg0+My/DB+L/qT+J1EaKHKChNjC5oI=";
};
tilt-assets = callPackage ./assets.nix args;
in callPackage ./binary.nix (args // { inherit tilt-assets; })
vendorHash = null;
subPackages = [ "cmd/tilt" ];
ldflags = [ "-X main.version=${version}" ];
meta = {
description = "Local development tool to manage your developer instance when your team deploys to Kubernetes in production";
homepage = "https://tilt.dev/";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ anton-dessiatov ];
};
}