My server now lives in a Git repo!
-
@tux Are you using one repo per server/host?
I'm currently only using Git locally and simply push the Nix config to the server via SFTP. There are certainly smarter solutions out there.

-
I'm currently only using Git locally and simply push the Nix config to the server via SFTP. There are certainly smarter solutions out there.

@tux Ah okay.


-
My server now lives in a Git repo!

Just took the plunge and set up my first host completely declaratively. Infrastructure as Code (IaC) is a total game changer for keeping the digital engine room organized. #NixOS #InfrastructureAsCode #GitOps #SelfHosted #Linux #DevOps
@tux
Hi, its my first comment on mastodon
️Am i right that NixOS can use configuration files to set up the server or ist an IaC tool like Terraform?
-
R AodeRelay shared this topic
-
@tux
Hi, its my first comment on mastodon
️Am i right that NixOS can use configuration files to set up the server or ist an IaC tool like Terraform?
Welcome to our instance!
NixOS uses configuration files to describe the desired state of your entire system — packages, services, and settings — and then reproduces that state. So it’s not just running commands, but defining a complete declarative system setup.
Terraform is also declarative, but focuses mainly on infrastructure like VMs, networks, or cloud resources — not the internal system configuration.
In short: NixOS manages system state, Terraform manages infrastructure — similar idea, different scope. -
Welcome to our instance!
NixOS uses configuration files to describe the desired state of your entire system — packages, services, and settings — and then reproduces that state. So it’s not just running commands, but defining a complete declarative system setup.
Terraform is also declarative, but focuses mainly on infrastructure like VMs, networks, or cloud resources — not the internal system configuration.
In short: NixOS manages system state, Terraform manages infrastructure — similar idea, different scope.@tux
Thank you for your response.Pretty interesting never heared of NixOS.
Does NixOS change wirh the configuration Files or can they just used at the beginning?
-
@tux
Thank you for your response.Pretty interesting never heared of NixOS.
Does NixOS change wirh the configuration Files or can they just used at the beginning?
If you're doing it right, everything is in the configuration file. In fact, the system will take steps to prevent you from making changes to the system yourself - the settings for your services are symlinks to a directory owned by a service that is readonly even to root. It's designed to require you to use Nix, enforcing Code-as-Documentation.
I think it's important to understand as well that there is 3 things you can call Nix.
The Package Manager, The Language, and the OS.
Each one can technically be used on it's own - many people use the language and package manager on Non-Nix OS's, like other Linux Distros and even MacOS, but they work best together.
This bit is very off topic, but the end result of all this is quite neat:
Everything is reproducible. The binaries and configuration files will always have the same hash, and the same files end up in the same places.
This extends far enough out that the laptop I am typing to you on right now has a tmpfs for the root filesystem. The system mounts
/nixto that root filesystem, and in a fraction of a second populates the entire filesystem and proceeds to boot.The only data that survives a reboot is
/homeand/nix.My Laptop's OS is, effectively, ephemeral. There is no sustained system state that survives a reboot that isn't also defined in my configuration.
Also you can totally use Nix to do Infrastructure, it's just a little bit more involved.
-
I'm currently only using Git locally and simply push the Nix config to the server via SFTP. There are certainly smarter solutions out there.

-
If you're doing it right, everything is in the configuration file. In fact, the system will take steps to prevent you from making changes to the system yourself - the settings for your services are symlinks to a directory owned by a service that is readonly even to root. It's designed to require you to use Nix, enforcing Code-as-Documentation.
I think it's important to understand as well that there is 3 things you can call Nix.
The Package Manager, The Language, and the OS.
Each one can technically be used on it's own - many people use the language and package manager on Non-Nix OS's, like other Linux Distros and even MacOS, but they work best together.
This bit is very off topic, but the end result of all this is quite neat:
Everything is reproducible. The binaries and configuration files will always have the same hash, and the same files end up in the same places.
This extends far enough out that the laptop I am typing to you on right now has a tmpfs for the root filesystem. The system mounts
/nixto that root filesystem, and in a fraction of a second populates the entire filesystem and proceeds to boot.The only data that survives a reboot is
/homeand/nix.My Laptop's OS is, effectively, ephemeral. There is no sustained system state that survives a reboot that isn't also defined in my configuration.
Also you can totally use Nix to do Infrastructure, it's just a little bit more involved.
@krutonium @satobi @tux how much more difficult is it to setup a server via nixos compared to ubuntu server? i just want to host a fileserver and maybe immich in the future
-
@krutonium @satobi @tux how much more difficult is it to setup a server via nixos compared to ubuntu server? i just want to host a fileserver and maybe immich in the future
@arthurspringer @krutonium @satobi
I believe setting up NixOS is not much harder than setting up a regular server.
I recently ordered a virtual machine with Ubuntu from Hetzner (or another provider) and ran the following script to get started:
curl https://www.google.com/search?q=https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | PROVIDER=hetznercloud NIX_CHANNEL=nixos-25.11 bash 2>&1 | tee /tmp/infect.log
https://github.com/elitak/nixos-infect
Important: Make sure to add your public SSH key when ordering the VM in the provider’s web interface or add it manually.
For the rest of the configuration, I recommend consulting an AI — that’s what I did as well.
Once everything is set up, you can find the complete configuration in the file /etc/nixos/configuration.nix You can easily edit it directly on the server using Nano.
Good luck!
-
-
@arthurspringer @krutonium @satobi
I believe setting up NixOS is not much harder than setting up a regular server.
I recently ordered a virtual machine with Ubuntu from Hetzner (or another provider) and ran the following script to get started:
curl https://www.google.com/search?q=https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | PROVIDER=hetznercloud NIX_CHANNEL=nixos-25.11 bash 2>&1 | tee /tmp/infect.log
https://github.com/elitak/nixos-infect
Important: Make sure to add your public SSH key when ordering the VM in the provider’s web interface or add it manually.
For the rest of the configuration, I recommend consulting an AI — that’s what I did as well.
Once everything is set up, you can find the complete configuration in the file /etc/nixos/configuration.nix You can easily edit it directly on the server using Nano.
Good luck!
@tux @krutonium @satobi oh nice, is this just for vps tho? i am gonna try and set up a homelab on a thinkcentre tiny, should i just go for a usb-stick there?
-
@tux @krutonium @satobi oh nice, is this just for vps tho? i am gonna try and set up a homelab on a thinkcentre tiny, should i just go for a usb-stick there?
It's even easier at home, at least if you have a keyboard and monitor connected to your server.
There is an ISO with a graphical installer.
-
@tux
Thank you for your response.Pretty interesting never heared of NixOS.
Does NixOS change wirh the configuration Files or can they just used at the beginning?
The file /etc/nixos/configuration.nix always remains the same!
You can also create additional files, e.g., an eytra file for the web server config.