Best place to look for setups?

I’m new at nix with just a couple of days, read documentation and watch some videos, as I’m mostly experimenting state of the OS, I want to test best use cases for workstation, I usually look for most downloaded packages on things relevant to me, but I see there are no stats for the packages, can someone point me a direction? where can I check for setup schemes stable and flow

sorry if the request is vague I’m wrapping my head around the concept

1 Like

If the issue you’re experiencing is that of getting started with your config, I guess it depends mostly on what you want to do with your machine. That will the inform what packages and subsystrms are useful to configure.

So let’s start there: what use cases do you have in mind your machine?
Rough categories will do for now, e.g. dev work, business/office machine, gaming machine, etc

I’m developer, I try to avoid desktops and work my way with minimal just a window manager and a file manager, I’m using hyprland just to test what the cool kids are using, for the moment I have one conflict, with probably project philosophy, I should not use nvm right? this is all about not touching the environment, so I figure, how can I run different projects? should I virtualize everything? I could see myself running everything in docker but I guess there should be a more nix solution to this.

So just to check: that basic setup is already working? If it is, we can skip that :slight_smile:

Ultimately that choice is up to you. I’ve used nvm in the past, and it does work on NixOS.
But there’s a real case for getting rid of nvm in favor of letting Nix manage that directly, yes.

As in NodeJS projects? One recommended way is to write a shell.nix file in each of your projects. This file sets up the dev env needed for its containing project, and contains the deps you need e.g. the NodeJS version you need.

Once you have written shell.nix, the idea is that you can just do something like cd $PROJECT_DIR; nix-shell, which drops you into a shell with the dependencies you need installed and on $PATH.
From there you can just execute e.g. node.

Nix gives you, the user, all the power, and thus you can freely choose to do so if and when that is most convenient. And that capability is a great thing.
But personally I wouldn’t want that for my dev tools. The less virtualization and/or containerization needed, the better. IMO it’s just wasted CPU cycles when it’s used but not strictly needed, with the user (you, in this case) as the sole victim.

The shell.nix approach means that you can just run your tools natively, no virtualization needed.
It also means that your projects become more reproducible, and are trivial to build for any other devs that have Nix available.

So just to check: that basic setup is already working? If it is, we can skip that :slight_smile:

yes, it has some flaws, I havent being able to enable controls for volume (using pipewire), usbutils is not really working, and some small issues like that, as nix is all about being reproducible I would think there were like a space with nix-config from where you can pick your poison and just run nix-build or at least to use it as a starting point, is there something like that? I found some github repos but nothing well-structured

But personally I wouldn’t want that for my dev tools. The less virtualization and/or containerization needed, the better. IMO it’s just wasted CPU cycles when it’s used but not strictly needed, with the user (you, in this case) as the sole victim.

I see, that’s a great point of view, I was thinking about isolation and virtualization as its only way but

write a shell.nix file in each of your projects. This file sets up the dev env needed for its containing project, and contains the deps you need e.g. the NodeJS version you need.

This is greta I haven’t read that much about nix language tbh but this seems like it is perfect for me

another small obstacle I found was, how should I manage proprietary software that is package in eg .deb like format, I read somewhere there was ways to install this in nix (not sure), this is mostly because my org works with pumble, and I can run it in the browser but I would like to have an isolated windows for that

Sort of. There is no GUI AFAIK, the (easy) way to alter your system configuration is to edit /etc/nixos/configuration.nix directly, make changes there and save it, then update your system with nixos-rebuild switch, or nixos-rebuild switch --upgrade if you also want to upgrade your nixpkgs.

Which leaves the question of discoverability: how can you find out which options exist for /etc/nixos/configuration.nix? That is why I said “sort of”: there is a really long list of options for the stable channel, and one for the unstable channel. Searching through the list matching your channel can be quite helpful.

