nix/os/devices/disk: use sudo in prepareDisk script
This commit is contained in:
parent
cf18b61720
commit
7bac7cd42a
1 changed files with 18 additions and 16 deletions
|
@ -66,7 +66,7 @@ in rec {
|
|||
# Partition
|
||||
sync
|
||||
{
|
||||
fdisk -w always -W always ${ownLib.disk.bootGrubDevice diskId} <<EOF
|
||||
sudo fdisk -w always -W always ${ownLib.disk.bootGrubDevice diskId} <<EOF
|
||||
g
|
||||
n
|
||||
1
|
||||
|
@ -95,30 +95,32 @@ in rec {
|
|||
EOF
|
||||
} || {
|
||||
sync
|
||||
partprobe ${ownLib.disk.bootGrubDevice diskId}
|
||||
sudo partprobe ${ownLib.disk.bootGrubDevice diskId}
|
||||
}
|
||||
|
||||
sleep 1
|
||||
|
||||
# Encrypt
|
||||
cryptsetup luksFormat ${ownLib.disk.bootLuksDevice diskId} -
|
||||
cryptsetup luksOpen ${ownLib.disk.bootLuksDevice diskId} ${ownLib.disk.luksName diskId}
|
||||
sudo cryptsetup luksFormat ${ownLib.disk.bootLuksDevice diskId} -
|
||||
sudo cryptsetup luksOpen ${ownLib.disk.bootLuksDevice diskId} ${ownLib.disk.luksName diskId}
|
||||
|
||||
# LVM
|
||||
vgcreate ${ownLib.disk.volumeGroup diskId} ${ownLib.disk.luksPhysicalVolume diskId}
|
||||
lvcreate ${ownLib.disk.volumeGroup diskId} -L 2G -n swap
|
||||
lvcreate ${ownLib.disk.volumeGroup diskId} -l 100%FREE -n root
|
||||
sudo vgcreate ${ownLib.disk.volumeGroup diskId} ${ownLib.disk.luksPhysicalVolume diskId}
|
||||
sudo lvcreate ${ownLib.disk.volumeGroup diskId} -L 2G -n swap
|
||||
sudo lvcreate ${ownLib.disk.volumeGroup diskId} -l 100%FREE -n root
|
||||
|
||||
# Filesystem
|
||||
mkfs.vfat -F32 ${ownLib.disk.bootFsDevice diskId}
|
||||
mkfs.btrfs ${ownLib.disk.rootFsDevice diskId}
|
||||
mkswap ${ownLib.disk.swapFsDevice diskId}
|
||||
sudo mkfs.vfat -F32 ${ownLib.disk.bootFsDevice diskId}
|
||||
sudo mkfs.btrfs ${ownLib.disk.rootFsDevice diskId}
|
||||
sudo mkswap ${ownLib.disk.swapFsDevice diskId}
|
||||
|
||||
# Subvolume and FS hierharchy
|
||||
mkdir -p /mnt
|
||||
mkdir ${mntRootVol}
|
||||
mount ${ownLib.disk.rootFsDevice diskId} ${mntRootVol}
|
||||
btrfs subvolume create ${mntRootVol}/nixos
|
||||
btrfs subvolume create ${mntRootVol}/home
|
||||
mkdir ${mntRootVol}/nixos/{boot,home}
|
||||
sudo mkdir -p /mnt
|
||||
sudo mkdir ${mntRootVol}
|
||||
sudo mount ${ownLib.disk.rootFsDevice diskId} ${mntRootVol}
|
||||
sudo btrfs subvolume create ${mntRootVol}/nixos
|
||||
sudo btrfs subvolume create ${mntRootVol}/home
|
||||
sudo mkdir ${mntRootVol}/nixos/{boot,home}
|
||||
|
||||
${diskUmount}
|
||||
'';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue