mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
add format-luks script
This commit is contained in:
parent
6bedbeb00c
commit
bb73865b3e
1 changed files with 20 additions and 0 deletions
20
flake.nix
20
flake.nix
|
@ -29,5 +29,25 @@
|
|||
{
|
||||
binaryninja = callPackage ./pkgs/binary-ninja-personal { };
|
||||
};
|
||||
|
||||
apps."x86_64-linux" =
|
||||
with (import nixpkgs { system = "x86_64-linux"; });
|
||||
{
|
||||
format-luks = writeShellScriptBin "format-luks" ''
|
||||
set -e
|
||||
read -p "Path to new LUKS device: " blkdev
|
||||
set -x
|
||||
cryptsetup -y -v luksFormat "$blkdev"
|
||||
cryptsetup --allow-discards open "$blkdev" cryptroot
|
||||
mkfs.btrfs /dev/mapper/cryptroot
|
||||
mount /dev/mapper/cryptroot /mnt -o discard,compress=zstd
|
||||
btrfs subvolume create /mnt/os
|
||||
btrfs subvolume create /mnt/home
|
||||
umount /mnt
|
||||
mount /dev/mapper/cryptroot /mnt -o discard,compress=zstd,subvol=/os
|
||||
mkdir /mnt/home
|
||||
mount /dev/mapper/cryptroot /mnt/home -o discard,compress=zstd,subvol=/home
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue