As we covered in my last post, NixOS is a amazing Linux distribution for creating stable and declared environments. Now while this is amazing for a desktop setup, it is also perfect for a home-server or home-lab.
Let's take a look at a few ways NixOS makes setting up a home-server so much smoother!
Self Hosting Services
NixOS has gained many integrations from a wide variety of services over the years but here are a few you will probably be interested in.
Jellyfin
Out of the box NixOS provides options to easily setup a Jellyfin instance on your computer, just add the following to your configuration.nix
services.jellyfin = {
enable = true;
dataDir = "/home/your-user/jellyfin/data";
user = "your-user";
};
It is that easy to spin up a fresh instance of Jellyfin and there are even more options all found on search.nixos.org
Vaultwarden
Never before has it been this easy to setup Vaultwarden, a fork of the Bitwarden server with all the features of a paid Bitwarden account!
services.vaultwarden = {
enable = true;
dbBackend = "postgresql";
# Store your variables like admin password here
environmentFile = "/home/your-user/vaultwarden/.env";
config = {
SIGNUPS_ALLOWED = false;
DOMAIN = "https://vaultwarden.example.com";
};
};
There are even more options than these though so again make sure to checkout search.nixos.org
Nextcloud
Here we are the big boy himself, Nextcloud.
Of course like all the other popular self hosted services Nextcloud has a large variety of options to get your services up and running.
services.nextcloud = {
enable = true;
home = "/home/your-user/nextcloud";
https = true;
hostname = "nextcloud.example.com";
settings = {
trusted_domains = [
"talk.nextcloud.example.com"
"files.nextcloud.example.com"
];
};
};
And for the final time those are just a fraction of the available options to configure Nextcloud through NixOS, so if you need to configure anything else make sure to check out search.nixos.org/nextcloud.
So have I convinced you yet? NixOS really is the easiest way to manage all of your software on your desktop and home-server!
But what about Docker, there are some things that NixOS hasn't packaged yet so how do I use those or any of my other docker services?
Well do not worry, NixOS again makes it super simple to setup docker and even setup Nvidia Toolkit support for containers that want GPU utilization.
virtualisation.docker = {
enable = true;
# This option is deprecated and will be replaced
# soon but the new option doesn't seem to work
# properly yet so you can just use this.
enableNvidia = true;
};
user.users.your-user = {
# ...
extraGroups = [ "docker" ];
# ...
};
Just like that your ready for anything docker to come, and for those who need to configure docker a bit more, maybe put it in rootless mode, can check out the options on search.nixos.org
Wrapping Up
Well that was easy wasn't it, just a few lines of code and a rebuild later and you could have all of these services up and at it!
This is all well but how do you actually get NixOS and set everything up in the first place?
That is exactly what I'm going to help you do, two weeks from now I'll be getting a new home-server and in a new post, or maybe series of posts, I'll go over everything I do to setup NixOS on my system, so make sure to follow me to stay tuned for those!
Another little promotion but if you are interested in NixOS, your just getting started or even if you are more experienced user, I have a documentation site where I publicly write about tons of issues I come across on my journey through NixOS and exactly how I fixed them.
As well I have a ton of resources linked for learning how to get started with NixOS so make sure to check it out at docs.windswept.digital
Top comments (4)
Related, I recently watched this video on youtube which goes over a similar idea of using NixOS for a basic self-hosted system.
Great info!
This seems like a perfect use case for NixOS, thanks for the post!
That was very informative mate thank you.