Closed lucasew closed 2 years ago
Thanks for finding this issue, and for the simple reproduction instructions! Seems like it's from this assert in here: https://github.com/ralismark/nix-appimage/blob/main/flake.nix#L130
let
# use same auto-detect that <https://github.com/NixOS/bundlers> uses
main =
if drv?meta && drv.meta?mainProgram then drv.meta.mainProgram
else (builtins.parseDrvName (builtins.unsafeDiscardStringContext drv.name)).name;
mainPath = "${drv}/bin/${main}";
in
assert pkgs.lib.assertMsg (builtins.pathExists mainPath) "main program ${mainPath} does not exist"; # <-----
mainPath;
I added it since if it didn't guess the right main program it would just silently create a broken AppImage, but I guess it doesn't work reliably in pure mode. Simple fix would be to remove the check, but I'd prefer there to still be some safeguard against that happening.
I'm not extremely familiar with nix but I can try figure something out over the next few days. Do you know any good ways of checking if a derivation has a specific file?
Well, one workaround I can see right now is one is another derivation that depends on the first one and checks if the file exists, if Yes then create a folder in $out, if not raise an error. If that derivation is marked as a dependency to the final derivation it will run. In pure mode you cant access arbitrary nix paths, you must have that declared as some kind of dependency.
I've pushed a fix to the develop
branch that uses builtins.readDir
instead, and it seems to work with your example:
nix bundle --bundler github:ralismark/nix-appimage?ref=develop github:lucasew/nixcfg#pkgs.wineApps.wine7zip
Can you try this and let me know if it fixes it?
It works!!
Thank you, now it builds without --impure.
If running normally, it isn't able to check reliably if the binary entry point from
meta.mainProgram
exists because of sandbox I guess.How to reproduce: