summaryrefslogtreecommitdiffstats
path: root/types.nix
diff options
context:
space:
mode:
Diffstat (limited to 'types.nix')
-rw-r--r--types.nix20
1 files changed, 20 insertions, 0 deletions
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