summaryrefslogtreecommitdiffstats
path: root/types.nix
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2022-12-25 18:25:37 +0000
committerGitHub <noreply@github.com>2022-12-25 18:25:37 +0000
commite3527b826d9ce94855cd0f2716c46cef76a4219a (patch)
treed63f70120437bb4fdcc4d0b656c674e533c6abea /types.nix
parent11d5c74c30cec9783d8281a3af51d269ac7f3eab (diff)
parent164ea97c01ae57ecb76153ef43be4a184aa5d33a (diff)
Merge pull request #75 from nix-community/zap2HEADmaster
zap only devices we care about
Diffstat (limited to 'types.nix')
-rw-r--r--types.nix23
1 files changed, 6 insertions, 17 deletions
diff --git a/types.nix b/types.nix
index bd0aa92..c0d18d0 100644
--- a/types.nix
+++ b/types.nix
@@ -154,23 +154,11 @@ rec {
*/
zapCreateMount = devices: ''
set -efux
- shopt -s nullglob
- # print existing disks
- lsblk
+ umount -Rv /mnt || :
- # 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
-
- # stop all existing raids
- if command -v mdadm; then
- for r in /dev/md/* /dev/md[0-9]*; do
- # might fail if the device was already closed in the loop
- mdadm --stop "$r" || true
- done
- fi
+ for dev in ${toString (lib.catAttrs "device" (lib.attrValues devices.disk))}; do
+ ${./disk-deactivate}/disk-deactivate "$dev" | bash -x
+ done
echo 'creating partitions...'
${diskoLib.create devices}
@@ -912,6 +900,7 @@ rec {
type = types.functionTo types.str;
default = vg: ''
lvcreate \
+ --yes \
${if hasInfix "%" config.size then "-l" else "-L"} ${config.size} \
-n ${config.name} \
${optionalString (!isNull config.lvm_type) "--type=${config.lvm_type}"} \
@@ -1418,7 +1407,7 @@ rec {
internal = true;
readOnly = true;
type = types.functionTo (types.listOf types.package);
- default = pkgs: lib.optionals (!isNull config.content) (config.content._pkgs pkgs);
+ default = pkgs: [ pkgs.jq ] ++ lib.optionals (!isNull config.content) (config.content._pkgs pkgs);
};
};
});