-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
writableDirWrapper: init #361114
base: master
Are you sure you want to change the base?
writableDirWrapper: init #361114
Conversation
e8eff42
to
0363cb2
Compare
0363cb2
to
b71ac9f
Compare
b71ac9f
to
8a500ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the documentation get linked into the manual automatically?
Otherwise LGTM.
If you're looking for test games, ASCII Sector writes stuff to the current directory of the executable (logs, saves, options). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an intriguing start.
Requesting changes for:
- Passing the editorconfig check (no trailing whitespace, looks like)
- A test
I'm a little surprised that one of the existing wrappers, like buildFHSEnv
in particular don't work for this usecase.
```console | ||
SGVsbG8gd29ybGQhCg== | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test for this? For an example, take a look at pkgs/test/replace-vars/
and commit b0b3172 for when I did this for the replaceVars
build support helper.
To my knowledge |
@ambroisie TBH, I'm not even sure if I got the documentation format completely correct — existing examples all seem to be contradictory and I'm only following what doc/README.md says here |
8a500ae
to
eef6f0a
Compare
eef6f0a
to
46c0ee8
Compare
With a test, I'm inclined to merge. |
I think this might need multiple tests, purely because there's a lot of edge cases and bugs I discovered in other derivations that actually use it — however it's quite late for me right now, so I'll look into writing a test suite tomorrow |
Oh yes, multiple tests are great. Take all the time you need. No timer is ticking! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall the current implementation is good, but I think we could take this a step further
The way this is actually a function (and even takes arguments like name
and version
) lead me to believe this was more akin to symlinkJoin
or linkFarm
, where it would just create a store path with the specified folder structure + extra commands; but obviously this isn't the case
I think a much better approach here would be to base this off other application wrappers, using CLI arguments and environment variables over a traditional Nix function -- sorta like wrapGAppsHook. This would hopefully make things a bit less confusing (as you would no longer be dealing with a Nix function to create a script wrapper that will also have it's own arguments), composable, and be a bit more efficient by allowing all derivations to use one writable-dir-wrapper
rather than building a new one each time
I'm not going to block on a complete rework like this though, as the actual reviews I left would make this Good Enough ™️ IMO, but I would really encourage giving it a try. Let me know if I can help :)
46c0ee8
to
0382fe8
Compare
Eval summary
|
0382fe8
to
a412b70
Compare
I've made it more akin to a wrapProgram-style hook (it actually has the same API as |
76b3eae
to
19935d0
Compare
d31f802
to
e41ae32
Compare
e41ae32
to
8d94be2
Compare
I really like the direction this is going. Please take the time you need, then mark this as non-draft when you're ready for reviews and merge. |
An unfortunate fact of life is that some packages (mostly video games) really want a writable state directory that also has all assets and resources in it. This helper creates a wrapper script that helps in automatically linking resources and updating the links when versions are updated, while keeping config files and other state files intact.
Dependents:
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.