you’re welcome, if you’re like me and also trying to make a C++ project without Visual Studio, this got me to build the blank C++ project without visual studio. For some reason, I had to run it twice to get everything compiled/built/cooked and for unreal editor to open the project.
I’m sure there’s a lot of options in RunUAT I’m forgetting that VisualStudio is a wrapper for, but this and BuildProjectFiles.sh or whatever it’s called seems to be the heavy lifters that visual studio leverages
@silmaril You can combine the flag --extra-experimental-features "nix-command flakes" or use nix.settings.extra-experimental-features = [ "nix-command" "flakes" ];
nix.settings.extra-experimental-features = [ “nix-command” “flakes” ];
seems to actually work in my setup.
And it’s nice to know that I can make do with one –extra-experimental-features argument for several features at once.
May I be so bold as to ask a follow-up question that doesn’t have much to do with this one?
What do I have to do to get Virtualbox Guest Additions to work on NixOS? Not having a shared clipboard is driving me crazy ;-)
Once again everything I found on the internet leads to errors during sudo nixos rebuild. I hope it’s just another case of knowing the correct names for the actual packages or options to use.
I’m using NixOS partly as a dev machine, but mostly for consumer OS stuff like gaming, YouTube, social media…
What are you trying to use it for? From the consumer perspective, I feel like modifying configuration.nix would be the majority of what I need. It’s like ninite if you’ve used that to setup a Windows machine, but it can be preloaded on your OS and you can configure everything, not just which programs are installed
If you’re trying to setup dev environments, I think what gets weird is how many ways there are to do similar things, like nix develop, nix build, nix shell…
Currently I am playing around in a virtual machine to get to know NixOS and find out what I can do with it.
I’d like to set up a usable everyday desktop configuration with “everything”.
This includes typical desktop applications like Firefox, Thunderbird, LibreOffice … development tools like Git, PyCharm, VS Code, … all those little things I need to work productively like Nextcloud desktop client, KeePassXC, Zim and many more.
And I’d like to have zsh as my default shell with my own custom theme and some dotfiles for different applications that currently reside in a git repo that I clone to every machine I use.
I know this is a lot and I don’t expect to get this all up and running in an afternoon.
It’s just that I find it very hard to find the next bit of information I need. For example I found snippets to put into my configuration.nix long before I found out where to find this file (/etc/nixos/configuration.nix).
From the answers so far I gather that there really is no (official or unofficial) documentation to tell NixOs newbies how to start, so everyone just makes do with the things they find.
So I think I’ll just fight my way through this jungle, too ;-)
The price that’s waiting at the other and seems to be totally worth it!
If anyone has valuable tips or links to help me achieve something from the things I listed, those would be very much appreciated! :-)
Again, these values should be inserted after the function definition of your configuration.nix
<span style="color:#323232;">{ config, pkgs, ...}:
</span><span style="color:#323232;">{
</span><span style="color:#323232;"> # Things get inserted here typically
</span><span style="color:#323232;"> imports = [ ./hardware-configuration.nix];
</span><span style="color:#323232;"> environment.systemPackages = [pkgs.vscode];
</span><span style="color:#323232;">}
</span>
for example.
Something I’ve noticed from developing on nix, When the headaches of nix appear, the solution might be harder, but I usually end up with a better solution than what I was going for before. Some examples:
My resume is compiled in Latex. I tried the pdflatex package in nix but it gave rendering issues. Then the nix community recommended tectonic and i’m getting better compilation times, logging, clean up…
PIP is a garbage package manager, and it’s garbageness sometimes makes native python development a headache in nixos. However, using poetry2nix, not only could I define development environments, it was also ready for packaging on PIP
Sometimes you might want to separate some parts of your configuration away from your global system config at /etc/nixos/configuration.nix. That’s nix-shell, nix-develop, nix-build, and flakes are for. I’m not a pro at flakes yet, but I think I got the gist, here’s an example of when I wish I could have used a flake:
I use discord but discord itself is garbage. Vesktop is a better 3rd party client for discord. Unfortunately, I had to remove it from my configuration.nix the last few weeks because one of its dependencies wasn’t packaged right, causing my entire system to not build. If I had used a flake, I could have isolated that dependency from the rest of my build, while still tracking its integration with my system. I believe this could have allowed me to update the rest of my system, while still defining the errenous app as part of my system. Flakes are supposed to be more reproducible as well, since they require sha256 git commits, whereas other package managers only ask for a subjective version number
There’s a lot to learn with nix but even if I don’t stick with it long term I feel like It’s making me a smarter software engineer since a declarative/functional paradigm tends to match the natural language more. It also is the most restrictive design paradigm, which means it’s brief but so simple it can be hard to understand as a consequence. Since it’s so restrictive, it’s also a subset of all other paradigms. You declare what you want, ideally, you don’t have to set anything up. I never had an easier time getting cuda drivers for ML Training setup than on NixOS because of this
Something I enjoyed doing, was setting up my user profile to let me ssh in only with whitelisted ssh keys, as well as setting up a systemd script to handle some start up routines on my OS. I think that can be a gentle introduction to how you can configure other parts of your operating system. I’m going to try and set up a CI/CD/CT pipeline with it next I believe
Edit: The next thing I need to do as well, is consolidate my user configs with the home manager functionality. I use a KVantum Theme engine on top of plasma, and while those apps are installed in my system, the configuration of which theme to automatically load should be integrated with the text config aspects of nixos. Currently, I “Imperatively” configured those by “Opening the app and clicking”, which will get erased/not be reproducible if I ever rebuild my nixos on a new computer
Another funny thing with functional programming… sometimes the fix is as simple as
If I had used a flake, I could have isolated that dependency from the rest of my build, while still tracking its integration with my system.
I have to do this weekly with my bleeding edge Hyprland setup.
I’ve been using nvfetcher to feed my nightlies addiction for software that doesn’t have a flake.
Only major hiccup I had was pulling a few packages from nixpkgs master due to a bug that got introduced in unstable for electron apps before it hit cachix. Wasn’t expecting it to take a day to compile everything that depended on it.
I’ve been playing with NixOS in spare time for a few weeks now and I’m afraid I don’t have a very good news for you. It looks like the learning curve is just very steep. It took me quite a lot of time to get to the point where I have any idea what I’m doing. Some beginner friendly resources which helped me:
Generally I don’t like video tutorials much - I prefer reading things in my own speed and being able to copy & paste stuff.
But only looking at the titles of those videos sounds promising enough to give them a try :-)
(I didn’t yet have the time to watch any of them.)
One aspect I find interesting:
One look at the Misterio77 configs shows that the concept of flakes seems to be important. I have no idea what they are, but I can see that both youtubers have something about flakes as the second video in their NixOS playlists - looks like I should better learn about this concept soon :-)
Once you have some foundational knowledge, I find more answers searching github with language:nix <some terms>. Usually I can find a few repos with an adjacent enough solution to deconstruct and apply to my setup.
I know what you mean - the problem with this approach is that things might work, but I am using it not in the way it’s intended, because I didn’t understand the underlying concepts… But I cannot search for concepts of which I don’t know they exist…
lol true, i read a comment that explained it as " nix is for people who need to install different apps all the time, especially programmers who need to test with every different lybrary etc, or people who need to have their system writen in a config file, to deploy it to others computers etc" so for me this isn’t viable, i only use nix for a few packages that i want to keep up to day, or packages that fedora don’t have, that’s way i went with fedora atomic and nix, a stable system but without needing the entire nixOS
This is absolutely intended. Nix is a programming language, package manager, and operating system.
Nix the package manager is intended to be used on nixos and non-nixos operating systems. It has first party support for Darwin (macOS).
My nixos build is not daily driver ready, so I’m still on Ubuntu for my productivity systems. The majority of the Ubuntu apps I use are managed via nix using home manager at this point. These share the same configurations with my nixos systems.
It is relatively low risk* since nix installs everything in /nix/store and sets up some env vars and user systemd services with symlinks to map to there. If I install Firefox with nix, the Ubuntu version is still there untouched. My PATH just hits nix first before the system. You have to change like one file if I’m remembering correctly after uninstalling if you want to back out which is the trigger for a nix package to come before a native package.
If you dip into declarative app configs (zsh, fish, nvim, etc.) you can absolutely lose the original. I tracked all that in a dotfiles repo before nix personally. Just have backups and start small.
Never used a tiling window manager. What additional programs/packages does one need to make it functional? For the most part, as everyone’s usage is different. And does it work with gaming without making you read through a manual to setup the frame/window correctly? Would be interested in trying hyprland, but don’t want to sink weeks into tweaking it. :)
Since I posted my config here it’s changed quite a bit. If you wanted to rip out my hyprland.conf check /nixos/home/hypr/default.nix
There should be some home.file = text ‘’ text here ‘’; with my config for the bones I use.
You should be able to decipher where these should live, but some of the values like ${spaghetti.user} or the nix-colors palette values won’t work without too having that installed.
~
My first days of using hyprland went something like this:
What package would you need to change wifi configurations. You using NWM, IWD or WPA? Does that package have a GUI or are you comfortable using the terminal in TUI or typing configurations via commands, or editing files using vi / nano?
Oh, that package you just installed isn’t running at boot, better add that to the exec once in hyprland.conf
Wait that package should be added as a service and not as the package?! Do I still need to enable the package or does services.foo.enable = true; handle that?
Home-manager sounds like a waste of time, why would I want refactor my config for the Nth time?
Man Home-manager makes configuring everything so easy, why was I doing everything manually before?
Wait I don’t have a calculator installed? Why am I editing basic text files in Lite-XL? Oh, I’ll need some scripts to change keyboard brightness, I could add a Dunst notification to foo.bar that would be cool! Man I wonder if this program let’s me change XYZ?
It’s become a lot 😅
~
Once I got out of that mess, picked some basic packages that fit my needs I moved onto… adding more packages, configurations, modules, hosts, theming support and so on.
For your gaming question, yeah it works great! If your using NVIDIA hardware read the wiki and add the suggested config options to hyprland.conf but it all should hit the ground running without much configuration. The closed drivers will perform much better in gaming.
If your on AMD Graphics just send.
Full screen games work fine, same with windowed.
If you’ve not tried gaming under Wayland you shouldn’t really be too concerned, it works mostly fine these days under Steam / Proton. Expect some issues but it’s always good to expect worse than you’ll receive.
Thanks for the details. I’ve jumped around, but use Gnome as it just works and I don’t have to tweak much. It sounds like hyprland would allow more control, that after I got past the initial setup, I could kind of set it and forget it, until I wanted to add to it as the landscape changes over the years. Maybe I will continue with both hyprland & Gnome until I get my footing.
Good to know that you can use GUI along with TUI. I would want a GUI wifi manager, because I don’t want to mess around with configuring my wifi in the terminal.
Home-manger is great, but yeah, I get the original sentiment. Flakes and home-manager are complicated, until they are not. :)
Also good to hear it works great with gaming. I was just concerned that because most games are full screen and Gnome does it for you, that it would nuke your window setup in a tiling window manager like hyprland, but again I’ve never used a tiling window manager (other than failing with herbstluft many years ago).
Wayland is great. Just need to figure out remote access and I think I have all the features that X11 offered at this point.
I didn’t say it earlier- but your setup looks great btw.
Cheers man, appreciate it. It’s an awful mess rn, but an ever changing awful mess.
Ahh I tried to have herbstluft running before I had hypr running, but my Linux inexperience got me when I landed in a tty and couldn’t run the wm.
Remote access into my personal machines isn’t required outside of SSH, for work I remote into Windows machines using remmina without any issues. I was working on screen sharing in my config, in /hardware/audio/ but got distracted by the rest of my config.
Running Hypr for a while has really given me more insight into the “bloat” of modern desktop environments, NixOS too has pushed me further into that rabbit hole.
I mean, if your running Nix why not add another branch to your git and give it a twirl?
WDYM by “directory it drops down into”? nix develop stays in your current working directory.
If I wanted to clean up state, I’d create a clean task in the build system or build a clean script that I’d wire up to the flake outputs such that you could run nix run .#clean.
As for “drop down”, I was loosely referring to the newly spawned terminal
clean scripts get the job done. I was thinking of persisting changes to the filesystem state only while the ephemeral shell was live, that way every time I ran nix develop i would check to make sure my project could automatically build, and If there was any state that needed persisting, I would have to commit/push and label those changes somewhere before ending my session
You could achieve something like that using bubblewrap; effectively a container. You can tell it to mount tmpfs wherever you like. That has other issues though.
That’s a big of a complex setup which other people potentially working with you may not want to have. A clean task is just better. If you’re using git anyways, you can also just use git clean.
But kde2nix is archived on GitHub? And it doesn’t have any instructions in the README, it just says “Merging into Nixpkgs: NixOS/nixpkgs#286522”. How do I actually use it, what do I have to put in my configuration.nix file?
There’s two ways to create a dev-environment, which is how you should start. Don’t worry about building a project with nix until you get a dev shell with all your (runtime) dependencies. You can do this by creating a shell.nix or use flakes and have an output for devShells.default. You can use mkShell to accomplish this. I would give you a reference config, but I can’t do that at the moment. If you need help with this later reach out and I’ll get something together.
After that you can work on building it. This involves making a derivation that contains the runtime dependencies of your code, as well as the source itself. If its python, this would include, likely, the entirety of your project. This could be a little tricky, but a lot of people package python code, so there’s things in nixpkgs meant for packages python projects. This article might be helpful, or out-dated: nixos.wiki/wiki/Python but it should point to some useful things in nixpkgs to build python projects.
Then, you can focus on containerization, if you really need it. I don’t know how much you know about nix, but building in nix inherently isolates dependencies away from one another, so if you get the process above working you know it is reproducible. But unlike a container, the above build structure only works on a machine with nix. So if you want to distribute your project as a container, while utiltizing your nix build process, you can look into something like dockerTools from nixpkgs: nix.dev/…/building-and-running-docker-images.html
Thanks, I think I finally got it, but I think I’ll need to switch to flakes if I want to be able to install say numpy==1.10.0 instead of latest (is there a way to specify which python package version should be installed in mkShell?)
use a package manager defaulted from nix packages: {pkgs ? import <nixpkgs> {} }:
Make an ephemeral shell with programs located in the package manager: pkgs.mkShell {
Define the set of installed packages in the ephemeral shell
<span style="color:#323232;"> packages = with pkgs; [
</span><span style="color:#323232;"> (python310Full.withPackages # Include python310 in the set of installed packages
</span><span style="color:#323232;"> (python-pkgs: with python-pkgs; # not entirely sure what's going on here, is python-pkgs a predefined arg? fails with nativeBuildInputs if this isn't here
</span><span style="color:#323232;"> [numpy pandas requests]))]; # the pip packages to include
</span>
I’ve been tempted to try hyprland. Theres limited wayland based tiling window managers. How easy was it configure? Do you enjoy using it? And in general, do you have problems with running applications?
The defaults for hyprland are pretty good in my eyes, I’ve made some tweaks to the colour scheme, animations and even animated window borders but really its what you make of it.
Love using Hyprland, its minimal (which is a plus for me), no real issues outside of a sleep bug with my laptop when running hybrid graphics mode (amd igpu + nvidia gpu)
If you are not building your hyprland config from nix (as I am currently via symlinks) you can save the config file, and it will already be active allowing you to quickly test / amend / break all the things. For my config I need to rebuild the system, logout and login to see changes. Since I’ve been using Hyprland for a while now I’ve not needed to make many changes to the config so that works better for me.
I jumped from KDE to Hyprland, without having used a tiling window manager before, so adding all the necessary applications for things like brightness control, audio control was all quite a bit to take in from a full-fledged desktop environment.
nixos
Hot
This magazine is from a federated server and may be incomplete. Browse more on the original instance.