Last active
September 21, 2019 14:44
-
-
Save yorickvP/837cc52589b609803b0d28b3c3369e84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
let | |
rootfs = "/dev/disk/by-uuid/7165e542-0995-474c-a228-9592339e0604"; | |
swapfs = "/dev/disk/by-uuid/baaf824a-bee0-4037-a237-3a69f1db7985"; | |
in | |
{ | |
# fs layout: | |
# before: /nixos/nix/* /boot/grub/menu.lst | |
# after: /nix/* /old-root/boot/grub/menu.lst | |
boot = { | |
kernelPackages = pkgs.linuxPackages_latest; | |
blacklistedKernelModules = ["coretemp"]; | |
# use grub 1, don't install | |
loader.grub = { | |
version = 1; | |
enable = true; | |
storePath = "/nixos/nix/store"; | |
extraPerEntryConfig = "root (hd0,0)"; # do we need this? | |
mirroredBoots = [{ | |
path = "/old-root/boot"; | |
devices = ["nodev"]; | |
}]; | |
splashImage = null; | |
}; | |
initrd.availableKernelModules = [ "xen_blkfront" ]; | |
kernelModules = [ ]; | |
extraModulePackages = [ ]; | |
kernelParams = ["root=${rootfs}" "boot.shell_on_fail"]; | |
initrd = { | |
supportedFilesystems = [ "ext4" ]; | |
postDeviceCommands = '' | |
mkdir -p /mnt-root/old-root ; | |
mount -t ext4 ${rootfs} /mnt-root/old-root ; | |
''; | |
}; | |
}; | |
fileSystems = { | |
"/" = { | |
device = "/old-root/nixos"; | |
fsType = "none"; | |
options = [ "bind" ]; | |
}; | |
"/old-root" = { | |
device = rootfs; | |
fsType = "ext4"; | |
}; | |
}; | |
swapDevices = [ { device = swapfs; } ]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment