This is the configuration for my home server running NixOS. The
current flow is one where I'll author it here, and then copy it on to
the server and install it using sudo
(potentially automated
though I don't think it will change enough to warrant that. I may also
use NixOS elsewhere in which case this may get more interesting.
Documentation is available at configuration.nix(5) man page, on https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
Declare that this configuration is a function accepting
config
, lib
, pkgs
, and other
discarded parameters.
{ config, lib, pkgs, ... }:
Do some stuff…to be closed later.
{
Use the result of the hardware scan…will probably also dig into this later but it will remain separated.
[ ./hardware-configuration.nix ]; imports =
The current system uses old-skool BIOS/MBR booting, so configure GRUB 2 with that expectation and the relevant drive for the system.
true;
boot.loader.grub.enable = "dev/sda"; boot.loader.grub.device =
This system is connected using good ole' CAT-6 cable so it doesn't need much in the way of configuration. I'll specify the hostname where at least one theme I use is mathematicians.
"gauss"; networking.hostName =
This server is behind a firewall so for now I'll leave this alone. Coming back to it to tighten things up and deperimeterize at some point but having no concrete need to do so right now.
I'm in the Eastern timezone…I'd probably typically use the name
EST5EDT
(I think?) but I'm not sure if that's supported so
I'll just go with a nearby city that I know is.
"America/NewYork"; time.timeZone =
Prefer American English encoded with UTF-8
"en_US.UTF-8"; i18n.defaultLocale =
This is copied from the sample…largely since I may want to play with the font. I'm not sure if I need to mess around with the keyboard settings yet, but these are certainly reasonable defaults. I've largely stopped doing things like rebinding caps lock and I don't think Linux computers need Alt help like Macs often do.
{
console = font = "Lat2-Terminus16";
keyMap = "us";
useXkbConfig = true; # use xkb.options in tty.
};
For now I'll just omit this entirely with the idea that this will be used primarily as a server. I've also been a Wayland user for several years and at first blush these do not seem like they'd be used for that purpose.
CUPS is also initially omitted - there is a USB printer near this server that I may want to configure later on, but right now I primarily use one that connects directly to the network (and I don't expect to print jobs from this system).
I'll configure pipewire since I recall that being the latest contender in the battle of the Linux sound subsystems. At some point I'd probably want to be able to use the server to play music while I'm near it.
{
services.pipewire = enable = true;
pulse.enable = true;
};
The keyboard is already configured…a mouse is connected which probably doesn't need help but also is unimportant unless I add a GUI, so nothing to see here.
I'll add myself so as to not just mess around as root (but with
sudo
access). I'll likely want some packages at some point
but can just leave that blank for now (again with the expectation that
I'll primarily use other systems as terminals).
{
users.users.mwhipple = isNormalUser = true;
extraGroups = [ "wheel" ];
packages = with pkgs; [];
};
For now I'll also just leave this blank since nano
is
included by default.
with pkgs; []; environment.systemPackages =
Nothing to see here yet, the mentioned needs are SUID or launched in sessions.
SSH Daemon.
Use it.
true; services.openssh.enable =
Define Version of OS State
Don't change this without expecting major breakage.
"24.11"; system.stateVersion =
This is borrowed from the NixOS manual.
true;
system.autoUpgrade.enable = true; system.autoUpgrade.allowReboot =
}