1
0
nixfiles/hosts/palladium/backup-scripts.nix

24 lines
554 B
Nix
Raw Normal View History

2021-12-07 19:48:24 +01:00
{ pkgs, ... }:
let
cb-mount = pkgs.writeScriptBin "cb-mount" ''
#!${pkgs.bash}/bin/bash
DEVICE=/dev/disk/by-path/pci-0000:00:12.0-ata-2-part1
2022-06-12 21:51:19 +02:00
${pkgs.cryptsetup}/bin/cryptsetup luksOpen ''${DEVICE} external-drive
2021-12-07 19:48:24 +01:00
mkdir -p /mnt/external-drive
mount /dev/mapper/external-drive /mnt/external-drive
'';
cb-unmount = pkgs.writeScriptBin "cb-unmount" ''
#!${pkgs.bash}/bin/bash
umount /mnt/external-drive
2022-06-12 21:51:19 +02:00
${pkgs.cryptsetup}/bin/cryptsetup luksClose external-drive
2021-12-07 19:48:24 +01:00
'';
in {
2022-06-12 21:51:19 +02:00
environment.systemPackages = [ cb-mount cb-unmount ];
2021-12-07 19:48:24 +01:00
}