NixOS: Difference between revisions

 
Line 42: Line 42:
</syntaxhighlight>
</syntaxhighlight>


Example config:
<pre>
{ config, pkgs, ... }:
{
  imports = [ ./hardware-configuration.nix ];
  # Bootloader settings
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;


Make sure to add the swap config:
  # 1. ZFS Support for additional drives
<pre>
  boot.supportedFilesystems = [ "zfs" ];
swapDevices = [ {
  networking.hostId = "8425e349"; # Required for ZFS; use 8 random hex digits
  device = "/swapfile";
 
  size = 4096; # In MB
  # 2. Static IP Configuration
} ];
  # Replace 'eth0' with your actual interface name found via 'ip link'
  networking.useDHCP = false;
  networking.interfaces.eth0.ipv4.addresses = [{
    address = "192.168.1.50";
    prefixLength = 24;
  }];
  networking.defaultGateway = "192.168.1.1";
  networking.nameservers = [ "1.1.1.1" "8.8.8.8" ];
 
  # 3. Swapfile declaration
  swapDevices = [ {
    device = "/swapfile";
    size = 4096; # In MB
  } ];
 
  # Standard System Settings
  system.stateVersion = "24.11"; # Check the current version on the ISO
}
</pre>
</pre>