add LVM support (#44)

This commit is contained in:
DavHau 2020-02-14 08:04:27 +07:00 committed by GitHub
parent 0c2eef5dbb
commit d8512ed9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -36,8 +36,8 @@ EOF
{ ... }: { ... }:
{ {
imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ]; imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ];
boot.loader.grub.device = "/dev/$disk"; boot.loader.grub.device = "$grubdev";
fileSystems."/" = { device = "/dev/${disk}1"; fsType = "ext4"; }; fileSystems."/" = { device = "$rootfsdev"; fsType = "ext4"; };
} }
EOF EOF
@ -147,8 +147,12 @@ removeSwap() {
} }
prepareEnv() { prepareEnv() {
# $disk is used in makeConf() # $grubdev is used in makeConf()
for disk in vda sda; do [[ -e /dev/$disk ]] && break; done for grubdev in /dev/vda /dev/sda; do [[ -e $grubdev ]] && break; done
# Retrieve root fs block device
# (get root mount) (get partition or logical volume)
rootfsdev=$(mount | grep "on / type" | awk '{print $1;}')
# DigitalOcean doesn't seem to set USER while running user data # DigitalOcean doesn't seem to set USER while running user data
export USER="root" export USER="root"