From 14483c0bf9326fda1c592da53b3df43081d3f159 Mon Sep 17 00:00:00 2001 From: Florian Friesdorf Date: Fri, 14 Dec 2012 18:24:41 +0100 Subject: [PATCH 1/5] update nixos channel path --- doc/manual/installation.xml | 2 +- maintainers/scripts/ec2/create-ebs-amis.py | 2 +- modules/installer/cd-dvd/system-tarball-pc-readme.txt | 2 +- modules/programs/bash/profile.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/manual/installation.xml b/doc/manual/installation.xml index 0a69ce0ecba8..6f19cc1a0b89 100644 --- a/doc/manual/installation.xml +++ b/doc/manual/installation.xml @@ -326,7 +326,7 @@ packages. some reason this is not the case, just do -$ nix-channel --add http://nixos.org/releases/nixos/channels/nixos-unstable +$ nix-channel --add http://nixos.org/channels/nixos-unstable You can then upgrade NixOS to the latest version in the channel by diff --git a/maintainers/scripts/ec2/create-ebs-amis.py b/maintainers/scripts/ec2/create-ebs-amis.py index 939bd30942dc..4dfaa9f3b129 100755 --- a/maintainers/scripts/ec2/create-ebs-amis.py +++ b/maintainers/scripts/ec2/create-ebs-amis.py @@ -52,7 +52,7 @@ m.run_command("mkdir -p /mnt") m.run_command("mount {0} /mnt".format(device)) m.run_command("touch /mnt/.ebs") m.run_command("mkdir -p /mnt/etc/nixos") -m.run_command("nix-channel --add http://nixos.org/releases/nixos/channels/nixos-unstable") +m.run_command("nix-channel --add http://nixos.org/channels/nixos-unstable") m.run_command("nix-channel --update") m.run_command("nixos-rebuild switch") version = m.run_command("nixos-version", capture_stdout=True).replace('"', '').rstrip() diff --git a/modules/installer/cd-dvd/system-tarball-pc-readme.txt b/modules/installer/cd-dvd/system-tarball-pc-readme.txt index c4a0a111cd3a..8f0a8d355c6e 100644 --- a/modules/installer/cd-dvd/system-tarball-pc-readme.txt +++ b/modules/installer/cd-dvd/system-tarball-pc-readme.txt @@ -80,7 +80,7 @@ had booted this nixos. Run: * `grep local-cmds run/current-system/init` Then you can proceed normally subscribing to a nixos channel: - nix-channel --add http://nixos.org/releases/nixos/channels/nixos-unstable + nix-channel --add http://nixos.org/channels/nixos-unstable nix-channel --update Testing: diff --git a/modules/programs/bash/profile.sh b/modules/programs/bash/profile.sh index 1eef2a9e84a8..5393a88d5ffe 100644 --- a/modules/programs/bash/profile.sh +++ b/modules/programs/bash/profile.sh @@ -87,7 +87,7 @@ fi # Subscribe the root user to the NixOS channel by default. if [ "$USER" = root -a ! -e $HOME/.nix-channels ]; then - echo "http://nixos.org/releases/nixos/channels/nixos-unstable nixos" > $HOME/.nix-channels + echo "http://nixos.org/channels/nixos-unstable nixos" > $HOME/.nix-channels fi # Create the per-user garbage collector roots directory. From cba4d20280d286cdcd8d07bb9b721978d2c6f883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sun, 16 Dec 2012 16:03:38 +0100 Subject: [PATCH 2/5] Setting the system utillinux to be utillinuxCurses. The live-dvd was set that way already. I think some utillinux pieces may be nicer, or have more tools. I don't know the details though. --- modules/config/system-path.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config/system-path.nix b/modules/config/system-path.nix index 38e5f076bcfd..85b16d50406e 100644 --- a/modules/config/system-path.nix +++ b/modules/config/system-path.nix @@ -55,7 +55,7 @@ let pkgs.time pkgs.udev pkgs.usbutils - pkgs.utillinux + pkgs.utillinuxCurses extraManpages ]; From dacd7d5a580dea6f865bea6855eac7c83244c71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sun, 16 Dec 2012 16:05:50 +0100 Subject: [PATCH 3/5] Setting iso_new_kernel to use linux 3.7. It was using 3.2, the same kernel as the other isos. --- modules/installer/cd-dvd/installation-cd-new-kernel.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/installer/cd-dvd/installation-cd-new-kernel.nix b/modules/installer/cd-dvd/installation-cd-new-kernel.nix index c7ea5ddfb01b..2c79b68d0a43 100644 --- a/modules/installer/cd-dvd/installation-cd-new-kernel.nix +++ b/modules/installer/cd-dvd/installation-cd-new-kernel.nix @@ -3,6 +3,6 @@ { require = [ ./installation-cd-graphical.nix ]; - boot.kernelPackages = pkgs.linuxPackages_3_2; + boot.kernelPackages = pkgs.linuxPackages_3_7; boot.vesa = false; } From 3e734ba695062f0f2bdbbd209c95c56d02e143ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sun, 16 Dec 2012 18:07:13 +0100 Subject: [PATCH 4/5] Qemu says 'boot=on' is deprecated, so I try a half-fix here I change the 'build-vm' to use '-boot menu=on', so a menu displays and allows choosing the 2nd hd. Otherwise, I don't know how to boot from a 2nd hd. --- modules/virtualisation/qemu-vm.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix index f71e0ba51126..c30086487a74 100644 --- a/modules/virtualisation/qemu-vm.nix +++ b/modules/virtualisation/qemu-vm.nix @@ -166,6 +166,7 @@ let ${pkgs.vmTools.startSamba} # Start QEMU. + # "-boot menu=on" is there, because I don't know how to make qemu boot from 2nd hd. exec ${pkgs.qemu_kvm}/bin/qemu-kvm \ -name ${vmName} \ -m ${toString config.virtualisation.memorySize} \ @@ -174,8 +175,9 @@ let -chardev socket,id=samba,path=./samba \ -net user,vlan=0,guestfwd=tcp:10.0.2.4:445-chardev:samba''${QEMU_NET_OPTS:+,$QEMU_NET_OPTS} \ ${if cfg.useBootLoader then '' - -drive index=0,file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \ - -drive index=1,file=${bootDisk}/disk.img,if=virtio,boot=on,readonly \ + -drive index=0,id=drive1,file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \ + -drive index=1,id=drive2,file=${bootDisk}/disk.img,if=virtio,readonly \ + -boot menu=on '' else '' -drive file=$NIX_DISK_IMAGE,if=virtio,cache=writeback,werror=report \ -kernel ${config.system.build.toplevel}/kernel \ From 358239348aea0f076069fcd60e94aa0610fe777f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Sun, 16 Dec 2012 21:41:47 +0100 Subject: [PATCH 5/5] making memtest grub entries work again I'm not any good at perl, and I only came up with this after many slow attempts. Any review welcome. But until this, memtest was broken, and extraPrepareConfig as well, in grub. --- modules/system/boot/loader/grub/grub.nix | 3 ++- modules/system/boot/loader/grub/install-grub.pl | 7 +++++++ modules/system/boot/loader/grub/memtest.nix | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/system/boot/loader/grub/grub.nix b/modules/system/boot/loader/grub/grub.nix index 0a9b374cc60c..70865c3c9338 100644 --- a/modules/system/boot/loader/grub/grub.nix +++ b/modules/system/boot/loader/grub/grub.nix @@ -13,10 +13,11 @@ let grubConfig = pkgs.writeText "grub-config.xml" (builtins.toXML { splashImage = f config.boot.loader.grub.splashImage; grub = f grub; + shell = "${pkgs.stdenv.shell}"; fullVersion = (builtins.parseDrvName config.system.build.grub.name).version; inherit (config.boot.loader.grub) version extraConfig extraPerEntryConfig extraEntries - extraEntriesBeforeNixOS configurationLimit copyKernels timeout + extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout default devices; }); diff --git a/modules/system/boot/loader/grub/install-grub.pl b/modules/system/boot/loader/grub/install-grub.pl index 5e9f3b4efdad..0140a711d727 100644 --- a/modules/system/boot/loader/grub/install-grub.pl +++ b/modules/system/boot/loader/grub/install-grub.pl @@ -30,6 +30,7 @@ sub writeFile { my $grub = get("grub"); my $grubVersion = int(get("version")); my $extraConfig = get("extraConfig"); +my $extraPrepareConfig = get("extraPrepareConfig"); my $extraPerEntryConfig = get("extraPerEntryConfig"); my $extraEntries = get("extraEntries"); my $extraEntriesBeforeNixOS = get("extraEntriesBeforeNixOS") eq "true"; @@ -188,6 +189,8 @@ addEntry("NixOS - Default", $defaultConfig); $conf .= "$extraEntries\n" unless $extraEntriesBeforeNixOS; +# extraEntries could refer to @bootRoot@, which we have to substitute +$conf =~ s/\@bootRoot\@/$bootRoot/g; # Add entries for all previous generations of the system profile. $conf .= "submenu \"NixOS - Old configurations\" {\n" if $grubVersion == 2; @@ -211,6 +214,10 @@ foreach my $link (@links) { $conf .= "}\n" if $grubVersion == 2; +# Run extraPrepareConfig in sh +if ($extraPrepareConfig ne "") { + system((get("shell"), "-c", $extraPrepareConfig)); +} # Atomically update the GRUB config. my $confFile = $grubVersion == 1 ? "/boot/grub/menu.lst" : "/boot/grub/grub.cfg"; diff --git a/modules/system/boot/loader/grub/memtest.nix b/modules/system/boot/loader/grub/memtest.nix index 08eb8a1f41cb..4bd4b69101c9 100644 --- a/modules/system/boot/loader/grub/memtest.nix +++ b/modules/system/boot/loader/grub/memtest.nix @@ -22,17 +22,17 @@ in extraEntries = if config.boot.loader.grub.version == 2 then '' menuentry "${memtest86.name}" { - linux16 $bootRoot/memtest.bin + linux16 @bootRoot@/memtest.bin } '' else '' menuentry "${memtest86.name}" - linux16 $bootRoot/memtest.bin + linux16 @bootRoot@/memtest.bin ''; extraPrepareConfig = '' - cp ${memtest86}/memtest.bin /boot/memtest.bin; + ${pkgs.coreutils}/bin/cp ${memtest86}/memtest.bin /boot/memtest.bin; ''; }; }