From 9cf4f170aefaf85d01cb1710c192f9f5b56ab694 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 23 Nov 2022 13:28:52 +0100 Subject: add zapCreateMount script for idempodents install from iso/kexec --- types.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'types.nix') diff --git a/types.nix b/types.nix index e09ca9d..92f11fb 100644 --- a/types.nix +++ b/types.nix @@ -146,6 +146,26 @@ rec { # ensures that "/" is processed before "/foo" etc. ${concatStrings (attrValues fsMounts)} ''; + /* takes a disko device specification and returns a string which unmounts, destroys all disks and then runs create and mount + + zapCreateMount :: types.devices -> str + */ + zapCreateMount = devices: '' + set -efux + # print existing disks + lsblk + + # TODO get zap the same way we get create + # make partitioning idempotent by dismounting already mounted filesystems + if findmnt /mnt; then + umount -Rlv /mnt + fi + + echo 'creating partitions...' + ${diskoLib.create devices} + echo 'mounting partitions...' + ${diskoLib.mount devices} + ''; /* Takes a disko device specification and returns a nixos configuration config :: types.devices -> nixosConfig -- cgit v1.2.3