diff options
| author | Kleidi Bujari <mail@4kb.net> | 2025-04-02 23:20:42 -0400 |
|---|---|---|
| committer | Kleidi Bujari <mail@4kb.net> | 2025-04-02 23:20:42 -0400 |
| commit | dd06cce663d4863443418c8aa43b0d9bab3729ce (patch) | |
| tree | 4c101ee32712714144eac2ba8445abe0f631d8b6 /packages/partitioner.nix | |
| parent | c950f338c5720a132552863a35d1c7924df3d3a6 (diff) | |
| download | depot-dd06cce663d4863443418c8aa43b0d9bab3729ce.tar.gz depot-dd06cce663d4863443418c8aa43b0d9bab3729ce.tar.bz2 depot-dd06cce663d4863443418c8aa43b0d9bab3729ce.zip | |
change canonical site
Diffstat (limited to 'packages/partitioner.nix')
| -rw-r--r-- | packages/partitioner.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/partitioner.nix b/packages/partitioner.nix new file mode 100644 index 0000000..cd36f5d --- /dev/null +++ b/packages/partitioner.nix @@ -0,0 +1,33 @@ +# Apply standard partition layout to a disk device. +{ pkgs, ... }: + +pkgs.writeShellScriptBin "partitioner" '' + set -e + + if [ $# -ne 1 ]; then + echo "Usage: $0 <disk-device>" + exit 1 + fi + + DISK=$1 + + # Clear existing partitions + sgdisk -Z "$DISK" + + # 1GB EFI partition (FAT32) + sgdisk -n 1:0:+1G -t 1:EF00 -c 1:EFI "$DISK" + + # Rest for ZFS + sgdisk -n 2:0:0 -t 2:BF01 -c 2:ZFS "$DISK" + + mkfs.fat -F32 -nEFI "" + + zpool create \ + -o ashift=12 \ + -O compression=on \ + -O acltype=posixacl \ + -O xattr=sa \ + -O relatime=off + -O normalization=formD \ + zroot "$DISK" +'' |
