80
NixOS for gamedev (linux.community)
submitted 8 months ago by mat@linux.community to c/linux@lemmy.ml

Hiya! I'm following a gamedev degree in university. It's been a major challenge doing it from Linux, as everything is Windows stuff (.sln Visual Studio projects, DirectX API, excel graphs...). However I've gotten by by making my own tools and dipping into WINE when it gets too difficult. I'm replacing my laptop due to hardware faults (never buying from ASUS again) and my Framework 16 preorder should arrive in a month or two.

I'm considering trying out NixOS. I currently have Arch on the laptop because it makes it easy to get recent versions of libraries and compilers. However, I've had lots of issues due to inconsistent setup (SDDM theme randomly disappears, KDE apps have black text on dark background, video encoding does not work) and I figured having a declarative config might allow me to set things up better and more consistently. I do have a few worries though, given this is new to me:

  1. Installing proprietary software. For certain courses I unfortunately have to use software like Unreal Engine, Maya, Houdini, Unity, P4V, and a few others. I read NixOS has difficulty with running random binaries. I also could not find an UE5 package in nixpkgs, which Arch does have.
  2. Building binaries. I know nixos does some weird stuff with libraries and binaries. I need to be able to do normal stuff with binaries, and perhaps package and distribute them. It'd be really nice to be able to try out different compilers for my CMake/C++ projects also. Can NixOS do that easily?
  3. VMs. I will be doing dGPU passthrough for testing assignments before handin. I assume this is no problem but it requires some weird stuff so I want to be sure before diving in!

Am I better off just setting up a brittle Arch install again, or is NixOS worth the plunge?

top 21 comments
sorted by: hot top controversial new old
[-] sudoreboot@slrpnk.net 25 points 8 months ago

While all of it is doable, be aware that it takes time and effort to learn Nix and NixOS. It can be difficult to figure out how to get a particular environment set up properly. There is a lot of documentation, but it doesn't always give easy answers if you have specific requirements for a particular dev environment and such.

It's been a few years since I worked with Unity3D professionally, but I did so in NixOS with very little trouble. Rust has very good Nix infrastructure and so do many other languages. I can't tell you anything about UE5 or the other proprietary tools, but there are FHS-compatibility helpers (steam-run usually works fine when I need to run arbitrary binaries made for 'normal' distros).

If you're willing to figure things out sometimes (and especially in the beginning) and are motivated to take your OS to the next level, NixOS is definitely worth it. Been using it for many years and I can't imagine ever using a mutable OS again as a daily driver (unless the way I use my computer drastically changes). I configured everything just the way I want it; it's magical to have almost everything in one place and being able to try different things without fear of breaking something.

[-] moonpiedumplings@programming.dev 18 points 8 months ago* (last edited 8 months ago)

https://nixlang.wiki/en/tricks/distrobox

https://distrobox.it/

Not the nix way, but when you really need something to work, you can create containers of other distros.

[-] matejc@matejc.com 10 points 8 months ago* (last edited 8 months ago)

NixOS is a Linux distro that does a lot of things differently (for the greater good), and gaming is heavily Windows thing, which is hard to do even on conventional Linux distros (its getting better tho). That said as for your points:

1a. One of the things that would help you, is programs.nix-ld.enable = true; (for more info check https://github.com/Mic92/nix-ld , but its integrated in NixOS already)

1b. UE5 pull request has some things that might help (eg: you could just try running it with steam-run): https://github.com/NixOS/nixpkgs/issues/124963

  1. Depends how you are building them, I am not a gaming developer nor tried to build a game without packaging it with Nix. But if you manage to run the UE5 I guess the procedure would be the same as long as you have all of the dependencies available for UE5

  2. I am using qemu/KVM on NixOS to run games on with quite a good performance, so that should not be a problem

[-] burgersc12@mander.xyz 1 points 8 months ago

Gaming is hard on Linux? Get Wine-GE + Lutris and thats all you need

[-] jeffhykin@lemm.ee 8 points 8 months ago* (last edited 8 months ago)

Yeah, university is almost certainly going to expect you to be able to install Unreal or Unity, which just isn't possible AFAIK on NixOS. NixOS is very all or nothing. You can't just remove the restrictions for one project and hack something together to hit an assignment deadline. Theres still lots of pain points with LD_PATH and 3rd party binaries.

That said, you can use nixpkgs on non-nixos and still get reliability for Godot and other open source tools. For your case, I highly recommend dual booting, and then using nixpkgs without going full blown nixOS.

[-] Shareni@programming.dev 7 points 8 months ago

Skip nixos, it's just going to be a lot of pain for almost no gain. Instead use nix with home-manager on a different distro.

I went from Arch to MX (Debian) + Nix. It's a perfect combo because I get stable system packages, unstable user packages, and I don't have to deal with all of the nixos downsides.

[-] degen@midwest.social 7 points 8 months ago

I went from Arch to NixOS and I've been loving it. I also had all the time on the world to dive in with several machines to fall back to.

There are a lot of layers to wade through especially when you need a specific tool like your UE5 case. As others are saying, there are ways to make everything work, nix or non-nix, it's just more to work through after getting the bases covered.

Anecdotally, I had little trouble getting set up on my MSI laptop with an RTX2070, Primus and all. That was after learning the ropes on a Ryzen IdeaPad.

Rambling aside, I would definitely make sure to start in a non-mission-critical way, but do jump right in if you're comfortable. Maybe if you can stomach the Asus a bit longer, or get the Framework set up and play around with the Asus. And ask plenty of questions! I know I'm not alone in jumping in on nix questions any way I can :)

[-] acockworkorange@mander.xyz 6 points 8 months ago

