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
|
# Partition
|
||||||
sync
|
sync
|
||||||
{
|
{
|
||||||
fdisk -w always -W always ${ownLib.disk.bootGrubDevice diskId} <<EOF
|
sudo fdisk -w always -W always ${ownLib.disk.bootGrubDevice diskId} <<EOF
|
||||||
g
|
g
|
||||||
n
|
n
|
||||||
1
|
1
|
||||||
|
@ -95,30 +95,32 @@ in rec {
|
||||||
EOF
|
EOF
|
||||||
} || {
|
} || {
|
||||||
sync
|
sync
|
||||||
partprobe ${ownLib.disk.bootGrubDevice diskId}
|
sudo partprobe ${ownLib.disk.bootGrubDevice diskId}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sleep 1
|
||||||
|
|
||||||
# Encrypt
|
# Encrypt
|
||||||
cryptsetup luksFormat ${ownLib.disk.bootLuksDevice diskId} -
|
sudo cryptsetup luksFormat ${ownLib.disk.bootLuksDevice diskId} -
|
||||||
cryptsetup luksOpen ${ownLib.disk.bootLuksDevice diskId} ${ownLib.disk.luksName diskId}
|
sudo cryptsetup luksOpen ${ownLib.disk.bootLuksDevice diskId} ${ownLib.disk.luksName diskId}
|
||||||
|
|
||||||
# LVM
|
# LVM
|
||||||
vgcreate ${ownLib.disk.volumeGroup diskId} ${ownLib.disk.luksPhysicalVolume diskId}
|
sudo vgcreate ${ownLib.disk.volumeGroup diskId} ${ownLib.disk.luksPhysicalVolume diskId}
|
||||||
lvcreate ${ownLib.disk.volumeGroup diskId} -L 2G -n swap
|
sudo lvcreate ${ownLib.disk.volumeGroup diskId} -L 2G -n swap
|
||||||
lvcreate ${ownLib.disk.volumeGroup diskId} -l 100%FREE -n root
|
sudo lvcreate ${ownLib.disk.volumeGroup diskId} -l 100%FREE -n root
|
||||||
|
|
||||||
# Filesystem
|
# Filesystem
|
||||||
mkfs.vfat -F32 ${ownLib.disk.bootFsDevice diskId}
|
sudo mkfs.vfat -F32 ${ownLib.disk.bootFsDevice diskId}
|
||||||
mkfs.btrfs ${ownLib.disk.rootFsDevice diskId}
|
sudo mkfs.btrfs ${ownLib.disk.rootFsDevice diskId}
|
||||||
mkswap ${ownLib.disk.swapFsDevice diskId}
|
sudo mkswap ${ownLib.disk.swapFsDevice diskId}
|
||||||
|
|
||||||
# Subvolume and FS hierharchy
|
# Subvolume and FS hierharchy
|
||||||
mkdir -p /mnt
|
sudo mkdir -p /mnt
|
||||||
mkdir ${mntRootVol}
|
sudo mkdir ${mntRootVol}
|
||||||
mount ${ownLib.disk.rootFsDevice diskId} ${mntRootVol}
|
sudo mount ${ownLib.disk.rootFsDevice diskId} ${mntRootVol}
|
||||||
btrfs subvolume create ${mntRootVol}/nixos
|
sudo btrfs subvolume create ${mntRootVol}/nixos
|
||||||
btrfs subvolume create ${mntRootVol}/home
|
sudo btrfs subvolume create ${mntRootVol}/home
|
||||||
mkdir ${mntRootVol}/nixos/{boot,home}
|
sudo mkdir ${mntRootVol}/nixos/{boot,home}
|
||||||
|
|
||||||
${diskUmount}
|
${diskUmount}
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue