Change:
<ins> { lib, fetchFromGitHub, buildGoModule, buildNpmPackage, substituteAll, pandoc, electron, }: buildNpmPackage rec { pname = "siyuan"; version = "3.0.11"; src = fetchFromGitHub { owner = "siyuan-note"; repo = "siyuan"; rev = "v${version}"; hash = "sha256-s82g5os944us85V2TBnm+HNd37vVzNjaOJYrbBrgLSI="; }; kernel = buildGoModule { name = "${pname}-${version}-kernel"; inherit src; sourceRoot = "${src.name}/kernel"; vendorHash = "sha256-onZBrw0fDsjqXgQF06C40ArxNmsbFDIwD57fJ0jB0ls="; patches = [ (substituteAll { src = ./set-pandoc-path.patch; pandoc_path = lib.getExe pandoc; }) ]; # this patch makes it so that file permissions are not kept when copying files using the gulu package # this fixes a problem where it was copying files from the store and keeping their permissions # hopefully this doesn't break other functionality modPostBuild = '' chmod +w vendor/github.com/88250/gulu substituteInPlace vendor/github.com/88250/gulu/file.go  --replace-fail "os.Chmod(dest, sourceinfo.Mode())" "os.Chmod(dest, 0644)" ''; }; sourceRoot = "${src.name}/app"; postPatch = '' ln -s ${./package-lock.json} package-lock.json # for some reason the default page is broken, use the redirection link automatically substituteInPlace electron/main.js  --replace-fail ' "/stage/build/app/index.html?v=" + new Date().getTime()' '"/stage/build/desktop"' ''; npmDepsHash = "sha256-Yv/iOCyry3CNeKPxS206Y5y5mvzPU873PJdi0UQkVLs="; env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; npmBuildScript = "build:desktop"; postBuild = '' substituteInPlace electron-builder-linux.yml  --replace-fail '- target: "AppImage"' ""  --replace-fail '- target: "tar.gz"' '- target: "dir"' # add extra fields to resolve the electron provided by nixpkgs sed -e 1i'electronDist: ${electron}/libexec/electron'  -e 1i'electronVersion: ${electron.version}'  -i electron-builder-linux.yml npm run dist-linux ''; installPhase = '' runHook preInstall mkdir -p $out/share/siyuan cp -r build/*-unpacked/{locales,resources{,.pak}} $out/share/siyuan mkdir $out/share/siyuan/resources/kernel ln -s ${kernel}/bin/kernel $out/share/siyuan/resources/kernel/SiYuan-Kernel makeWrapper ${lib.getExe electron} $out/bin/siyuan  --chdir $out/share/siyuan/resources  --add-flags $out/share/siyuan/resources/app  --set ELECTRON_FORCE_IS_PACKAGED 1  --add-flags "''${NIXOS_OZONE_WL:+''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"  --inherit-argv0 runHook postInstall ''; meta = { description = "A privacy-first personal knowledge management system that supports complete offline usage, as well as end-to-end encrypted data sync"; homepage = "https://b3log.org/siyuan/"; license = lib.licenses.agpl3Plus; mainProgram = "siyuan"; maintainers = with lib.maintainers; [ tomasajt ]; platforms = lib.platforms.linux; }; } </ins>

Discussion:
Project description SiYuan is a privacy-first personal knowledge management system that supports complete offline usage, as well as end-to-end encrypted data sync. Metadata homepage URL: source URL: license: AGPL-3.0 license platforms: unix, linux, darwin, windows Add a :+1: [reaction] to [issues you find important]. [reaction]: [issues you find important]:
Looked at the project, looks like it uses for lockfiles, which is unfortunate, as nixpkgs doesn't really support that officially. It also uses custom electron builder configs for different systems, which would complicate it a bit more. (Though, not many other source-built electron apps support anything other than linux) We could put a generated in-tree, but NPM lockfiles take up too much space IMO. I'll make an attempt at getting this to work, though.
I got to this point: (you need to generate your own package-) There are several issues with it, causing it not to be able to launch. The first is that when copying the files from the /nix/store to the workspace, it doesn't make sure to reset the permissions. I tried patching it, but the other method only resets modification times instead of permissions. Relevant files:
Thanks for your work! I'm new to packaging for nix, so I can't help with your problems. I found that Siyuan does publish an , would that maybe be an easier option?
Wouldn't it be easier to just run it with ? But for packaging it there's that can wrap an appimage. but I haven't tried it myself. Edit. sorry I accidentally clicked close with comment instead of comment.
It might be easier, but I've never done so previously, so I'll leave that for someone else.
I tried wraping the appimage. It launches the first time and works properly. but on the second launch it give a couple of errors. and . I think it's the same issue that mentioned. Running makes it work properly.
I think calling on the files copied to the dest should be enough to fix it. right? Would you like to create a pull request for it? It's hard to keep track of things in the comments.