I wish PiKVM were based on NixOS. As it's used like an appliance, people are not expected to customize the image. Or even regularly install updates. I always fear it'll break and sever my connection to my server. I'd have a lot more peace of mind if I could just redeploy my custom wireguard-enabled config.
I have been thinking to give NixOS a spin but feel like it's above my brain capacity for me to handle.
Do you also use homemanager and Flakes? Homemanager kinda makes sense (manage packages for non root users) but what does Flakes do?
I am already trying it and I am still no expert. How I understand flakes is that it is a file with inputs, like nixpkgs and other flakes or repos you might depend on and some outputs that can be things like a nixshell with packages and environment variables, custom packages and configs like your NixOS configurations and home manager. When you use your flake for the first time, by entering a nix shell with nix develop, building a package with nix build, rebuild your NixOS system with nixos-rebuild --flake .#<hostname>, etc, nix will generate a flake.lock file that stores the hashes of all of your inputs and thus pinning the input versions. This means that if you ever run any of those commands again, you should get the same result because the inputs are pinned and the same version. If you want to update, you just run nix flake update and it will regenerate the flake.lock file with new hashes for the newest version. The advantage with flakes is that it is fully reproducible, even if one of your dependencies changes, because the hash is specified and centrally managed in the inputs of your flake.
Nix flakes can be used for your NixOS system by adding the nixos configurations in the outputs of your nix flake and adding the dependencies like nixpkgs to the inputs. You can also combine it with home manager by either specifying it as a separate output or adding it as a nixos module inside the nixos configurations output. You just copy your existing nixos and home manager config to the folder with your flake and reference them inside the flake.nix. If you added home manager as a nixos module, you only need to run nixos-rebuild switch --flake <path-to-flake>.#<hostname> and it will automatically rebuild both your NixOS configuration and home manager configuration. You can then backup the folder with your flake and configurations by uploading them to GitHub for example.