-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
nixos/sunshine: init #294641
nixos/sunshine: init #294641
Conversation
a79a582
to
5f39bcd
Compare
@so-lar-is I actually just pushed that a bit ago, based on yours :) thanks. |
Mea culpa, I had the tab open for a while already :) |
f0d3d3d
to
b98b834
Compare
Great work ! I would put the securityWrapper part - the root capabilities - under a boolean flag as sunshine would work anyway. |
I would like to divide it into two module: |
Yeah, good idea -- technically it is required for KMS capture (see docs for reference), but making it not on by default makes someone intentionally give this service that capability. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/3677 |
ad6c6d4
to
2be8cd0
Compare
or
|
Fair ask -- this is not my use case, unfortunately -- not sure I'll have time to add/test it here. Could certainly be added with a later PR though. |
Works great on nvidia + xorg too. The only issue is that it doesent use nvenc. For that I use this workaround, would be great if you could add it to the service, maybe with a "useCuda" flag: #272221 (comment) |
@tymscar I don't have NVIDIA anymore, but when I did it was enough to use the
For what it's worth I don't think |
Thank you! Perhaps yesterday I spoke too soon and maybe I still had the manually started instance? Who knows. Maybe you can give me some pointers. Basically it does not see the gpu, this is what the logs look like:
Now I know that sunshine in the config tells you how to find the GPU, and when I run those commands, I can see mine at
I wonder if perhaps this is some sort of issue with permissions? At least back when I was running sunshine myself from the command line, not as a service, it would give me similar errors when I would run it under my user, instead of root, or using The current config I use for this service is: services = {
sunshine = {
enable = true;
package = pkgs.sunshine.override { cudaSupport = true; };
openFirewall = true;
capSysAdmin = true;
};
}; I tried without Thank you again for the help! |
@tymscar are you on unstable? there was a change recently that might help. does it work without this PR? if not, please open an issue — PR comments probably not the best place for this — issue will help if others have the same problem as you too. |
@devusb I am on unstable. I would open an issue, but this is related to this PR rather than to sunshine overall, because if I run it myself, as root, it works fine. It's just the service here that does not. |
Sorry, this is hard for me to troubleshoot because I don’t have an NVIDIA card. That said, does it work not using module running as your user but with CAP_SYS_ADMIN? That is what the module does. |
Well the issue isnt nvidia specific as far as I can tell, but rather something to do with permissions. I dont think it can see my GPU at all, nvenc or not. |
So it works for me with |
The way I have it working is during this commit. I'm not sure how I could run that without root but with cap-sys-admin because I cant change the files in the nix store. But its very important to note that using the service you wrote, without capsysadmin, gives me errors like So that isnt the root of the issue here. The GPU not being detecting doesent seem to be influenced at all by it. |
You can use security.wrappers to add But again, just trying to understand if it is a packaging problem, a module problem, or other. The difference between what the module does and what your linked configuration does is running |
Sorry it took so long to reply. I spent some time trying what you suggested. So somehow, somewhere the issue isnt with sunshine or with capsysadmin, it's with this service. Any other ideas of what to try? |
@tymscar wondering if it's something with startup order -- can you try just restarting the service as also, do you have |
@devusb So I think I figured it out. Took me like 15 hours of nonstop trying everything I could to get here, so let me explain. Out of the last 10 commits to nixpkgs related to sunshine, only 4 of them actually work, and they arent the last 4, or contiguous. Now those 4 work great when standalone, but when ran as a service, this is what it looks like: Took me ages to figure out, but apparently the offset of the colour space, and the image being cut in half with my right side of the monitor on the left, happens because I dont use my monitor's resolution on my phone when connectiong. If I set it to that, it works great. Im not sure why this only happens when running as a service, but by this point I am just happy I figured it out. AV1 encoding with nvenc is fine as long as I tell it to run with CUDA. |
At least please use |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review/3032/3793 |
Description of changes
Adds a NixOS module for Sunshine, a self-hosted game stream host for Moonlight.
Closes #293298
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.