at 17.09-beta 4.4 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 # A dummy /etc/nixos/configuration.nix in the booted CD that 8 # rebuilds the CD's configuration (and allows the configuration to 9 # be modified, of course, providing a true live CD). Problem is 10 # that we don't really know how the CD was built - the Nix 11 # expression language doesn't allow us to query the expression being 12 # evaluated. So we'll just hope for the best. 13 dummyConfiguration = pkgs.writeText "configuration.nix" 14 '' 15 { config, pkgs, ... }: 16 17 { # Add your own options below, e.g.: 18 # services.openssh.enable = true; 19 nixpkgs.config.platform = pkgs.platforms.fuloong2f_n32; 20 } 21 ''; 22 23 24 pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l; 25 26 # A clue for the kernel loading 27 kernelParams = pkgs.writeText "kernel-params.txt" '' 28 Kernel Parameters: 29 init=/boot/init systemConfig=/boot/init ${toString config.boot.kernelParams} 30 ''; 31 32 # System wide nixpkgs config 33 nixpkgsUserConfig = pkgs.writeText "config.nix" '' 34 pkgs: 35 { 36 platform = pkgs.platforms.fuloong2f_n32; 37 } 38 ''; 39 40in 41 42{ 43 imports = [ ./system-tarball.nix ]; 44 45 # Disable some other stuff we don't need. 46 security.sudo.enable = false; 47 48 # Include only the en_US locale. This saves 75 MiB or so compared to 49 # the full glibcLocales package. 50 i18n.supportedLocales = ["en_US.UTF-8/UTF-8" "en_US/ISO-8859-1"]; 51 52 # Include some utilities that are useful for installing or repairing 53 # the system. 54 environment.systemPackages = 55 [ pkgs.w3m # needed for the manual anyway 56 pkgs.testdisk # useful for repairing boot problems 57 pkgs.mssys # for writing Microsoft boot sectors / MBRs 58 pkgs.parted 59 pkgs.ddrescue 60 pkgs.ccrypt 61 pkgs.cryptsetup # needed for dm-crypt volumes 62 63 # Some networking tools. 64 pkgs.sshfs-fuse 65 pkgs.socat 66 pkgs.screen 67 pkgs.wpa_supplicant # !!! should use the wpa module 68 69 # Hardware-related tools. 70 pkgs.sdparm 71 pkgs.hdparm 72 pkgs.dmraid 73 74 # Tools to create / manipulate filesystems. 75 pkgs.ntfsprogs # for resizing NTFS partitions 76 pkgs.btrfs-progs 77 pkgs.jfsutils 78 79 # Some compression/archiver tools. 80 pkgs.unzip 81 pkgs.zip 82 pkgs.xz 83 pkgs.dar # disk archiver 84 85 # Some editors. 86 pkgs.nvi 87 pkgs.bvi # binary editor 88 pkgs.joe 89 ]; 90 91 # The initrd has to contain any module that might be necessary for 92 # mounting the CD/DVD. 93 boot.initrd.availableKernelModules = 94 [ "vfat" "reiserfs" ]; 95 96 boot.kernelPackages = pkgs.linuxPackages_3_10; 97 boot.kernelParams = [ "console=tty1" ]; 98 99 boot.postBootCommands = 100 '' 101 mkdir -p /mnt 102 103 cp ${dummyConfiguration} /etc/nixos/configuration.nix 104 ''; 105 106 # Some more help text. 107 services.mingetty.helpLine = 108 '' 109 110 Log in as "root" with an empty password. ${ 111 if config.services.xserver.enable then 112 "Type `start xserver' to start\nthe graphical user interface." 113 else "" 114 } 115 ''; 116 117 # Include the firmware for various wireless cards. 118 networking.enableRalinkFirmware = true; 119 networking.enableIntel2200BGFirmware = true; 120 121 # To speed up further installation of packages, include the complete stdenv 122 # in the Nix store of the tarball. 123 tarball.storeContents = pkgs2storeContents [ pkgs.stdenv ] 124 ++ [ 125 { 126 object = config.system.build.bootStage2; 127 symlink = "/boot/init"; 128 } 129 { 130 object = config.system.build.toplevel; 131 symlink = "/boot/system"; 132 } 133 ]; 134 135 tarball.contents = [ 136 { source = kernelParams; 137 target = "/kernelparams.txt"; 138 } 139 { source = config.boot.kernelPackages.kernel + "/" + config.system.boot.loader.kernelFile; 140 target = "/boot/" + config.system.boot.loader.kernelFile; 141 } 142 { source = nixpkgsUserConfig; 143 target = "/root/.nixpkgs/config.nix"; 144 } 145 ]; 146 147 # Allow sshd to be started manually through "start sshd". It should 148 # not be started by default on the installation CD because the 149 # default root password is empty. 150 services.openssh.enable = true; 151 systemd.services.openssh.wantedBy = lib.mkOverride 50 []; 152 153 boot.loader.grub.enable = false; 154 boot.loader.generationsDir.enable = false; 155 system.boot.loader.kernelFile = "vmlinux"; 156 157 nixpkgs.config = { 158 platform = pkgs.platforms.fuloong2f_n32; 159 }; 160}