configuration.nix

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.

Signature

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, ... }:

Body

Do some stuff…to be closed later.

{

Include Other Files

Use the result of the hardware scan…will probably also dig into this later but it will remain separated.

imports = [ ./hardware-configuration.nix ];

Boot-loader Configuration

The current system uses old-skool BIOS/MBR booting, so configure GRUB 2 with that expectation and the relevant drive for the system.

boot.loader.grub.enable = true;
boot.loader.grub.device = "dev/sda";

Networking Configuration

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.

networking.hostName = "gauss";

Firewall

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.

Locale Configuration

Timezone

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.

time.timeZone = "America/NewYork";

i18n

Prefer American English encoded with UTF-8

i18n.defaultLocale = "en_US.UTF-8";

Console Configuration

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.
};

X Configuration

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

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).

Sound Configuration

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;
};

Input Configuration

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.

User Configuration

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; [];
};

System Packages

For now I'll also just leave this blank since nano is included by default.

environment.systemPackages = with pkgs; [];

Program Configuration

Nothing to see here yet, the mentioned needs are SUID or launched in sessions.

Services

  1. SSH Daemon.

    Use it.

    services.openssh.enable = true;

System Configuration

  1. Define Version of OS State

    Don't change this without expecting major breakage.

    system.stateVersion = "24.11";

Automatically Upgrade

This is borrowed from the NixOS manual.

system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = true;

Close

}