diff --git a/boot/boot-stage-2-init.sh b/boot/boot-stage-2-init.sh index f6b74543d8f..9aa2aec7d9f 100644 --- a/boot/boot-stage-2-init.sh +++ b/boot/boot-stage-2-init.sh @@ -80,7 +80,9 @@ needWritableDir /var 0755 needWritableDir /nix/var 0755 needWritableDir /root 0700 needWritableDir /bin 0755 # for the /bin/sh symlink - +if test -d /home ; then + needWritableDir /home 0777 +fi # Miscellaneous boot time cleanup. rm -rf /var/run diff --git a/configuration/live-dvd-X-no-soft.nix b/configuration/live-dvd-X-no-soft.nix new file mode 100644 index 00000000000..d9dad878fc1 --- /dev/null +++ b/configuration/live-dvd-X-no-soft.nix @@ -0,0 +1,122 @@ +{platform ? __currentSystem} : +let + isoFun = import ./rescue-cd-configurable.nix; + xResolutions = [ + { x = 2048; y = 1536; } + { x = 1920; y = 1024; } + { x = 1280; y = 800; } + { x = 1024; y = 768; } + { x = 800; y = 600; } + { x = 640; y = 480; } + ]; + xConfiguration = { + enable = true; + exportConfiguration = true; + tcpEnable = true; + resolutions = xResolutions; + sessionType = "xterm"; + windowManager = "twm"; + tty = "9"; + }; + + theKernel = pkgs: let baseKernel=pkgs.kernel; + in (pkgs.module_aggregation + [ + baseKernel + (pkgs.kqemuFunCurrent baseKernel) + (pkgs.atherosFun { + kernel = baseKernel; + version = "r2756"; + pci001c_rev01 = true; + } null) + ]); + + +in +(isoFun { + inherit platform; + lib = (import ../pkgs/lib); + + networkNixpkgs = ""; + manualEnabled = true; + rogueEnabled = true; + sshdEnabled = true; + fontConfigEnabled = true; + sudoEnable = true; + includeMemtest = true; + includeStdenv = true; + includeBuildDeps = true; + addUsers = ["nixos" "livecd" "livedvd" + "user" "guest" "nix"]; + + kernel = pkgs: ( + pkgs.module_aggregation + [pkgs.kernel] + ); + + packages = pkgs : [ + pkgs.which + pkgs.file + pkgs.zip + pkgs.unzip + pkgs.unrar + pkgs.db4 + pkgs.attr + pkgs.acl + pkgs.manpages + pkgs.cabextract + pkgs.upstartJobControl + pkgs.utillinuxCurses + pkgs.emacs + pkgs.lsof + pkgs.vimHugeX + pkgs.firefoxWrapper + pkgs.xlaunch + pkgs.ratpoison + pkgs.xorg.twm + pkgs.xorg.xorgserver + pkgs.xorg.xhost + pkgs.xorg.xfontsel + pkgs.xlaunch + pkgs.xorg.xauth + pkgs.xorg.xset + pkgs.xterm + pkgs.xorg.xev + pkgs.xorg.xmodmap + pkgs.xorg.xkbcomp + pkgs.xorg.setxkbmap + ]; + + configList = configuration : [ + { + suffix = "X-vesa"; + configuration = (configuration // + { + boot=configuration.boot // {configurationName = "X with vesa";}; + services = configuration.services // { + xserver = xConfiguration // {videoDriver = "vesa";}; + }; + }); + } + { + suffix = "X-Intel"; + configuration = (configuration // + { + boot=configuration.boot // {configurationName = "X with Intel graphic card";}; + services = configuration.services // { + xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;}; + }; + }); + } + { + suffix = "X-ATI"; + configuration = (configuration // + { + boot=configuration.boot // {configurationName = "X with ATI graphic card";}; + services = configuration.services // { + xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;}; + }; + }); + } + ]; +}).rescueCD diff --git a/configuration/live-dvd-X.nix b/configuration/live-dvd-X.nix index df644a522ca..d6de3842401 100644 --- a/configuration/live-dvd-X.nix +++ b/configuration/live-dvd-X.nix @@ -1,6 +1,37 @@ {platform ? __currentSystem} : let isoFun = import ./rescue-cd-configurable.nix; + xResolutions = [ + { x = 2048; y = 1536; } + { x = 1920; y = 1024; } + { x = 1280; y = 800; } + { x = 1024; y = 768; } + { x = 800; y = 600; } + { x = 640; y = 480; } + ]; + xConfiguration = { + enable = true; + exportConfiguration = true; + tcpEnable = true; + resolutions = xResolutions; + sessionType = "xterm"; + windowManager = "twm"; + tty = "9"; + }; + + theKernel = pkgs: let baseKernel=pkgs.kernel; + in (pkgs.module_aggregation + [ + baseKernel + (pkgs.kqemuFunCurrent baseKernel) + (pkgs.atherosFun { + kernel = baseKernel; + version = "r2756"; + pci001c_rev01 = true; + } null) + ]); + + in (isoFun { inherit platform; @@ -15,6 +46,8 @@ in includeMemtest = true; includeStdenv = true; includeBuildDeps = true; + addUsers = ["nixos" "livecd" "livedvd" + "user" "guest" "nix"]; kernel = pkgs: ( pkgs.module_aggregation @@ -23,7 +56,6 @@ in packages = pkgs : [ pkgs.irssi - pkgs.elinks pkgs.ltrace pkgs.subversion pkgs.which @@ -73,5 +105,109 @@ in pkgs.pciutils pkgs.lsof pkgs.vimHugeX + pkgs.xpdf + pkgs.ghostscript + pkgs.gv + pkgs.firefoxWrapper + pkgs.xlaunch + pkgs.wirelesstools + pkgs.usbutils + pkgs.dmidecode + pkgs.sdparm + pkgs.hdparm + pkgs.hddtemp + (theKernel pkgs) + pkgs.sshfsFuse + pkgs.ratpoison + pkgs.xorg.twm + pkgs.binutils + pkgs.xorg.lndir + pkgs.pstree + pkgs.psmisc + pkgs.aspell + pkgs.gettext + pkgs.xorg.xorgserver + pkgs.xorg.xsetroot + pkgs.xorg.xhost + pkgs.xorg.xwd + pkgs.xorg.xfontsel + pkgs.xorg.xwud + pkgs.xlaunch + pkgs.xsel + pkgs.xorg.xmessage + pkgs.xorg.xauth + pkgs.keynav + pkgs.xorg.xset + pkgs.xterm + pkgs.xmove + pkgs.xorg.xev + pkgs.xorg.xmodmap + pkgs.xorg.xkbcomp + pkgs.xorg.setxkbmap + + /* + pkgs.elinks + pkgs.clisp + pkgs.djvulibre + pkgs.imagemagick + */ + + /* + pkgs.pidgin + pkgs.pidginotr + pkgs.gdmap + pkgs.sox + pkgs.timidity + pkgs.xscreensaver + pkgs.thunderbird + pkgs.graphviz + pkgs.tetex + pkgs.pidginlatex + pkgs.openoffice + pkgs.wv + pkgs.maxima + pkgs.jre + pkgs.wine + pkgs.qemu + pkgs.qemuImage + pkgs.wireshark + pkgs.gimp + pkgs.audacity + pkgs.tightvnc + pkgs.bittornado + */ + ]; + + configList = configuration : [ + { + suffix = "X-vesa"; + configuration = (configuration // + { + boot=configuration.boot // {configurationName = "X with vesa";}; + services = configuration.services // { + xserver = xConfiguration // {videoDriver = "vesa";}; + }; + }); + } + { + suffix = "X-Intel"; + configuration = (configuration // + { + boot=configuration.boot // {configurationName = "X with Intel graphic card";}; + services = configuration.services // { + xserver = xConfiguration // {videoDriver = "intel"; driSupport = true;}; + }; + }); + } + { + suffix = "X-ATI"; + configuration = (configuration // + { + boot=configuration.boot // {configurationName = "X with ATI graphic card";}; + services = configuration.services // { + xserver = xConfiguration // {videoDriver = "ati"; driSupport = true;}; + }; + }); + } ]; }).rescueCD diff --git a/configuration/rescue-cd-configurable.nix b/configuration/rescue-cd-configurable.nix index 753a1b2ccbc..987185cc85a 100644 --- a/configuration/rescue-cd-configurable.nix +++ b/configuration/rescue-cd-configurable.nix @@ -23,6 +23,72 @@ let includeStdenv = arg "includeStdenv" true; includeBuildDeps = arg "includeBuildDeps" false; kernel = arg "kernel" (pkgs : pkgs.kernel); + addUsers = arg "addUsers" []; + + /* Should return list of {configuration, suffix} attrsets. + {configuration=configuration; suffix=""} is always prepended. + */ + configList = arg "configList" (configuration : []); +in +let + + systemPackBuilder = {suffix, configuration} : { + system = (import ../system/system.nix) { + inherit configuration platform; /* To refactor later - x86+x86_64 DVD */ + stage2Init = "/init"+suffix; + }; + inherit suffix configuration; + }; + + systemPackGrubEntry = systemPack : ('' + + title NixOS Installer / Rescue ${systemPack.system.config.boot.configurationName} + kernel /boot/vmlinuz${systemPack.suffix} ${toString systemPack.system.config.boot.kernelParams} systemConfig=/system${systemPack.suffix} + initrd /boot/initrd${systemPack.suffix} + + ''); + + systemPackInstallRootList = systemPack : [ + { source = systemPack.system.kernel + "/vmlinuz"; + target = "boot/vmlinuz${systemPack.suffix}"; + } + { source = systemPack.system.initialRamdisk + "/initrd"; + target = "boot/initrd${systemPack.suffix}"; + } + ]; + systemPackInstallClosures = systemPack : ([ + { object = systemPack.system.bootStage2; + symlink = "/init${systemPack.suffix}"; + } + { object = systemPack.system.system; + symlink = "/system${systemPack.suffix}"; + } + ] + ++ + (lib.optional includeStdenv + # To speed up the installation, provide the full stdenv. + { object = systemPack.system.pkgs.stdenv; + symlink = "none"; + } + ) + ); + systemPackInstallBuildClosure = systemPack : ([ + { + object = systemPack.system.system.drvPath; + symlink = "none"; + } + ]); + + + userEntry = user : { + name = user; + description = "NixOS Live Disk non-root user"; + home = "/home/${user}"; + createHome = true; + group = "users"; + extraGroups = ["wheel" "audio"]; + shell = "/bin/sh"; + }; in rec { @@ -95,6 +161,22 @@ rec { respawn ${pkgs.rogue}/bin/rogue < /dev/tty8 > /dev/tty8 2>&1 "; }) + + ++ + + (lib.optional (addUsers != []) + # Set empty passwords + { + name = "clear-passwords"; + job = '' + start on startup + script + for i in ${lib.concatStringsSep " " addUsers}; do + echo | ${pkgs.pwdutils}/bin/passwd --stdin $i + done + end script + ''; + }) ; # And a background to go with that. @@ -124,7 +206,11 @@ rec { helpLine = '' Log in as "root" with an empty password. - ''+(if manualEnabled then " Press for help." else ""); + '' + +(if addUsers != [] then '' These users also have empty passwords: + ${lib.concatStringsSep " " addUsers } + '' else "") + +(if manualEnabled then " Press for help." else ""); }; }; @@ -152,17 +238,21 @@ rec { pkgs.w3m # needed for the manual anyway ] ++ (packages pkgs); }; - + + users = { + extraUsers = map userEntry addUsers; + }; + }; + configurations = [{ + inherit configuration; + suffix = ""; + }] ++ (configList configuration); + systemPacks = map systemPackBuilder configurations; - system = import ../system/system.nix { - inherit configuration platform; - stage2Init = "/init"; - }; - - - pkgs = system.pkgs; + system = (builtins.head systemPacks).system; /* I hope this is unneeded */ + pkgs = system.pkgs; /* Nothing non-fixed should be built from it */ # The NixOS manual, with a backward compatibility hack for Nix <= @@ -177,7 +267,7 @@ rec { cdMountPoints = pkgs.runCommand "mount-points" {} " ensureDir $out cd $out - mkdir proc sys tmp etc dev var mnt nix nix/var root bin + mkdir proc sys tmp etc dev var mnt nix nix/var root bin ${if addUsers != "" then "home" else ""} touch $out/${configuration.boot.rootLabel} "; @@ -192,7 +282,7 @@ rec { --exclude 'pkgs' --exclude 'result') "; - makeNixPkgsTarball = tarName: input: ((pkgs.runCommand "tarball" {inherit tarName;} " + makeNixPkgsTarball = tarName: input: ((pkgs.runCommand "tarball-nixpkgs" {inherit tarName;} " ensureDir $out (cd ${input}/.. && tar cvfj $out/${tarName} nixpkgs \\ --exclude '*~' \\ @@ -223,11 +313,8 @@ rec { default 0 timeout 10 splashimage /boot/background.xpm.gz - - title NixOS Installer / Rescue - kernel /boot/vmlinuz ${toString system.config.boot.kernelParams} - initrd /boot/initrd - '' + ''+ + (lib.concatStrings (map systemPackGrubEntry systemPacks)) + (if includeMemtest then '' @@ -243,20 +330,18 @@ rec { isoName = "nixos-${platform}.iso"; # Single files to be copied to fixed locations on the CD. - contents = [ + contents = lib.uniqList {inputList = + [ { source = "${pkgs.grub}/lib/grub/i386-pc/stage2_eltorito"; target = "boot/grub/stage2_eltorito"; } { source = grubCfg; target = "boot/grub/menu.lst"; - } - { source = pkgs.kernel + "/vmlinuz"; - target = "boot/vmlinuz"; - } - { source = system.initialRamdisk + "/initrd"; - target = "boot/initrd"; - } - { source = system.config.boot.grubSplashImage; + }] + ++ + (lib.concatLists (map systemPackInstallRootList systemPacks)) + ++ + [{ source = system.config.boot.grubSplashImage; target = "boot/background.xpm.gz"; } { source = cdMountPoints; @@ -275,34 +360,22 @@ rec { target = "boot/memtest.bin"; } ) - ; + ;}; # Closures to be copied to the Nix store on the CD. - storeContents = [ - { object = system.bootStage2; - symlink = "/init"; - } - { object = system.system; - symlink = "/system"; - } - ] - ++ - (lib.optional includeStdenv - # To speed up the installation, provide the full stdenv. - { object = pkgs.stdenv; - symlink = "none"; - } - ) - ; + storeContents = lib.uniqListExt { + inputList= lib.concatLists + (map systemPackInstallClosures systemPacks); + getter = x : x.object.drvPath; + compare = lib.eqStrings; + }; - buildStoreContents = [] + buildStoreContents = lib.uniqList {inputList=([] ++ - (lib.optional includeBuildDeps - { - object = system.system.drvPath; - symlink = "none"; - } - ); + (if includeBuildDeps then lib.concatLists + (map systemPackInstallBuildClosure systemPacks) + else []) + );}; bootable = true; bootImage = "boot/grub/stage2_eltorito"; diff --git a/helpers/make-iso9660-image.sh b/helpers/make-iso9660-image.sh index 5506161b051..d9bd6752d18 100644 --- a/helpers/make-iso9660-image.sh +++ b/helpers/make-iso9660-image.sh @@ -6,7 +6,6 @@ targets_=($targets) objects=($objects) symlinks=($symlinks) - if test -n "$bootable"; then # The -boot-info-table option modifies the $bootImage file, so @@ -55,7 +54,6 @@ for ((n = 0; n < ${#objects[*]}; n++)); do fi done - # !!! -f is a quick hack. ensureDir $out/iso genisoimage -r -J -o $out/iso/$isoName $bootFlags \ diff --git a/system/options.nix b/system/options.nix index ad98359ab14..8511e65a066 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1685,6 +1685,7 @@ root ALL=(ALL) SETENV: ALL createHome = true; group = "users"; extraGroups = ["wheel"]; + shell = "/bin/sh"; } ]; description = " diff --git a/system/users-groups.nix b/system/users-groups.nix index 9235fe11c18..19a8ff9c972 100644 --- a/system/users-groups.nix +++ b/system/users-groups.nix @@ -82,7 +82,7 @@ rec { # Awful hackery necessary to pass the users/groups to the activation script. createUsersGroups = ../helpers/create-users-groups.sh; - usersList = pkgs.writeText "users" (pkgs.lib.concatStrings (map (u: "${u.name}\n${u.description}\n${toString u.uid}\n${u.group}\n${toString u.extraGroups}\n${u.home}\n${u.shell}\n${toString u.createHome}\n") users)); + usersList = pkgs.writeText "users" (pkgs.lib.concatStrings (map (u: "${u.name}\n${u.description}\n${toString u.uid}\n${u.group}\n${toString (pkgs.lib.concatStringsSep "," u.extraGroups)}\n${u.home}\n${u.shell}\n${toString u.createHome}\n") users)); groupsList = pkgs.writeText "groups" (pkgs.lib.concatStrings (map (g: "${g.name}\n${toString g.gid}\n") groups)); } diff --git a/upstart-jobs/ircd-hybrid.nix b/upstart-jobs/ircd-hybrid.nix index 77639d95042..ce2d5ba7fca 100644 --- a/upstart-jobs/ircd-hybrid.nix +++ b/upstart-jobs/ircd-hybrid.nix @@ -13,7 +13,8 @@ let adminEmail = cfg.adminEmail; extraIPs = cfg.extraIPs; extraPort = cfg.extraPort; - gw6cEnabled = config.services.gw6c.enable; + gw6cEnabled = (config.services.gw6c.enable) && + (config.services.gw6c.autorun); }; startingDependency = if config.services.gw6c.enable then "gw6c" else "network-interfaces";