NixOS: Difference between revisions
No edit summary |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 41: | Line 41: | ||
nixos-install | nixos-install | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Example config: | |||
<pre> | |||
{ config, pkgs, ... }: | |||
{ | |||
imports = [ ./hardware-configuration.nix ]; | |||
# Bootloader settings | |||
boot.loader.systemd-boot.enable = true; | |||
boot.loader.efi.canTouchEfiVariables = true; | |||
# 1. ZFS Support for additional drives | |||
boot.supportedFilesystems = [ "zfs" ]; | |||
networking.hostId = "8425e349"; # Required for ZFS; use 8 random hex digits | |||
# 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> | |||
=== Install on VPS === | |||
For a VPS, first install Ubuntu or Debian. | |||
Then run https://github.com/elitak/nixos-infect. | |||
== Resources== | == Resources== | ||
* https://nixos.org/manual/nixos/stable/ | * https://nixos.org/manual/nixos/stable/ | ||
* https://wiki.nixos.org/wiki/NixOS_Wiki | * https://wiki.nixos.org/wiki/NixOS_Wiki | ||