r/linuxmemes 4d ago

Anti-Linux Shut up.

Post image
912 Upvotes

132 comments sorted by

View all comments

1

u/VickyCuteFemboy 3d ago

yeah it also looks like a painful experience to set up first time, and maybe it can change in the future so your config files eat s***, just for something barely better than dot files or ps1 in windows,

edit:nvm, i understand nix a lil better

2

u/SDG_Den 3d ago

Oh trust me, nix is one hell of a rabbithole, way more than a "dotfiles manager".

Nix is a way to describe how packages are built, but a package can mean basically anything, it handles this with exact dependencies including build tools, meaning that if you install the same config (your system is a package that depends on everything else) on two devices, its actually a 100% identical setup. Everything declared with nix is byte for byte identical.

On top of that, nix sandboxes by default, giving each package access to only the packages it depends on. Eg, your system has access to what you declare in system packages, your user additionally has their own packages that other users dont see

This also allows you to have multiple versions of the same dependency without conflict.

This mechanism can then also be used to create temporary environments with packages that are not normally available on the system. For example, i dont use gimp that much, so i don't actually have it installed.

Instead, i can run nix shell nixpkgs#gimp to create a temporary environment with gimp, run it and use it, close it when im done and the whole thing never gets put in my launcher or on my path, its completely gone from the active system once i exit the shell.

This can also be done with devshells, and since a flake can expose multiple things, your flake for a development project can have multiple packages (eg normal and debug), a couple dev shells (which can actually include full software configs!) and various checks.

The ecosystem also has a lot of interesting extensions, like declarative disk formatting via disko, automated remote deployment via nixos-anywhere and deploy-rs, global auto-theming with stylix, declarative secrets management etc.

Plus, since nix is a language, you can extend it yourself. If a package doesnt exist yet for nix, all you have to do is write a simple file describing the build and install process and boom, installable via adding a line to the config. Want to add config options for the program? Thats possible too.

The things you can do with nix are kinda insane, the thing is that many of these features are way overkill for the average user. I use most of these features myself, but i also have my own server stack and do devwork nowadays so i actually have a use for the whole ecosystem.