This could be a case for a more stable distro as base and distrobox for your development environment (in Arch, Bazzite, or Tumbleweed).

[-] OneRedFox@beehaw.org 4 points 8 months ago

Installing proprietary software. For certain courses I unfortunately have to use software like Unreal Engine, Maya, Houdini, Unity, P4V, and a few others. I read NixOS has difficulty with running random binaries. I also could not find an UE5 package in nixpkgs, which Arch does have.

So NixOS is different from other distros in that it throws out the FHS so that it can do things like install multiple versions of the same library without issues; this breaks binaries, however, and they have to be patched to work with NixOS. So you basically have to package things for Nix for them to work. Certain programs like Steam and VSCode even have a wrapper as part of their setup that recreates the FHS to make them work as expected, so doing this is possible, but as a beginner I doubt you want to fuck with that.

Building binaries. I know nixos does some weird stuff with libraries and binaries. I need to be able to do normal stuff with binaries, and perhaps package and distribute them. It’d be really nice to be able to try out different compilers for my CMake/C++ projects also. Can NixOS do that easily?

It's actually nice as a dev environment. You do have to write flakes for your projects, but that's not a big deal and the reproducibility is nice.

VMs. I will be doing dGPU passthrough for testing assignments before handin. I assume this is no problem but it requires some weird stuff so I want to be sure before diving in!

I've used VMs without issue, so should be fine.


Since Nix is a distro-agnostic package manager, in your case I would probably use a normal distro like Ubuntu/Arch/Fedora and just use Nix with that if you want to go that route. It'll go smoother than diving into the deep end right away.

[-] YodaDaCoda@aussie.zone 3 points 8 months ago

Hey mate what's FHS in this context?

[-] OneRedFox@beehaw.org 3 points 8 months ago

Filesystem Hierarchy Standard. It's the spec for how the file directories should be set up on UNIX-like systems, like how typically user binaries would go in /usr/bin and libraries for those binaries would go in /usr/lib.

[-] Hominine@lemmy.world 3 points 8 months ago

Following with interest (as I am a newbie myself), but if I were in your shoes, I wouldn't want to re-invent the wheel in the middle of classes. That said, I am loving the process of jumping in feet first on laptop hardware, but the slog is real.

In other news, Arch continues to be rock-solid, even during the Plasma 6 update cycle I've had nothing but success where it is concerned. Best of luck!

[-] AI_toothbrush@lemmy.zip 2 points 8 months ago

For my use the best solution i found so far is setting up the os stuff and tools i use a lot with nix and nixos and then using a debian distrobox for things that i just want to work. Nixos is really good for development but only if the thing youre developing already has a nix development environment or youre the one creating it. For most random github projects you wanna work on/compile etc using something traditional is better. I dont care if one of my distroboxes break i know nixos will always work and boot or i can roll back.

[-] priapus@sh.itjust.works 1 points 8 months ago
  1. NixOS can run binaries well using nix-ld or nix-alien, those will work for the large majority of software. If you run into any trouble, you could always use distrobox as well. Some of this software will also likely be packaged in nixpkgs or other repos.
  2. You should be able to build binaries the same way you can on other distros
  3. GPU pass through works the same on NixOS as other distros, but parts of it will need to be configured in your systems configuration, which may be a bit complex, especially if you're new to the Nix language. Here's a good article on setting it up.
[-] bc3114@lemmy.ml 1 points 8 months ago

Slightly off-topic here, but have you considered Fedora? For me it just gets the job done and stays out of my way. I don't want to configure a whole bunch of things before I can get to work so I find fedora simple to use and well-integrated. Docs and forums are quite helpful too.

[-] thepiguy@lemmy.ml 1 points 8 months ago
  1. Jetbrains toolbox is proprietary and I can still run it. You do have to explicitly state that you want proprietary software. You can even run random binaries if you setup nix-ld.
  2. The preferred way to do this is by creating a shell.nix for each of your projects with the dependencies defined within.
  3. Not sure about passthroughs, but qemu worked fine for me.

As for nix Vs arch, I still prefer arch. This is not because nix is bad, but because I have used arch for a long time. I use nix on my laptop because I want that reliability, but I will probably never switch to nix on my desktop. I still find that I can debug my mistakes easier on arch, but with nix I can just git checkout oldcommit. With that being said, I do have a distrobox container with arch in my nix machine, if I really wanna install something quickly.

[-] iarigby@lemmy.world 1 points 8 months ago

Do you have a manual arch setup or did you use an install that configured it?

[-] mat@linux.community 2 points 8 months ago

I set up Arch manually, following the ArchWiki guide. Over time using it though, I must have made some customizations that were incorrect and caused it to break.

[-] iarigby@lemmy.world 1 points 8 months ago* (last edited 8 months ago)

If you were able to set it up yourself I feel like nix learning curve shouldn’t be too hard for you. Especially since if you decide to go back, you’ll bring back lots of value - you can use nix package manager and home manager on any distro. I’m very interested to try them out but am a bit wary since I don’t have experience with nixos

[-] Shareni@programming.dev 2 points 8 months ago

If you were able to set it up yourself I feel like nix learning curve shouldn’t be too hard for you.

I don’t have experience with nixos

Following clear step by step instructions is nowhere near to trawling through random forum threads to find out how to use some basic functionality because the official docs are years out of date.

[-] AMDIsOurLord@lemmy.ml -3 points 8 months ago

Why Nix? It will only make your life 2000% harder and quite frankly makes one hate Linux. As a developer the best dev distros I've used were Debian, Ubuntu and Arch

this post was submitted on 10 Mar 2024
80 points (96.5% liked)

Linux

48375 readers
1211 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS