diff --git a/pure/devices.nix b/pure/devices.nix new file mode 100644 index 00000000000..140f8afb7e6 --- /dev/null +++ b/pure/devices.nix @@ -0,0 +1,20 @@ +[ + { id = "net-dev-1"; + comment = "Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express"; + location = { + busId = "pci-0000:02:00.0"; + macAddr = "00:14:22:bc:68:51"; + prefer = "macAddr"; # i.e., don't care if busId changes + }; + extraModules = []; # tg3 + } + + { id = "keyboard-1"; + comment = "Dell Computer Corp. SK-8125 Keyboard"; + location = { + busId = "usb-003-003"; + }; + extraModules = []; + } + +] diff --git a/pure/disks.nix b/pure/disks.nix new file mode 100644 index 00000000000..c1ad104fbd9 --- /dev/null +++ b/pure/disks.nix @@ -0,0 +1,84 @@ +{ + + /* Old school. */ + + volume1 = { + mountPoint = "/"; + filesystem = "ext3"; + location = { + device = "/dev/hda1"; + }; + creationParams = { + disk = "/dev/hda"; + partition = 1; + startCylinder = 1; + endCylinder = 1000; + }; + }; + + volume2 = { + filesystem = "swap"; + location = { + device = "/dev/hda2"; + }; + creationParams = { + disk = "/dev/hda"; + startCylinder = 1001; + endCylinder = 1100; + }; + }; + + + /* With partition labels; don't care which device holds the file + system. */ + + volume1 = { + mountPoint = "/"; + filesystem = "auto"; + location = { + label = "ROOT_DISK"; + }; + # Only relevant when creating. + creationParams = { + disk = "/dev/hda"; + partition = 1; + startCylinder = 1; + endCylinder = 1000; + filesystem = "ext3"; + }; + }; + + + /* LVM. */ + + volume1 = { + mountPoint = "/data"; + filesystem = "auto"; + location = { + lvmVolumeGroup = "system"; + lvmVolumeName = "big-volume"; # -> /dev/mapper/system-big-volume + }; + }; + + lvmConfig = { + devices = [ + ... + ]; + groups = [ + { name = "system"; + volumes = [ + { name = "big-volume"; + size = 1048576; # -> 1 GiB + } + { name = "blah"; + size = 1048576; # -> 1 GiB + } + ]; + # When realising this configuration, only delete explicitly + # listed volumes for safety. + canDelete = ["foobar"]; + }; + ]; + }; + +} diff --git a/pure/networking.nix b/pure/networking.nix new file mode 100644 index 00000000000..0f3b550a8f5 --- /dev/null +++ b/pure/networking.nix @@ -0,0 +1,58 @@ +{ + + identification = { + fromDHCP = false; + hostname = "foobar"; + }; + + + interfaces = [ + + # Manual configuration. + { name = "eth0"; + hardware = { + type = "ethernet"; + device = "net-dev-1"; + }; + link = { + ip4 = { + address = "192.168.1.2"; + nameservers = [ # to be used when this interface is up + "1.2.3.4"; + "1.2.3.5"; + ]; + routes = [ # idem, add when up + { destination = "0.0.0.0"; + netmask = "0.0.0.0"; + gateway = "192.168.1.1"; + # iface implied (eth0) + } + { destination = "192.168.1.0"; + netmask = "255.255.255.0"; + # iface implied (eth0) + } + ]; + }; + ip6 = ...; + }; + } + + # Automatic configuration via DHCP + { name = "eth0"; + hardware = { + type = "ethernet"; + device = "net-dev-1"; + }; + link = { + useDHCP = true; + }; + } + + ]; + + + firewall = { + # ... + }; + +} \ No newline at end of file diff --git a/pure/top-level.nix b/pure/top-level.nix new file mode 100644 index 00000000000..46c220f5c8e --- /dev/null +++ b/pure/top-level.nix @@ -0,0 +1,26 @@ +rec { + + devices = import ./devices.nix; + + disks = import ./disks.nix; + + networking = import ./networking.nix; + + systemServices = [ + terminalRunner + syslogServer + dhcpClient + sshServer + subversionServer + ]; + + systemInit = { + inherit devices disks networking; + inherit systemServices; + }; + + kernel = import ... { + externalModules = [nvidia vmware ...]; + } + +}