at 17.09-beta 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.w3m # needed for the manual anyway 53 pkgs.ddrescue 54 pkgs.ccrypt 55 pkgs.cryptsetup # needed for dm-crypt volumes 56 57 # Some networking tools. 58 pkgs.sshfs-fuse 59 pkgs.socat 60 pkgs.screen 61 pkgs.wpa_supplicant # !!! should use the wpa module 62 63 # Hardware-related tools. 64 pkgs.sdparm 65 pkgs.hdparm 66 pkgs.dmraid 67 68 # Tools to create / manipulate filesystems. 69 pkgs.btrfs-progs 70 71 # Some compression/archiver tools. 72 pkgs.unzip 73 pkgs.zip 74 pkgs.xz 75 pkgs.dar # disk archiver 76 77 # Some editors. 78 pkgs.nvi 79 pkgs.bvi # binary editor 80 pkgs.joe 81 ]; 82 83 boot.loader.grub.enable = false; 84 boot.loader.generationsDir.enable = false; 85 system.boot.loader.kernelFile = "uImage"; 86 87 boot.initrd.availableKernelModules = 88 [ "mvsdio" "reiserfs" "ext3" "ums-cypress" "rtc_mv" "ext4" ]; 89 90 boot.postBootCommands = 91 '' 92 mkdir -p /mnt 93 94 cp ${dummyConfiguration} /etc/nixos/configuration.nix 95 ''; 96 97 boot.initrd.extraUtilsCommands = 98 '' 99 copy_bin_and_libs ${pkgs.utillinux}/sbin/hwclock 100 ''; 101 102 boot.initrd.postDeviceCommands = 103 '' 104 hwclock -s 105 ''; 106 107 boot.kernelParams = 108 [ 109 "selinux=0" 110 "console=tty1" 111 # "console=ttyS0,115200n8" # serial console 112 ]; 113 114 boot.kernelPackages = pkgs.linuxPackages_3_4; 115 116 boot.supportedFilesystems = [ "reiserfs" ]; 117 118 /* fake entry, just to have a happy stage-1. Users 119 may boot without having stage-1 though */ 120 fileSystems = [ 121 { mountPoint = "/"; 122 device = "/dev/something"; 123 } 124 ]; 125 126 services.mingetty = { 127 # Some more help text. 128 helpLine = '' 129 Log in as "root" with an empty password. ${ 130 if config.services.xserver.enable then 131 "Type `start xserver' to start\nthe graphical user interface." 132 else "" 133 } 134 ''; 135 }; 136 137 # Setting vesa, we don't get the nvidia driver, which can't work in arm. 138 services.xserver.videoDrivers = [ "vesa" ]; 139 140 services.nixosManual.enable = false; 141 142 # Include the firmware for various wireless cards. 143 networking.enableRalinkFirmware = true; 144 networking.enableIntel2200BGFirmware = true; 145 146 # To speed up further installation of packages, include the complete stdenv 147 # in the Nix store of the tarball. 148 tarball.storeContents = pkgs2storeContents [ pkgs.stdenv ]; 149 tarball.contents = [ 150 { source = kernelParams; 151 target = "/kernelparams.txt"; 152 } 153 { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile; 154 target = "/boot/" + config.system.boot.loader.kernelFile; 155 } 156 { source = pkgs.ubootSheevaplug; 157 target = "/boot/uboot"; 158 } 159 ]; 160 161 # Allow sshd to be started manually through "start sshd". It should 162 # not be started by default on the installation CD because the 163 # default root password is empty. 164 services.openssh.enable = true; 165 systemd.services.openssh.wantedBy = lib.mkOverride 50 []; 166 167 # cpufrequtils fails to build on non-pc 168 powerManagement.enable = false; 169 170 nixpkgs.config = { 171 platform = pkgs.platforms.sheevaplug; 172 }; 173}