nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 91 lines 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchYarnDeps, 6 nodejs, 7 yarnConfigHook, 8 yarnBuildHook, 9 nix-update-script, 10 extraBuildEnv ? { }, 11 # This package contains serveral sub-applications. This specifies which of them you want to build. 12 enteApp ? "photos", 13 # Accessing some apps (such as account) directly will result in a hardcoded redirect to ente.io. 14 # To prevent users from accidentally logging in to ente.io instead of the selfhosted instance, you 15 # can set this parameter to override these occurrences with your own url. Must include the schema. 16 # Example: https://my-ente.example.com 17 enteMainUrl ? null, 18}: 19 20stdenv.mkDerivation (finalAttrs: { 21 pname = "ente-web-${enteApp}"; 22 version = "1.2.22"; 23 24 src = fetchFromGitHub { 25 owner = "ente-io"; 26 repo = "ente"; 27 sparseCheckout = [ "web" ]; 28 tag = "photos-v${finalAttrs.version}"; 29 fetchSubmodules = true; 30 hash = "sha256-ckrACrgQ9qj6e44QifiUPtldBbDVrKv29s5oQ1Y+gvk="; 31 }; 32 sourceRoot = "${finalAttrs.src.name}/web"; 33 34 offlineCache = fetchYarnDeps { 35 yarnLock = "${finalAttrs.src}/web/yarn.lock"; 36 hash = "sha256-omFNobZ+2hb1cEO2Gfn+F3oYy7UDSrtIY4cliQ80CUs="; 37 }; 38 39 nativeBuildInputs = [ 40 yarnConfigHook 41 yarnBuildHook 42 nodejs 43 ]; 44 45 # See: https://github.com/ente-io/ente/blob/main/web/apps/photos/.env 46 env = extraBuildEnv; 47 48 # Replace hardcoded ente.io urls if desired 49 postPatch = lib.optionalString (enteMainUrl != null) '' 50 substituteInPlace \ 51 apps/payments/src/services/billing.ts \ 52 apps/photos/src/pages/shared-albums.tsx \ 53 --replace-fail "https://ente.io" ${lib.escapeShellArg enteMainUrl} 54 55 substituteInPlace \ 56 apps/accounts/src/pages/index.tsx \ 57 --replace-fail "https://web.ente.io" ${lib.escapeShellArg enteMainUrl} 58 ''; 59 60 yarnBuildScript = "build:${enteApp}"; 61 installPhase = 62 let 63 distName = if enteApp == "payments" then "dist" else "out"; 64 in 65 '' 66 runHook preInstall 67 68 cp -r apps/${enteApp}/${distName} $out 69 70 runHook postInstall 71 ''; 72 73 passthru.updateScript = nix-update-script { 74 extraArgs = [ 75 "--version-regex" 76 "photos-v(.*)" 77 ]; 78 }; 79 80 meta = { 81 description = "Ente application web frontends"; 82 homepage = "https://ente.io/"; 83 changelog = "https://github.com/ente-io/ente/releases"; 84 license = lib.licenses.agpl3Only; 85 maintainers = with lib.maintainers; [ 86 pinpox 87 oddlama 88 ]; 89 platforms = lib.platforms.all; 90 }; 91})