mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	chore(dx/nix): fix flake fully
This commit is contained in:
		
							
								
								
									
										6
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							| @@ -38,11 +38,11 @@ | |||||||
|     }, |     }, | ||||||
|     "nixpkgs": { |     "nixpkgs": { | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1751886450, |         "lastModified": 1757942231, | ||||||
|         "narHash": "sha256-ODg0kj9LqBfwijQIDGC3WATqYN0sndImloD3IvinJEM=", |         "narHash": "sha256-yM1FFsRiyESij/lzbdBMCUoFOKMoShHu0CAexnBWzTM=", | ||||||
|         "owner": "nixos", |         "owner": "nixos", | ||||||
|         "repo": "nixpkgs", |         "repo": "nixpkgs", | ||||||
|         "rev": "979affb003b4626f2603b03ae7709dd4617b27e4", |         "rev": "dd16e0b60390586a261a4e28fc180a91212fe010", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
|   | |||||||
							
								
								
									
										37
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								flake.nix
									
									
									
									
									
								
							| @@ -23,7 +23,15 @@ | |||||||
|         pkgs = import nixpkgs { inherit system; }; |         pkgs = import nixpkgs { inherit system; }; | ||||||
|         electron = pkgs."electron_${lib.versions.major packageJsonDesktop.devDependencies.electron}"; |         electron = pkgs."electron_${lib.versions.major packageJsonDesktop.devDependencies.electron}"; | ||||||
|         nodejs = pkgs.nodejs_22; |         nodejs = pkgs.nodejs_22; | ||||||
|         pnpm = pkgs.pnpm_10; |         # pnpm creates an overly long PATH env variable for child processes. | ||||||
|  |         # This patch deduplicates entries in PATH, which results in an equivalent but shorter entry. | ||||||
|  |         # https://github.com/pnpm/pnpm/issues/6106 | ||||||
|  |         # https://github.com/pnpm/pnpm/issues/8552 | ||||||
|  |         pnpm = (pkgs.pnpm_10.overrideAttrs (prev: { | ||||||
|  |           postInstall = prev.postInstall + '' | ||||||
|  |             patch $out/libexec/pnpm/dist/pnpm.cjs ${./patches/pnpm-PATH-reduction.patch} | ||||||
|  |           ''; | ||||||
|  |         })); | ||||||
|         inherit (pkgs) |         inherit (pkgs) | ||||||
|           copyDesktopItems |           copyDesktopItems | ||||||
|           darwin |           darwin | ||||||
| @@ -47,7 +55,8 @@ | |||||||
|               baseName = baseNameOf (toString name); |               baseName = baseNameOf (toString name); | ||||||
|             in |             in | ||||||
|             # No need to copy the flake. |             # No need to copy the flake. | ||||||
|             baseName != "flake.nix" && baseName != "flake.lock" |             # No need to copy local copy of node_modules. | ||||||
|  |             baseName != "flake.nix" && baseName != "flake.lock" && baseName != "node_modules" | ||||||
|           ); |           ); | ||||||
|         fullCleanSource = |         fullCleanSource = | ||||||
|           src: |           src: | ||||||
| @@ -139,6 +148,11 @@ | |||||||
|               runHook postInstall |               runHook postInstall | ||||||
|             ''; |             ''; | ||||||
|  |  | ||||||
|  |             # This file is a symlink into /build which is not allowed. | ||||||
|  |             postFixup = '' | ||||||
|  |               rm $out/opt/trilium*/node_modules/better-sqlite3/node_modules/.bin/prebuild-install || true | ||||||
|  |             ''; | ||||||
|  |  | ||||||
|             components = [ |             components = [ | ||||||
|               "packages/ckeditor5" |               "packages/ckeditor5" | ||||||
|               "packages/ckeditor5-admonition" |               "packages/ckeditor5-admonition" | ||||||
| @@ -181,7 +195,13 @@ | |||||||
|  |  | ||||||
|         desktop = makeApp { |         desktop = makeApp { | ||||||
|           app = "desktop"; |           app = "desktop"; | ||||||
|           preBuildCommands = "export npm_config_nodedir=${electron.headers}; pnpm postinstall"; |           # pnpm throws an error at the end of `pnpm postinstall`, but it doesn't seem to matter: | ||||||
|  |           # ENOENT: no such file or directory, lstat | ||||||
|  |           # '/build/source/apps/desktop/node_modules/better-sqlite3/build/node_gyp_bins' | ||||||
|  |           preBuildCommands = '' | ||||||
|  |             export npm_config_nodedir=${electron.headers} | ||||||
|  |             pnpm postinstall || true | ||||||
|  |           ''; | ||||||
|           buildTask = "desktop:build"; |           buildTask = "desktop:build"; | ||||||
|           mainProgram = "trilium"; |           mainProgram = "trilium"; | ||||||
|           installCommands = '' |           installCommands = '' | ||||||
| @@ -202,7 +222,16 @@ | |||||||
|  |  | ||||||
|         server = makeApp { |         server = makeApp { | ||||||
|           app = "server"; |           app = "server"; | ||||||
|           preBuildCommands = "pushd apps/server; pnpm rebuild; popd"; |           # pnpm throws an error at the end of `pnpm rebuild`, but it doesn't seem to matter: | ||||||
|  |           # ERR_PNPM_MISSING_HOISTED_LOCATIONS | ||||||
|  |           # vite@7.1.5(@types/node@24.3.0)(jiti@2.5.1)(less@4.1.3)(lightningcss@1.30.1) | ||||||
|  |           # (sass-embedded@1.91.0)(sass@1.91.0)(terser@5.43.1)(tsx@4.20.5)(yaml@2.8.1) | ||||||
|  |           # is not found in hoistedLocations inside node_modules/.modules.yaml | ||||||
|  |           preBuildCommands = '' | ||||||
|  |             pushd apps/server | ||||||
|  |             pnpm rebuild || true | ||||||
|  |             popd | ||||||
|  |           ''; | ||||||
|           buildTask = "server:build"; |           buildTask = "server:build"; | ||||||
|           mainProgram = "trilium-server"; |           mainProgram = "trilium-server"; | ||||||
|           installCommands = '' |           installCommands = '' | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								patches/pnpm-PATH-reduction.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								patches/pnpm-PATH-reduction.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | --- a/libexec/pnpm/dist/pnpm.cjs	2025-09-15 11:33:34.014095372 +0200 | ||||||
|  | +++ b/libexec/pnpm/dist/pnpm.cjs	2025-09-15 11:37:00.260553326 +0200 | ||||||
|  | @@ -68067,10 +68067,14 @@ | ||||||
|  |        return false; | ||||||
|  |      } | ||||||
|  |      function spawn(cmd, args, options, log) { | ||||||
|  |        const cmdWillOutput = willCmdOutput(options && options.stdio); | ||||||
|  |        if (cmdWillOutput) startRunning(log); | ||||||
|  | +      const stupidPath = options.env["PATH"]; | ||||||
|  | +      const parts = stupidPath.split(":"); | ||||||
|  | +      const partsDedup = new Set(parts); | ||||||
|  | +      options.env["PATH"] = [...partsDedup].join(":"); | ||||||
|  |        const raw = _spawn(cmd, args, options); | ||||||
|  |        const cooked = new EventEmitter(); | ||||||
|  |        raw.on("error", function(er) { | ||||||
|  |          if (cmdWillOutput) stopRunning(log); | ||||||
|  |          er.file = cmd; | ||||||
		Reference in New Issue
	
	Block a user