10 ms·
Persistent packages on Steam Deck using Nix
- metadat 2y agoI didn't realize you could install Nix on any Linux distro. It actually looks really straightforward: https://forum.elivelinux.org/t/how-to-install-nix-packages-on-debian-based-systems/3422 https://forum.elivelinux.org/t/how-to-install-nix-packages-o... I'm giving it a go now in the easily undoable single-user "no-daemon" mode. Super excited how approachable this makes Nix, I've put this off for many years due to what turned out to be an incorrect assumption about the level of commitment!
- rendaw 2y agoI've been using it for developing, but for non-headless stuff IIRC there's a lot of issues with opengl drivers and hardcoded X11 paths and stuff. I dropped a good chunk of time before giving up.
- iamdbtoo 2y agoI'm currently experiencing this with a Tauri-based app. Nix has been great for us for local dev and service builds, but building an application inside of Nix that needs to run outside of it has been challenging to say the least.
- worble 2y agoYeah, I just went through this process myself on steam deck and the fact it can't access opengl or vulkan natively makes anything that isn't terminal based a massive pain in the ass. There is nixgl which you can wrap around any executable to make it work and it's got support in home-manager (https://nix-community.github.io/home-manager/options.xhtml#opt-nixGL.packages https://nix-community.github.io/home-manager/options.xhtml#o...) but it's a huge annoyance having to wrap `config.lib.nixGL.wrap <package>` around everything you want to install.
- ahoemora 2y agoIt really depends on how you start your programs. If you wrap your compositor with nixgl then everything started through your compositior inherits the relevant env vars (LD_LIBRARY_PATH etc.) and you don't have to wrap the programs separately.
- IshKebab 2y agoIt's really 50 years of Unix's dumb practice of installing everything at absolute paths in `/usr` that has come home to roost. I wonder if Nix will finally make people write relocatable apps.
- bronson 2y agoThe opposite. Everything must be in /nix.
- otabdeveloper4 2y agoNo, each Nix app gets its own tree root. (Honestly the same thing Mac, Android, etc., also do, so not such a strange idea.)
- IshKebab 2y agoIt's designed like that because of this issue. They obviously don't want to do that, but if they don't install everything in global absolute paths then too much badly written software breaks. It's a symptom, not a cause.
- phaer 2y agoDid you try https://github.com/numtide/nix-gl-host/ https://github.com/numtide/nix-gl-host/ to help with nix & opengl drivers on non-nixos distros?
- Cyph0n 2y agoTo be honest, the naming is a bit confusing. Here is my understanding: - Nix: build system and package manager (available on Linux and macOS) - Nix: language used to define how to build packages - nixpkgs: Nix package monorepo - NixOS: Linux distro that is fully managed using Nix (language), has Nix (package manager) built-in, and is defined as part of nixpkgs
- soraminazuki 2y agoThe language is also commonly referred to as Nix expressions or the Nix language.
- squiggleblaz 2y agoHonestly I think you need to divide "Nix" up into two:[1] a language interpreter and the build system/sandbox. First nix interprets the expressions. It does that in your local context - so that, if it's configured to, it might read your .aws/credentials file to get access to resources stored in your S3 bucket. Once it's established what it needs to build, then the build system takes over and sets up a sandbox and runs bash scripts and other commands to produce output. I had conflated the two for some time and it caused my a variety of confusions that are resolved by observing the distinction. (Also, I tend to think it's better to view NixOS as a tool for producing a linux distribution, which in many cases just happens to have an installbase of 1 - but that's not necessarily the case, and you could build your images with NixOS and deploy a dozen of them to aws.) [1]: this was meant to be a joke, but it occurs to me that a person might think I missed that they had divided "Nix" up into two, the buildsystem and the language. But a language is not a command and doesn't do anything, so it can't possibly be an interpreter as well - and there could be and to some degree is multiple nix interpreters. So it is the first of the divisions of Nix that I sliced in two, and you end up with three Nixes: the buildsystem/sandbox; the main language interpreter; and the language.
- viraptor 2y agoIt's this meme image, but actually https://kagi.com/proxy/images?c=_m3km2RjA3G0qleowsZXHZb9NEn0fSsEYIHbKzMDyAFb4nUPIanknmQV_g0rmdCIXxRtvaCShXUB7W-n0BY2z-cK8_KD3Lk_Ycw9joSTrvoGvGIs2NcUe9s7D6HNgxcyu0Sl0W88ojTzxeFp2_p3rQ%3D%3D https://kagi.com/proxy/images?c=_m3km2RjA3G0qleowsZXHZb9NEn0...
- goosedragons 2y agoYou can also do it with Guix in case you prefer Guile and more strict FOSSy-ness.
- kombine 2y agoI'm playing with Guix and even made a dedicated installation. I find it more attractive than Nix (more sane language, shepherd service manager), but it lacks in diversity of packages and many of the ones I require are very stale.
- gray_-_wolf 2y agoPatches are welcome :)
- viraptor 2y agoNot all patches are welcome. Guix is very strict and opinionated - they won't allow unfree packages or firmware updates.
- martinflack 2y agoThere's nonguix as well: https://gitlab.com/nonguix/nonguix https://gitlab.com/nonguix/nonguix
- rendaw 2y agoI was told you don't need to subscribe to the mailing list, but I've sent mailing list messages with patches, discussions on technical issues that were never accepted.
- kombine 2y agohttps://github.com/DeterminateSystems/nix-installer https://github.com/DeterminateSystems/nix-installer I've had good experience with this installer if you have root access. I also installed nix on my work HPC cluster running Ubuntu via nix-portable.
- bsimpson 2y agoFor context, Determinate is a startup made of the Nix guy and some of the senior community members. They explicitly support the Steam Deck (and used it as a test case to create their installer). https://determinate.systems/posts/nix-on-the-steam-deck/ https://determinate.systems/posts/nix-on-the-steam-deck/
- _cenw 2y agoNot just senior community members, DetSys is the company of the creator of nix. This installer and the relationship between DetSys and Nix has also been subject to major criticism about conflict of interest between community interests and DetSys, since everyone agrees the official Nix installer has major issues. "Determinate Nix" (as DetSys calls the nix configured with their installer) also enables features that are the de-facto way to use Nix these days, but are disabled in the default distribution because of... let's say... commitment issues. If you want a community run alternative, try Lix. They have a version of the DetSys installer too - and they actually cut releases of nix instead of building moats around it. https://lix.systems/ https://lix.systems/
- abathur 2y agoThere should (hopefully) be an ~official-nix version of the detsys installer in the ~near future. (That said, one slice of the reasons this has taken a while is that the upstream Nix variant is obliged to stick to official features for now.) It's basically at the point where it just needs a redirect from the nixos.org domain, and for the project/community to work through how to manage its development/relationship to the Nix repo.
- hiimshort 2y ago
- o11c 2y agoLast I checked, there was a major caveat to this - it mucks with your PATH in intrusive ways. So it's not "just try it", it's "switch to a frankenstein system and don't turn back"
- Rikudou 2y agoHmm, didn't seem that way, I specifically did it the way I describe in the article to have it easily reversible, though I must admit it's just theoretical, I haven't tried uninstalling it.
- saghm 2y agoI'm not sure about using Nix (the package manager) on other distros/macos, but I remember that when I tried out NixOS years ago, one of the things that struct me was just how little PATH stuff was needed. Literally the only thing in /usr/bin was `env`, and everything else was specific to each given package. My naive expectation would be that most of the stuff to be self-contained, like maybe a single script to `source` per package that could get set up as part of an invocation at the end of a shell config, and that worst case, switching back would be as simple as removing that invocation.
- tripdout 2y agoIt just adds your Nix profile to your path.
- jamesgeck0 2y agoNah. - Normally, just deleting /nix gets you 95% of the way back to normal. - If you want a bulletproof removal, the determinate systems Nix installer saves a file with a list of all the operations it made during installation so that it can be cleanly removed. - If you want to stop home-manager from hooking into your shell without completely removing Nix, there's a separate uninstall command for that.
- __MatrixMan__ 2y agoI use it on macos for all of my dev environments. So instead of a readme that tells me to install tools X,Y and Z, direnv notices that I'm now in the project directory and it makes those tools available and then when I switch to a different project I end up with different sets of tools (pinned to the same versions on all my machines, tracked by git). It's a bit more involved than homebrew, but you end up with a very precise definition of what your project depends on. This prevents all kinds of headaches re: Linux and Mac users depending on subtly different versions of grep or sed. Plus you can recreate the same environment in CI and Prod without having to define those dependencies separately. Or you could, if your team was bought in. That's the hard part.
- whatwhaaaaat 2y agoJust for a giggles, what projects do you work on that require such variation in tooling where something like this becomes worthwhile? I always see these type of arguments for why nix is so great but it’s never been a pain point for me in 10+ languages and 20 years of development experience. I see your example of bash scripts but this can’t be all for writing scripts.
- tstrimple 2y agoNot the OP, but I work in consulting. When I was still hands on keyboard, this would have been very helpful for the clients who don’t provide their own hardware or environment for us to use. I also do work for extremely large organizations who have literally dozens of different stacks accumulated over the decades. In addition, I play with all sorts of open source tools and they often come with their own tool chains and expectations. Python version management in particular benefits a lot from this level of isolation. Instead of figuring out the different version management tools for each stack I use a higher order environment management tool in Nix. Some others are solving these issues with containers, and that’s a part of the nix strategy as well.
- whatwhaaaaat 2y agoYeah I get the idea but I’m asking op for concrete examples. Python has its own environment management options that work well. I’ve read on this site over and over what it can do - I’m wondering if anyone has hard examples of tooling they switch about enough to make it worthwhile.
- Rikudou 2y agoI still recommend my article, it's really similar on all Linux distros and Home Manager makes it much more pleasant to use.
- sweeter 2y agoThey also have a simple uninstall command now as well. It used to be kind of a pain in the butt to do but now you can just install it and uninstall it in a couple minutes. The determinate systems installer for Nix is honestly a really great example of a great command line tool. It very transparently tells you "this is what we're going to be doing. Will you allow me to do all of these things?" and it tells you what when it is doing them. Then they bundle the uninstaller.
- giancarlostoro 2y agoI guess peak Linux is to use Nix on Arch Linux for ultimate smugness.
- throwaway314155 2y agoSteam Deck runs Arch as it turns out.
- bdhcuidbebe 2y agoThat meme got old. I use arch, btw, because its a solid rolling release and the AUR. Its the absolute best distro for a developer, theres really no competition.
- giancarlostoro 2y agoAgreed. I use a flavor called EndeavourOS. Very happy with it. I have had bad experiences with other flavors in the past like Manjaro. I think yay is peak for me so far.
- otabdeveloper4 2y agoLast time I checked (a couple years ago) the version of nix in Arch repos shipped a subtly modified default configuration that rendered it broken, so yeah, a quintiessential Linux experience.
- Rikudou 2y agoInstalling nix from a package repository feels very wrong.
- giancarlostoro 2y agoYou can always get it from a AUR on arch which is user repos if thats the case, kinda like Ubuntus PPAs.
- Ericson2314 2y agoIn fact, you can just download a statically build Nix binary and just start using it. The installer is IMO basically unnecessary for single user mode without root on Linux. We should promote this more :)
- mrbonner 2y agoWhat do youy mean by this?
- talldayo 2y agoThis is actually a bit of a match made in heaven for Nix. The Steam Deck runs Arch with immutable root, which means most of the AUR packages won't entirely work. So you need a package manager which respects immutable root, supports atomic upgrades with Arch and has a package selection similar to the AUR. There are a few options, but the best one really is Nix: https://repology.org/repositories/statistics/newest https://repology.org/repositories/statistics/newest Given that package management on the Deck is traditionally handled with Flatpak, Nix seems like a great alternative for power users with storage to spare.
- mhitza 2y agoVMs with Gnome Boxes also work nicely on the deck for power users. With KVM, measured via geekbench, the VM incurred only a 5% performance penalty.
- sweeter 2y agoI run containers with podman as well as Waydroid for Android apps. I install novel reader applications or whatever and have them open in the background using TTS, while I play.
- Rikudou 2y agoI actually use both, flatpaks for GUI apps and Nix for various CLI tools, setting up my Deck like I described in the article was triggered by me being too lazy to check my local game server's IP on the server itself and wanted to use nmap for that. Long story short, it would be faster to go check the computer physically. But it was more fun this way, even though I didn't have the time to play the game in the end.
- capitainenemo 2y agoPersonally, I just mounted an overlay fs against the sdcard on /usr and installed what I wanted against their Arch snapshot and some standalone apps I needed. Every few months I have to rerun an install script though, if I choose to upgrade to their latest release, since I don't want to risk doing that upgrade with the overlay in place. But otherwise it's been working well for a couple of years.
- colordrops 2y agoWould love if there was a Nix flake for setting up retro gaming. Last time I checked you had to install these complicated tools and set them up manually.
- Rikudou 2y agoThere's EmuDeck which does all of the work for you. There's also another newer package that does the same but I forgot the name. At least EmuDeck can be easily installed with a flatpak, no idea about the other one
- _cenw 2y agoEmuDeck is the more featureful one, but messy in a lot of places - and definitely not just a flatpak. I particularly hate how the ~/Emulation folder is full of absolute symlinks (even when creating sibling folder aliases!) to random places, so it can't be properly used with Syncthing unless you write your own ignore files and set up shares per emulator save directory. Their Windows version is also not exactly the same, so syncing media between a Windows machine and a Linux one is even more annoying. RetroDeck bundles everything into a single flatpak and seems a lot saner, but is a lot newer.
- colordrops 2y agoEmuDeck is exactly the package I was referring to that is a pain in the ass to setup.
- jquaint 2y agoLove using Nix for retro gaming setups. Its great to bundle drivers, emulators, etc. https://nixos.wiki/wiki/RetroArch https://nixos.wiki/wiki/RetroArch https://nixos.wiki/wiki/Playstation2 https://nixos.wiki/wiki/Playstation2
- bpye 2y agoWhilst nixos.wiki often shows up first in search results, you probably want wiki.nixos.org instead. There is some reasoning in the FAQ - https://wiki.nixos.org/wiki/FAQ#Why_is_there_a_new_wiki?_What_is_with_nixos.wiki https://wiki.nixos.org/wiki/FAQ#Why_is_there_a_new_wiki?_Wha...
- craftkiller 2y agoThis is great. Nix made compiling ship of harkinian (ocarina of time pc port), 2ship2harkinian (majora's mask pc port) and sm64ex (super mario 64 pc port) trivial on nixos but where I really want them is on my steam deck. Now I can.
- Ericson2314 2y agoAre this in Nixpkgs? I hope so! I really want to get game developers using Nix. That is a large reason why I am working on the Windows port!
- craftkiller 2y agoYep. The one N64-to-PC port that I know of that isn't in nixpkgs is Starship (starfox 64 pc port). I tried writing a package myself but I was ultimately defeated by not knowing cmake.
- bsimpson 2y ago> you can either run NixOS (which isn’t ideal on a Steam Deck) I've actually been using NixOS on my Legion Go to give me the SteamOS experience while I wait for the official image from Valve [1]. I knew that Valve had whitelisted /nix, but seeing how the author explicitly loads Nix in Bash: .nix-profile/etc/profile.d/nix.sh makes me wonder how it works in game mode. Say that someone uses Nix to install a game like YARG that's not in the Steam store [2]. That will install the game to /nix/store and write an alias to the user's desktop. /home/deck is not immutable, so you could add the desktop file as a non-Steam game, and everything will work as expected, right? What are the boundaries between things that work everywhere, things that only work after you've loaded a bash profile (e.g. from a terminal), and things that only work in NixOS? What if a package wants to run at login? What if it uses its own systemd rules? [1] https://github.com/Jovian-Experiments/Jovian-NixOS/ https://github.com/Jovian-Experiments/Jovian-NixOS/ [2] https://news.ycombinator.com/item?id=42991513 https://news.ycombinator.com/item?id=42991513
- saghm 2y agoYou definitely can easily run anything from outside Steam that you've added to as a "non-Steam game" from game mode like you describe; I use this a few mod management apps for various games I play, as well as for launching Battle.net on my Steam deck. Not sure if I'm misunderstanding what you mean by systemd rules, but from what I understand, enabling a systemd service (either at the system or user level) is the most reliable way to make sure that something starts up in game mode as well as desktop mode. Because I find it useful to ssh into my Steam deck for a lot of things rather than trying to do it all via desktop mode (e.g. managing config files for Baldur's Gate 3 mods that aren't from the in-game mod installer), and I always turn off wifi on it whenever I leave my apartment with it to save battery, I enabled the sshd systemd service, and it's available even if I boot up directly into game mode. I haven't actually been able to find any other way outside of an enabled systemd service to make things start up automatically in game mode, which ended up being an issue for me when I wanted to autostart something through Wine that didn't have an option to avoid trying (and failing) to open a window.
- bsimpson 2y ago
- 486sx33 2y agoNot to be confused with *nix (Meaning any Linux or Unix)
- abathur 2y agoI recognize that people use this shorthand often and am not really trying to hold _you_ responsible, but it has never made any sense to me. We generally mean an asterisk as a glob wildcard, and *nix definitely doesn't match Linux. There are vanishingly few operating systems whose names match this glob, and all of the ones I'm aware of are either true UNIXes or Unix-likes. One of my favorite examples of this precision-be-damned absurdity is from the wiki page for Unix-like (https://en.wikipedia.org/wiki/Unix-like https://en.wikipedia.org/wiki/Unix-like): > Other parties frequently treat "Unix" as a genericized trademark. Some add a wildcard character to the name to make an abbreviation like "Un*x"[2] or "*nix", since Unix-like systems often have Unix-like names such as AIX, A/UX, HP-UX, IRIX, Linux, Minix, Ultrix, Xenix, and XNU. Of these, zero match `Un*x` and only "Minix" and "Xenix" match `*nix`. If we want to talk about the category of OS that includes both UNIXes and Linux, I wish we'd just call them Unix-like :)
- Ericson2314 2y agothe "-nux" in Linux and "-nix" in Linux are kinda pronounced the same?
- abathur 2y agoYou're just making me wish we had a phonetic glob :)
- follower 2y agoWith regard to "Un*x", the Wikipedia text is... imprecise[0]. The asterisk character in this context/usage is not used as a wildcard/glob but as a censoring device[3], in a manner similar to: "Don't censor f*ck on HN." In the case of "Un*x" the motivation is not one of propriety but of proprietary--it was motivated by matters of legality (real or imagined) in relation to trademarks. AIUI at the time UNIX(TM) was a trademark and it was thought by some that in order to avoid potential legal issues it was required to always include the TM superscript in order to avoid the wrath of the trademark owners for trademark infringement/generic-ism. But as "Un*x" is not "UNIX"[4], the reasoning went, no trademark attribution was required. Anyway, that's why when referring to "***/L*nux" I’ve (very) recently taken to calling it "***/L*nux", not wanting to infringe on Linus's trademark and all... ---- [0] The Wikipedia text doesn't really fully represent/match the text of the cited reference[1][2]: "Used to refer to the Unix operating system [...] in writing, but avoiding the need for the ugly ™ typography [...] lawyers now say that the requirement for the trademark postfix has no legal force [...]" [1] https://en.wikipedia.org/wiki/Unix-like#cite_note-jargonfile_UNasteriskX-2 https://en.wikipedia.org/wiki/Unix-like#cite_note-jargonfile... [2] http://catb.org/jargon/html/U/UN-asterisk-X.html http://catb.org/jargon/html/U/UN-asterisk-X.html [3] https://en.wikipedia.org/wiki/Asterisk#Censorship https://en.wikipedia.org/wiki/Asterisk#Censorship [4] Coincidentally, GNU is also Not Unix: https://en.wikipedia.org/wiki/GNU#Name https://en.wikipedia.org/wiki/GNU#Name
- ilrwbwrkhv 2y agoI bought 20 Steam Decks recently to give to one of my teams. Will share this with them.
- newfocogi 2y agoNow I'm curious. What kind of team are you running that they are receiving Steam Decks? Was this a reward or is your teams work related to it?
- ZeWaka 2y agoNot the OP, but larger game companies definitely verify their games work as expected for all major platforms. It's definitely a extremely reasonable expense for a QA team - friends in the industry have said as much.
- ilrwbwrkhv 2y agoYa this was a reward. The deck is such a versatile device.
- sweeter 2y agoNix is great on the steam deck in so many ways. I use home manager just to install my general development environment, but at the same time there are some issues. like the sleep/suspend button will often cause the Nix Daemon socket to stop working, and you and you have to restart it, which can be kind of hard if you don't have access to SSH or whatever.
- Rikudou 2y agoTo be fair, I would be very afraid of the daemon mode on a Deck, that's why I went with the single user mode.
- ksynwa 2y agoDoes installing packages with nix pull in whole runtimes like flatpak does? Between flatpak, nix and the games the space usage could become a concern for me.
- aussieguy1234 2y agoI'm on NixOS which of course uses nix. I'm able to run steam games and have had no issues at all. Im using Lutris as the launcher, but you could easily use the official steam launcher (programs.steam.enable = true). So you could technically get yourself a full gaming experience just with nix, without relying on the shipped steam client in SteamOS.
- Rikudou 2y agoTrue, but SteamOS does much more than just provide the Steam client. I'd stick with SteamOS ona Deck.
- TJSomething 2y agoOh yeah, I've been doing this for a while. One of these days, I should switch to Home Manager.
- dlcarrier 2y agoI've just been using Pacman and reinstalling a list of packages after every system update. The biggest problem is that it's easy to fill up the root partition, and I don't know if the updater could handle resizing it.
- deleted 2y ago[deleted]
- gqgs 2y ago>By default, Nix uses the unstable branch of packages. To switch to the stable channel, run: >nix-channel --add https://nixos.org/channels/nixos-24.11 https://nixos.org/channels/nixos-24.11 nixpkgs >This command sets your nixpkgs channel to the latest stable version (in this example, 24.11). In the future, check the current stable version on the NixOS homepage. Any particular reason for not having a "latest" that will automatically detect the latest release instead of forcing each user to manually check and set the latest stable release every time?