Yeah the Nix language is worth learning if you’re going to use Nix/NixOS. In fact, your /etc/nixos/configuration.nix file is, probably unsurprisingly, written in Nix.
I can tell you this: Nix may appear a bit strange at first, especially if you’re used to mainly working with mainstream languages in the C family and config languages like TOML and YAML, but it is fit for its purpose like a well-made glove.

BTW, it is possible to use sandboxing for Nix builds. So depending on the properties you’re looking for exactly, there’s no need to choose.

This is an interesting question. It seems that the answer contains a couple of different options.

1 Like

The most fruitful way to look for configs for me is twofold:

When I’m learning the basics of something, I look for tutorials and posts on it

once I know what the individual pieces do, I use github code search (just type in the github search bar, then select “code” instead of “repo”) to see real-world examples.

The state of nixOS documentation, and especially package documentation, is such that a lot of the documentation either says so much, or it’s oral tradition, with very little in-between (nix flake book stands out as neither, for example, but the more you go off the common path, the more you find no one has written about). That said, it’s getting there, slowly.

It looks very complex, but that’s just because you’re having to learn everything up front (nix-lang, nixpkgs, nix-the-package-manager, nixOS, whatever you need to fix to make the things you want work), but once you’ve gotten over the initial hump it’s… deceptively simple, I definitely overthought it at first.

2 Likes

Doing a little recap for reference
first, thanks for your help, it feels a bit daunting at the beginning

what I got from this:

  1. It is not mandatory but really helpful to handle at least basic nix language, it helps to customize how the spaces will be unfold and even create development environments

  2. There are no magical recipes (I hope yet, in future would be great to have a page to download your nix configuration file and magically have everything set up for you), the best at the moment is to use the search to find whatever option required for the nix configuration

  3. there are no limitation in terms on how to use the space, you can even (as far as I get) break the pureness of the system, but would start losing sense the concept of the project, so you can virtualize or setup spaces with nix language to accommodate different environment for example for development.

  4. not really sure about the .deb installation I’m taking baby steps, I see there is a lot concepts involve but the main idea is simplify the environment.

well I’ll keep reading… this is looking great so far :ok_man:

To that end, this should be helpful.
If you’ve ever used something like Haskell, a lot of concepts (e.g. lazy evaluation, currying) should immediately be familiar. Others will likely be pretty familiar anyway (e.g. destructuring, string interpolation, anonymous functions, attribute sets, let-style bindings).

To get started initially, no. But once created you can (and it’s recommended) that you put your config files in a git repo. That way you can do some cool things like remotely provision a new host with the exact same config (which just might be your replacement machine when the day comes).

It’s also true that there are so many options that creating some kind of “starter config” would necessarily either omit a lot of options anyway, or be a File Giganticus :tm:, with most of the content being commented-out options.

You could also talk to the software dev. I’m assuming you’re either paying directly for a license, or have the software provisioned by you by e.g. your employer. In either case, there should be an option for support, and unless their build process is a hot mess, writing a derivation shouldn’t be to difficult.
Whether the dev thinks it’s worth the effort I cannot say, but it’s worth a shot.

1 Like

I can recommend nix.dev in general as a good resource to get started.
The tutorials there just get better and better and it is an official resource.

Another useful tool is using the Github search.
Since NixOS configurations are just code there are a lot of examples.
E.g. if you would search for i3 related config I would recommend something like the following search.
I prefer to exclude the Nixpkgs repo because that contains too many thing, unless I’m trying to package something then I look specifically in that repository.
https://github.com/search?q=lang%3ANix+AND+NOT+repo%3ANixOS%2Fnixpkgs+i3&type=code

4 Likes

As @Nebucatnetzer said: the same applies for any Git forge, for example Sourcehut (which I prefer but GitHub is obviously the biggest one): Browse projects on sourcehut.

tangential but useful:

in case you don’t know, there’s also the “options” tab in the online nixpkgs search, and for home manager options there’s https://home-manager-options.extranix.com/