2010-02-16 00:27:51 +01:00
|
|
|
# This module contains the basic configuration for building a NixOS
|
2012-05-25 10:09:25 +02:00
|
|
|
# tarball, that can directly boot, maybe using PXE or unpacking on a fs.
|
2010-02-16 00:27:51 +01:00
|
|
|
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l;
|
|
|
|
|
2011-08-15 00:01:58 +02:00
|
|
|
# For PXE kernel loading
|
|
|
|
pxeconfig = pkgs.writeText "pxeconfig-default" ''
|
|
|
|
default menu.c32
|
|
|
|
prompt 0
|
|
|
|
|
|
|
|
label bootlocal
|
|
|
|
menu default
|
|
|
|
localboot 0
|
|
|
|
timeout 80
|
|
|
|
TOTALTIMEOUT 9000
|
|
|
|
|
|
|
|
label nixos
|
2011-08-15 16:37:00 +02:00
|
|
|
MENU LABEL ^NixOS using nfsroot
|
2011-08-15 00:01:58 +02:00
|
|
|
KERNEL bzImage
|
2011-08-15 16:37:00 +02:00
|
|
|
append ip=dhcp nfsroot=/home/pcroot systemConfig=${config.system.build.toplevel} init=${config.system.build.toplevel}/init
|
|
|
|
|
|
|
|
# I don't know how to make this boot with nfsroot (using the initrd)
|
|
|
|
label nixos_initrd
|
|
|
|
MENU LABEL NixOS booting the poor ^initrd.
|
|
|
|
KERNEL bzImage
|
|
|
|
append initrd=initrd ip=dhcp nfsroot=/home/pcroot systemConfig=${config.system.build.toplevel} init=${config.system.build.toplevel}/init
|
2011-08-15 00:01:58 +02:00
|
|
|
|
|
|
|
label memtest
|
2012-04-09 22:37:54 +02:00
|
|
|
MENU LABEL ^${pkgs.memtest86.name}
|
2011-08-15 16:37:00 +02:00
|
|
|
KERNEL memtest
|
|
|
|
'';
|
|
|
|
|
|
|
|
dhcpdExampleConfig = pkgs.writeText "dhcpd.conf-example" ''
|
|
|
|
# Example configuration for booting PXE.
|
|
|
|
allow booting;
|
|
|
|
allow bootp;
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2011-08-15 16:37:00 +02:00
|
|
|
# Adapt this to your network configuration.
|
|
|
|
option domain-name "local";
|
|
|
|
option subnet-mask 255.255.255.0;
|
|
|
|
option broadcast-address 192.168.1.255;
|
|
|
|
option domain-name-servers 192.168.1.1;
|
|
|
|
option routers 192.168.1.1;
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2011-08-15 16:37:00 +02:00
|
|
|
# PXE-specific configuration directives...
|
|
|
|
# Some BIOS don't accept slashes for paths inside the tftp servers,
|
|
|
|
# and will report Access Violation if they see slashes.
|
|
|
|
filename "pxelinux.0";
|
|
|
|
# For the TFTP and NFS root server. Set the IP of your server.
|
|
|
|
next-server 192.168.1.34;
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2011-08-15 16:37:00 +02:00
|
|
|
subnet 192.168.1.0 netmask 255.255.255.0 {
|
|
|
|
range 192.168.1.50 192.168.1.55;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2012-11-04 22:13:19 +01:00
|
|
|
readme = builtins.readFile ./system-tarball-pc-readme.txt;
|
2011-08-15 00:01:58 +02:00
|
|
|
|
2010-02-16 00:27:51 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2011-11-08 16:58:59 +01:00
|
|
|
require =
|
|
|
|
[ ./system-tarball.nix
|
|
|
|
|
|
|
|
# Profiles of this basic installation.
|
|
|
|
../../profiles/all-hardware.nix
|
|
|
|
../../profiles/base.nix
|
|
|
|
../../profiles/installation-device.nix
|
|
|
|
];
|
2010-02-16 00:27:51 +01:00
|
|
|
|
|
|
|
# To speed up further installation of packages, include the complete stdenv
|
|
|
|
# in the Nix store of the tarball.
|
2012-06-22 17:39:27 +02:00
|
|
|
tarball.storeContents = pkgs2storeContents [ pkgs.stdenv ];
|
2010-02-16 00:27:51 +01:00
|
|
|
|
2010-09-08 18:53:36 +02:00
|
|
|
tarball.contents =
|
2010-09-17 19:25:46 +02:00
|
|
|
[ { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile;
|
2010-09-16 21:24:52 +02:00
|
|
|
target = "/boot/" + config.system.boot.loader.kernelFile;
|
2010-09-08 18:53:36 +02:00
|
|
|
}
|
2011-08-15 00:01:58 +02:00
|
|
|
{ source = "${pkgs.syslinux}/share/syslinux/pxelinux.0";
|
|
|
|
target = "/boot/pxelinux.0";
|
|
|
|
}
|
|
|
|
{ source = "${pkgs.syslinux}/share/syslinux/menu.c32";
|
|
|
|
target = "/boot/menu.c32";
|
|
|
|
}
|
|
|
|
{ source = pxeconfig;
|
|
|
|
target = "/boot/pxelinux.cfg/default";
|
|
|
|
}
|
2011-08-15 16:37:00 +02:00
|
|
|
{ source = readme;
|
|
|
|
target = "/readme.txt";
|
|
|
|
}
|
|
|
|
{ source = dhcpdExampleConfig;
|
|
|
|
target = "/boot/dhcpd.conf-example";
|
|
|
|
}
|
2011-08-15 00:01:58 +02:00
|
|
|
{ source = "${pkgs.memtest86}/memtest.bin";
|
2011-08-15 16:37:00 +02:00
|
|
|
# We can't leave '.bin', because pxelinux interprets this specially,
|
|
|
|
# and it would not load the image fine.
|
|
|
|
# http://forum.canardpc.com/threads/46464-0104-when-launched-via-pxe
|
|
|
|
target = "/boot/memtest";
|
2011-08-15 00:01:58 +02:00
|
|
|
}
|
2010-09-08 18:53:36 +02:00
|
|
|
];
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-02-16 00:27:51 +01:00
|
|
|
# Allow sshd to be started manually through "start sshd". It should
|
|
|
|
# not be started by default on the installation CD because the
|
|
|
|
# default root password is empty.
|
2010-03-11 18:02:53 +01:00
|
|
|
services.openssh.enable = true;
|
2010-10-31 20:34:39 +01:00
|
|
|
jobs.openssh.startOn = pkgs.lib.mkOverrideTemplate 50 {} "";
|
2011-08-15 00:01:58 +02:00
|
|
|
|
2012-03-19 20:01:52 +01:00
|
|
|
# To be able to use the systemTarball to catch troubles.
|
|
|
|
boot.crashDump = {
|
|
|
|
enable = true;
|
2012-05-25 10:09:25 +02:00
|
|
|
kernelPackages = pkgs.linuxPackages_3_4;
|
2012-03-19 20:01:52 +01:00
|
|
|
};
|
|
|
|
|
2012-05-25 10:09:25 +02:00
|
|
|
# No grub for the tarball.
|
|
|
|
boot.loader.grub.enable = false;
|
|
|
|
|
|
|
|
/* fake entry, just to have a happy stage-1. Users
|
|
|
|
may boot without having stage-1 though */
|
|
|
|
fileSystems = [
|
|
|
|
{ mountPoint = "/";
|
|
|
|
device = "/dev/something";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2011-08-15 00:01:58 +02:00
|
|
|
nixpkgs.config = {
|
|
|
|
packageOverrides = p: rec {
|
2012-03-19 20:01:52 +01:00
|
|
|
linux_3_2 = p.linux_3_2.override {
|
2011-08-15 00:01:58 +02:00
|
|
|
extraConfig = ''
|
|
|
|
# Enable drivers in kernel for most NICs.
|
|
|
|
E1000 y
|
|
|
|
# E1000E y
|
|
|
|
# ATH5K y
|
|
|
|
8139TOO y
|
|
|
|
NE2K_PCI y
|
|
|
|
ATL1 y
|
|
|
|
ATL1E y
|
|
|
|
ATL1C y
|
2012-02-11 22:13:10 +01:00
|
|
|
VORTEX y
|
2012-03-11 17:39:49 +01:00
|
|
|
VIA_RHINE y
|
2011-08-15 00:01:58 +02:00
|
|
|
|
|
|
|
# Enable nfs root boot
|
|
|
|
IP_PNP y
|
|
|
|
IP_PNP_DHCP y
|
|
|
|
NFS_FS y
|
|
|
|
ROOT_NFS y
|
|
|
|
|
|
|
|
# Enable devtmpfs
|
|
|
|
DEVTMPFS y
|
|
|
|
DEVTMPFS_MOUNT y
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2010-02-16 00:27:51 +01:00
|
|
|
}
|