Closed quantenzitrone closed 1 year ago
Hey @Quantenzitrone, thanks a lot for the new packaging, looks much cleaner now :)
I have added some changes on top of yours where we read the mesh files from ~/.config/retrocube
as you suggested. I don't any errors this way. Could you do one more quick check on nix that we don't get segfaults anymore before I merge it?
No, this won't work, you can't access the home-directory from within the nix build sandbox, and installing something into the user's config directory is bad practice anyway. I could probably write a fix for this replacing the respective source code for the nix build, but i'd rather if you did it properly this would probably be a way to do it, but as i said I'm not sure what the best practices for such cases are and duckduckwalking something like "c read data file best practice" doesn't yield any useful results either...
Honestly, hard-coding /usr/share
, /etc/retrocube
or similar would be a feasible solution too, because replacing simple path strings to fix up an application to work with nix is really common and easy
Or you do something where you look if the file in ~/.config/retrocube
exists and if not copy it there from some global directory
Or you look at $XDG_CONFIG_HOME
, ~/.config
, everything in $XDG_CONFIG_DIRS
and /etc/xdg
for the file to fully comply with XDG Base Directory Specification and make your application configurable at the same time
I made some changes to read the path for the meshes from the CFG_DIR
variable. If it's not defined it falls back to /usr/share/retrocube
. It's integrated with main so you don't need to change the build steps. Could you check if it works?
Do my changes to the makefile still work on non-nixos? i think how the compilation currently "installs" the meshes during the build phase of retrocube is weird, and also requires nix to build the package in the installPhase, but i don't know a better way, so...
another thing i noticed:
renderer.h
is including itself, which doesn't do anything because RENDERER_H
is already defined,
but clangd immediately told me that i shouldn't do that when i opened the file
Good job, it works on arch and ubuntu too. Now I can finally merge the rest of my changes that draw multiple objects into the master.
In the future I'm thinking about creating multiple binaries in the demo
folder. Will we need to repackage it for nix? I might need to ping you again ;)
yep just ping me
closes #7 but the result/bin directory doesn't contain the preview gifs anymore (which were copied there during the installPhase, because they have execute permissions generally
cp $(find * -maxdepth 1 -executable -type f) $out/bin/
was a really uncontrollable and hacky way to copy the finished executable to the resulting storepathi will try to find a solution for this