2010-02-15 23:27:51 +00:00
|
|
|
# This module contains the basic configuration for building a NixOS
|
2012-05-25 09:09:25 +01:00
|
|
|
# tarball, that can directly boot, maybe using PXE or unpacking on a fs.
|
2010-02-15 23:27:51 +00:00
|
|
|
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l;
|
|
|
|
|
2011-08-14 23:01:58 +01: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 15:37:00 +01:00
|
|
|
MENU LABEL ^NixOS using nfsroot
|
2011-08-14 23:01:58 +01:00
|
|
|
KERNEL bzImage
|
2013-05-11 20:08:27 +01:00
|
|
|
append ip=dhcp nfsroot=/home/pcroot systemConfig=${config.system.build.toplevel} init=${config.system.build.toplevel}/init rw
|
2011-08-15 15:37:00 +01:00
|
|
|
|
|
|
|
# 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
|
2013-05-11 20:08:27 +01:00
|
|
|
append initrd=initrd ip=dhcp nfsroot=/home/pcroot systemConfig=${config.system.build.toplevel} init=${config.system.build.toplevel}/init rw
|
2011-08-14 23:01:58 +01:00
|
|
|
|
|
|
|
label memtest
|
2012-04-09 21:37:54 +01:00
|
|
|
MENU LABEL ^${pkgs.memtest86.name}
|
2011-08-15 15:37:00 +01:00
|
|
|
KERNEL memtest
|
|
|
|
'';
|
|
|
|
|
|
|
|
dhcpdExampleConfig = pkgs.writeText "dhcpd.conf-example" ''
|
|
|
|
# Example configuration for booting PXE.
|
|
|
|
allow booting;
|
|
|
|
allow bootp;
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2011-08-15 15:37:00 +01: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 19:20:50 +01:00
|
|
|
|
2011-08-15 15:37:00 +01: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 19:20:50 +01:00
|
|
|
|
2011-08-15 15:37:00 +01:00
|
|
|
subnet 192.168.1.0 netmask 255.255.255.0 {
|
|
|
|
range 192.168.1.50 192.168.1.55;
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2012-11-29 10:29:15 +00:00
|
|
|
readme = ./system-tarball-pc-readme.txt;
|
2011-08-14 23:01:58 +01:00
|
|
|
|
2010-02-15 23:27:51 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2013-09-04 12:05:09 +01:00
|
|
|
imports =
|
2011-11-08 15:58:59 +00:00
|
|
|
[ ./system-tarball.nix
|
|
|
|
|
|
|
|
# Profiles of this basic installation.
|
|
|
|
../../profiles/all-hardware.nix
|
|
|
|
../../profiles/base.nix
|
|
|
|
../../profiles/installation-device.nix
|
|
|
|
];
|
2010-02-15 23:27:51 +00:00
|
|
|
|
|
|
|
# To speed up further installation of packages, include the complete stdenv
|
|
|
|
# in the Nix store of the tarball.
|
2012-06-22 16:39:27 +01:00
|
|
|
tarball.storeContents = pkgs2storeContents [ pkgs.stdenv ];
|
2010-02-15 23:27:51 +00:00
|
|
|
|
2010-09-08 17:53:36 +01:00
|
|
|
tarball.contents =
|
2010-09-17 18:25:46 +01:00
|
|
|
[ { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile;
|
2010-09-16 20:24:52 +01:00
|
|
|
target = "/boot/" + config.system.boot.loader.kernelFile;
|
2010-09-08 17:53:36 +01:00
|
|
|
}
|
2011-08-14 23:01:58 +01: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 15:37:00 +01:00
|
|
|
{ source = readme;
|
|
|
|
target = "/readme.txt";
|
|
|
|
}
|
|
|
|
{ source = dhcpdExampleConfig;
|
|
|
|
target = "/boot/dhcpd.conf-example";
|
|
|
|
}
|
2011-08-14 23:01:58 +01:00
|
|
|
{ source = "${pkgs.memtest86}/memtest.bin";
|
2011-08-15 15:37:00 +01: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-14 23:01:58 +01:00
|
|
|
}
|
2010-09-08 17:53:36 +01:00
|
|
|
];
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2010-02-15 23:27:51 +00: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 17:02:53 +00:00
|
|
|
services.openssh.enable = true;
|
2013-10-29 00:15:17 +00:00
|
|
|
jobs.openssh.startOn = pkgs.lib.mkOverride 50 "";
|
2011-08-14 23:01:58 +01:00
|
|
|
|
2012-03-19 19:01:52 +00:00
|
|
|
# To be able to use the systemTarball to catch troubles.
|
|
|
|
boot.crashDump = {
|
|
|
|
enable = true;
|
2012-05-25 09:09:25 +01:00
|
|
|
kernelPackages = pkgs.linuxPackages_3_4;
|
2012-03-19 19:01:52 +00:00
|
|
|
};
|
|
|
|
|
2012-05-25 09:09:25 +01: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-14 23:01:58 +01:00
|
|
|
nixpkgs.config = {
|
|
|
|
packageOverrides = p: rec {
|
2013-05-11 20:08:27 +01:00
|
|
|
linux_3_4 = p.linux_3_4.override {
|
2011-08-14 23:01:58 +01: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 21:13:10 +00:00
|
|
|
VORTEX y
|
2012-03-11 16:39:49 +00:00
|
|
|
VIA_RHINE y
|
2013-05-11 20:08:27 +01:00
|
|
|
R8169 y
|
2011-08-14 23:01:58 +01:00
|
|
|
|
|
|
|
# Enable nfs root boot
|
2013-05-11 20:08:27 +01:00
|
|
|
UNIX y # http://www.linux-mips.org/archives/linux-mips/2006-11/msg00113.html
|
2011-08-14 23:01:58 +01:00
|
|
|
IP_PNP y
|
|
|
|
IP_PNP_DHCP y
|
2013-05-11 20:08:27 +01:00
|
|
|
FSCACHE y
|
2011-08-14 23:01:58 +01:00
|
|
|
NFS_FS y
|
2013-05-11 20:08:27 +01:00
|
|
|
NFS_FSCACHE y
|
2011-08-14 23:01:58 +01:00
|
|
|
ROOT_NFS y
|
|
|
|
|
|
|
|
# Enable devtmpfs
|
|
|
|
DEVTMPFS y
|
|
|
|
DEVTMPFS_MOUNT y
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2010-02-15 23:27:51 +00:00
|
|
|
}
|