mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	flake: fix Electron version, fix Wayland support, fix source filter (#2329)
This commit is contained in:
		
						commit
						c6c48d84ab
					
				| @ -257,7 +257,7 @@ async function configureWebContents(webContents: WebContents, spellcheckEnabled: | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function getIcon() { | function getIcon() { | ||||||
|     return path.join(RESOURCE_DIR, "images/app-icons/png/256x256" + (isDev ? "-dev" : "") + ".png"); |     return path.join(RESOURCE_DIR, "../public/assets/icon.png"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function createSetupWindow() { | async function createSetupWindow() { | ||||||
|  | |||||||
							
								
								
									
										23
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								flake.nix
									
									
									
									
									
								
							| @ -21,7 +21,7 @@ | |||||||
|       system: |       system: | ||||||
|       let |       let | ||||||
|         pkgs = import nixpkgs { inherit system; }; |         pkgs = import nixpkgs { inherit system; }; | ||||||
|         electron = pkgs.electron_35; |         electron = pkgs."electron_${lib.versions.major packageJsonDesktop.devDependencies.electron}"; | ||||||
|         nodejs = pkgs.nodejs_22; |         nodejs = pkgs.nodejs_22; | ||||||
|         pnpm = pkgs.pnpm_10; |         pnpm = pkgs.pnpm_10; | ||||||
|         inherit (pkgs) |         inherit (pkgs) | ||||||
| @ -30,6 +30,7 @@ | |||||||
|           lib |           lib | ||||||
|           makeBinaryWrapper |           makeBinaryWrapper | ||||||
|           makeDesktopItem |           makeDesktopItem | ||||||
|  |           makeShellWrapper | ||||||
|           moreutils |           moreutils | ||||||
|           removeReferencesTo |           removeReferencesTo | ||||||
|           stdenv |           stdenv | ||||||
| @ -40,13 +41,13 @@ | |||||||
|         fullCleanSourceFilter = |         fullCleanSourceFilter = | ||||||
|           name: type: |           name: type: | ||||||
|           (lib.cleanSourceFilter name type) |           (lib.cleanSourceFilter name type) | ||||||
|           || ( |           && ( | ||||||
|             let |             let | ||||||
|               baseName = baseNameOf (toString name); |               baseName = baseNameOf (toString name); | ||||||
|             in |             in | ||||||
|             # No need to copy the flake. |             # No need to copy the flake. | ||||||
|             # Don't copy local development instance of NX cache. |             # Don't copy local development instance of NX cache. | ||||||
|             baseName == "flake.nix" || baseName == "flake.lock" || baseName == ".nx" |             baseName != "flake.nix" && baseName != "flake.lock" && baseName != ".nx" | ||||||
|           ); |           ); | ||||||
|         fullCleanSource = |         fullCleanSource = | ||||||
|           src: |           src: | ||||||
| @ -55,6 +56,7 @@ | |||||||
|             src = src; |             src = src; | ||||||
|           }; |           }; | ||||||
|         packageJson = builtins.fromJSON (builtins.readFile ./package.json); |         packageJson = builtins.fromJSON (builtins.readFile ./package.json); | ||||||
|  |         packageJsonDesktop = builtins.fromJSON (builtins.readFile ./apps/desktop/package.json); | ||||||
| 
 | 
 | ||||||
|         makeApp = |         makeApp = | ||||||
|           { |           { | ||||||
| @ -101,15 +103,20 @@ | |||||||
| 
 | 
 | ||||||
|             extraNativeBuildInputs = |             extraNativeBuildInputs = | ||||||
|               [ |               [ | ||||||
|                 makeBinaryWrapper |  | ||||||
|                 moreutils # sponge |                 moreutils # sponge | ||||||
|                 nodejs.python |                 nodejs.python | ||||||
|                 removeReferencesTo |                 removeReferencesTo | ||||||
|               ] |               ] | ||||||
|               ++ lib.optionals (app == "desktop") [ |               ++ lib.optionals (app == "desktop") [ | ||||||
|                 copyDesktopItems |                 copyDesktopItems | ||||||
|  |                 # required for NIXOS_OZONE_WL expansion | ||||||
|  |                 # https://github.com/NixOS/nixpkgs/issues/172583 | ||||||
|  |                 makeShellWrapper | ||||||
|                 wrapGAppsHook3 |                 wrapGAppsHook3 | ||||||
|               ] |               ] | ||||||
|  |               ++ lib.optionals (app == "server") [ | ||||||
|  |                 makeBinaryWrapper | ||||||
|  |               ] | ||||||
|               ++ lib.optionals stdenv.hostPlatform.isDarwin [ |               ++ lib.optionals stdenv.hostPlatform.isDarwin [ | ||||||
|                 xcodebuild |                 xcodebuild | ||||||
|                 darwin.cctools |                 darwin.cctools | ||||||
| @ -162,7 +169,9 @@ | |||||||
|                 comment = meta.description; |                 comment = meta.description; | ||||||
|                 desktopName = "TriliumNext Notes"; |                 desktopName = "TriliumNext Notes"; | ||||||
|                 categories = [ "Office" ]; |                 categories = [ "Office" ]; | ||||||
|                 startupWMClass = "Trilium Notes Next"; |                 # TODO: electron-forge build has this set to PRODUCT_NAME (forge.config.cjs) | ||||||
|  |                 # But the plain build doesn't set this (or the app icon). | ||||||
|  |                 startupWMClass = "TriliumNext Notes"; | ||||||
|               }) |               }) | ||||||
|             ]; |             ]; | ||||||
| 
 | 
 | ||||||
| @ -184,9 +193,11 @@ | |||||||
|             mkdir -p $out/{bin,share/icons/hicolor/512x512/apps,opt/trilium} |             mkdir -p $out/{bin,share/icons/hicolor/512x512/apps,opt/trilium} | ||||||
|             cp --archive apps/desktop/dist/* $out/opt/trilium |             cp --archive apps/desktop/dist/* $out/opt/trilium | ||||||
|             cp apps/client/src/assets/icon.png $out/share/icons/hicolor/512x512/apps/trilium.png |             cp apps/client/src/assets/icon.png $out/share/icons/hicolor/512x512/apps/trilium.png | ||||||
|             makeWrapper ${lib.getExe electron} $out/bin/trilium \ |             makeShellWrapper ${lib.getExe electron} $out/bin/trilium \ | ||||||
|               "''${gappsWrapperArgs[@]}" \ |               "''${gappsWrapperArgs[@]}" \ | ||||||
|  |               --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \ | ||||||
|               --set-default ELECTRON_IS_DEV 0 \ |               --set-default ELECTRON_IS_DEV 0 \ | ||||||
|  |               --set TRILIUM_RESOURCE_DIR $out/opt/trilium \ | ||||||
|               --add-flags $out/opt/trilium/main.cjs |               --add-flags $out/opt/trilium/main.cjs | ||||||
|           ''; |           ''; | ||||||
|         }; |         }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran