at v192 4.6 kB view raw
1# This module contains the basic configuration for building a NixOS 2# tarball for the sheevaplug. 3 4{ config, lib, pkgs, ... }: 5 6with lib; 7 8let 9 10 # A dummy /etc/nixos/configuration.nix in the booted CD that 11 # rebuilds the CD's configuration (and allows the configuration to 12 # be modified, of course, providing a true live CD). Problem is 13 # that we don't really know how the CD was built - the Nix 14 # expression language doesn't allow us to query the expression being 15 # evaluated. So we'll just hope for the best. 16 dummyConfiguration = pkgs.writeText "configuration.nix" 17 '' 18 { config, pkgs, ... }: 19 20 { 21 # Add your own options below and run "nixos-rebuild switch". 22 # E.g., 23 # services.openssh.enable = true; 24 } 25 ''; 26 27 28 pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l; 29 30 # A clue for the kernel loading 31 kernelParams = pkgs.writeText "kernel-params.txt" '' 32 Kernel Parameters: 33 init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} 34 ''; 35 36 37in 38 39{ 40 imports = [ ./system-tarball.nix ]; 41 42 # Disable some other stuff we don't need. 43 security.sudo.enable = false; 44 45 # Include only the en_US locale. This saves 75 MiB or so compared to 46 # the full glibcLocales package. 47 i18n.supportedLocales = ["en_US.UTF-8/UTF-8" "en_US/ISO-8859-1"]; 48 49 # Include some utilities that are useful for installing or repairing 50 # the system. 51 environment.systemPackages = 52 [ pkgs.subversion # for nixos-checkout 53 pkgs.w3m # needed for the manual anyway 54 pkgs.ddrescue 55 pkgs.ccrypt 56 pkgs.cryptsetup # needed for dm-crypt volumes 57 58 # Some networking tools. 59 pkgs.sshfsFuse 60 pkgs.socat 61 pkgs.screen 62 pkgs.wpa_supplicant # !!! should use the wpa module 63 64 # Hardware-related tools. 65 pkgs.sdparm 66 pkgs.hdparm 67 pkgs.dmraid 68 69 # Tools to create / manipulate filesystems. 70 pkgs.btrfsProgs 71 72 # Some compression/archiver tools. 73 pkgs.unzip 74 pkgs.zip 75 pkgs.xz 76 pkgs.dar # disk archiver 77 78 # Some editors. 79 pkgs.nvi 80 pkgs.bvi # binary editor 81 pkgs.joe 82 ]; 83 84 boot.loader.grub.enable = false; 85 boot.loader.generationsDir.enable = false; 86 system.boot.loader.kernelFile = "uImage"; 87 88 boot.initrd.availableKernelModules = 89 [ "mvsdio" "mmc_block" "reiserfs" "ext3" "ums-cypress" "rtc_mv" 90 "ext4" ]; 91 92 boot.postBootCommands = 93 '' 94 mkdir -p /mnt 95 96 cp ${dummyConfiguration} /etc/nixos/configuration.nix 97 ''; 98 99 boot.initrd.extraUtilsCommands = 100 '' 101 copy_bin_and_libs ${pkgs.utillinux}/sbin/hwclock 102 ''; 103 104 boot.initrd.postDeviceCommands = 105 '' 106 hwclock -s 107 ''; 108 109 boot.kernelParams = 110 [ 111 "selinux=0" 112 "console=tty1" 113 # "console=ttyS0,115200n8" # serial console 114 ]; 115 116 boot.kernelPackages = pkgs.linuxPackages_3_4; 117 118 boot.supportedFilesystems = [ "reiserfs" ]; 119 120 /* fake entry, just to have a happy stage-1. Users 121 may boot without having stage-1 though */ 122 fileSystems = [ 123 { mountPoint = "/"; 124 device = "/dev/something"; 125 } 126 ]; 127 128 services.mingetty = { 129 # Some more help text. 130 helpLine = '' 131 Log in as "root" with an empty password. ${ 132 if config.services.xserver.enable then 133 "Type `start xserver' to start\nthe graphical user interface." 134 else "" 135 } 136 ''; 137 }; 138 139 # Setting vesa, we don't get the nvidia driver, which can't work in arm. 140 services.xserver.videoDrivers = [ "vesa" ]; 141 142 services.nixosManual.enable = false; 143 144 # Include the firmware for various wireless cards. 145 networking.enableRalinkFirmware = true; 146 networking.enableIntel2200BGFirmware = true; 147 148 # To speed up further installation of packages, include the complete stdenv 149 # in the Nix store of the tarball. 150 tarball.storeContents = pkgs2storeContents [ pkgs.stdenv ]; 151 tarball.contents = [ 152 { source = kernelParams; 153 target = "/kernelparams.txt"; 154 } 155 { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile; 156 target = "/boot/" + config.system.boot.loader.kernelFile; 157 } 158 { source = pkgs.ubootSheevaplug; 159 target = "/boot/uboot"; 160 } 161 ]; 162 163 # Allow sshd to be started manually through "start sshd". It should 164 # not be started by default on the installation CD because the 165 # default root password is empty. 166 services.openssh.enable = true; 167 jobs.openssh.startOn = lib.mkOverride 50 ""; 168 169 # cpufrequtils fails to build on non-pc 170 powerManagement.enable = false; 171 172 nixpkgs.config = { 173 platform = pkgs.platforms.sheevaplug; 174 }; 175}