• 3 Posts
  • 250 Comments
Joined 1 year ago
cake
Cake day: April 27th, 2024

help-circle

  • Sorry for not answering sooner - got bogged down with work yesterday. I see you already got a response, but thought I’d write up what I had in mind anyways :)

    The benefits

    I want a computer that just works, to the extent that that’s possible. I’ll fix stuff that needs fixing, but ideally I don’t need to do much.

    That’s great, and good news, this is very easy to achieve with NixOS.

    As the other commenter said, rather than (imperatively) running commands like apt install, you configure the entire system through your “nix config”. In the simplest scenario, that’s just a single file which gets auto-generated when you install NixOS, and if all you need/want is to add some packages, then that’s enough (I’ll get to different approaches below). In other words, NixOS is declarative rather than imperative: you use the config file to “declare” what the system should look like, and it’s Nix’s job to ensure that your system adheres to this.

    I need to emphasize though, that this is not just about packages, but about every single piece of configuration you could possibly touch on your system. I am currently managing 30+ NixOS machines from a single centralized config, and I have not once edited or even opened a single config files on any of these machines, ever.

    Nix comes with a vast package repository: repology.org repository size.freshness map, but just as importantly, with a vast collection of “modules”. Think of modules as an abstraction for all the little things you would need to configure to get something running.

    Let’s take everyone’s nightmare configuration as an example, getting Nvidia GPUs to function properly. This is the ArchWiki article on how to do so, and the Debian Wiki does not make it look any simpler. For NixOS, it should be as simple as adding this to your nix configuration file:

    hardware.nvidia.enable = true;
    hardware.nvidia.open = true; # use the open source drivers; set to false if you want the proprietary ones
    hardware.nvidia.nvidiaSettings = true; # optional - will enable the Nvidia settings menu
    

    Of course, all the same complicated steps as with any other distro are necessary “under the hood”, it’s just that with NixOS, someone else already has “declared” what the system needs to look like for Nvidia GPUs to work, and abstracted it behind these easy-to-use config options. There’s currently more than 20.000 such configs options defined, which sounds intimidating, but you only need to use those you actually want to use. For example, let’s say you want to install and configure a jellyfin server.

    Again, all that is necessary to be up and running is

    services.jellyfin.enable = true;
    

    but if you want to customize the install, you can simply search for all available options. Also note that if you ever disagree with how a package/module is built/installed/configured, you can just overwrite the “official” way, though at least in my experience, that is basically never necessary.

    OK, back to you.

    Let’s say you have successfully configured the system as you want it to be - KDE5 installed, your favorite packages installed, Steam configured with programs.steam.enable = true;. Now the worst case happens, and your SSD hits the shitter; it’s dead, completely unrecoverable.

    Good news: as long as you have a copy of that configuration.nix file, you can be up and running with the a new harddrive and exactly your same, old system in a matter of minutes.

    Another scenario, let’s say you manage to brick your install (somehow). No sweat, reboot your PC, the previously used NixOS configuration is available as a grub (or systemd-boot) entry. Does not matter if you ripped out all the drivers, switched from KDE to Gnome in the mean time or anything else.

    Essentially, disaster recovery is easy in NixOS, even if it is necessary very, very rarely, because nix will already warn you “yeah this doesn’t work” when you are building the system.

    The Nix language

    You have already seen some of it above. Most people say NixOS is not a beginner distro, and that opinion is mostly due to the Nix language. It’s… not pretty, but its learning curve is not bad if you just want to do “basic” stuff like configuring your system in the way shown above. For more advanced topics, there is a steep, but not very long learning curve. If that is worth it is up to you; there is no need for it, but it does allow you to write your own modules, and to leverage a full turing-complete programming language inside your configuration. But IMO, just learn as you go, no need to try and study the language just to use NixOS.

    Going wild

    For a single machine, the single configuration.nix file is perfectly fine. If yo only have a single machine anyways, I’d say stick with that.

    As soon as it’s 2 or more machines though, it makes sense to move the configuration elsewhere, in a single project which you can back up (usually, via git). This also allows you to reuse parts of your config - for example, if your user is always the same, and KDE should always be there,…, you can define that once and then import that into the inidividual machine’s config. You then simply tell nix “build this config on that machine”.

    There are a ton of awesome projects in the “nix ecosystem”, so to speak, which you can also leverage: for example, you can add home-manager to your config, and then use your existing configuration but extend it with config for inidividual users’ environments, like customizing KDE itself, configuring git, ssh, your terminal,… You said you are not a customizer, so this probably does not apply to you that much, but it’s still good to know that it is easily possible.

    Other projects add capability for secure secrets management, for things like turning Nix into a very good approximation of SteamOS,…

    TL;DR:

    NixOS makes tedious things simple, and disaster recovery trivial. It offers more (and fresher) packages then even the allmighty AUR, while being stable as a rock.

    You will never have to re-solve a problem, no matter how long ago you originally solved it.








  • Actual answer for 3:

    • put jellyfin behind a proper reverse proxy. Ideally on a separate host / hardware firewall, but nginx on the same host works fine as well.
    • create subdomain, let’s say sub.yourdomain.com
    • forward traffic, for that subdomain ONLY, to jellyfin in your reverse proxy config
    • tell your relatives to put sub.yourdomain.com into their jellyfin app

    All the fear-mongering about exposing jellyfin to the internet I have seen on here boils down to either

    • “port forwarding is a bad idea!!”, which yes, don’t do that. The above is not that. Or
    • “people / bots who know your IP can get jellyfin to work as a 1-bit oracle, telling you if a specific media file exists on your disk” which is a) not an indication for something illegal, and b) prevented by the described reverse proxy setup insofar as the bot needs to know the exact subdomain (and any worthwhile domain-provider will not let bots walk your DNS zone).

    (Not saying YOU say that; just preempting the usual folklore typically commented whenever someone suggests hosting jellyfin publicly accessible)



  • Neovim, because I wanted something that would not just disappear.

    I never really got along with VSCode, opting for Atom instead. Microsoft bought GitHub, which owned Atom, and promptly discontinued it.

    Nvim has such an active community (and no “owner”) that I’m certain that this won’t happen again. At the same time, the plugin system is so flexible that I’m also certain that I will never miss out on any shiny new features.

    Over the years, my config has matured, and is mine. The thought of going back to an editor, any editor, less flexible in its configuration than nvim is just… an absolute “no”.

    It’s a steep learning curve, but well worth it.


  • I dream of a pure information protocol. Kinda like RSS, but… More.

    • allow any piece of information (news article, DM, sensor reading,…) to be wrapped in a standard format
    • subscribe to any number of source directly or indirectly (e.g. through a self-hosted relay server)
    • allow networks to define default data sources (e.g. get sensor data from machines as soon as you are connected to corporate networks
    • make the data declare what UI elements are required,
    • but allow clients to display them however the fuck they want
    • allow user to assign priorities statically or programmatically to any source, and to filter, sort, categorize based on it

    Essentially: I want “the feed” from universes like The Expanse