24 lines
554 B
Nix
24 lines
554 B
Nix
{ 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
|
|
|
|
${pkgs.cryptsetup}/bin/cryptsetup luksOpen ''${DEVICE} external-drive
|
|
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
|
|
${pkgs.cryptsetup}/bin/cryptsetup luksClose external-drive
|
|
'';
|
|
|
|
in {
|
|
environment.systemPackages = [ cb-mount cb-unmount ];
|
|
}
|