35 lines
1.2 KiB
Nix
35 lines
1.2 KiB
Nix
|
{ dev_name, uuid, pw_name, opts, config, pkgs, ... }:
|
||
|
|
||
|
let
|
||
|
|
||
|
device = "/dev/mapper/${dev_name}";
|
||
|
home = "${config.home.homeDirectory}";
|
||
|
shell = "${pkgs.dash}/bin/dash";
|
||
|
cryptsetup = "${pkgs.cryptsetup}/bin/cryptsetup";
|
||
|
mkdir = "${pkgs.coreutils}/bin/mkdir";
|
||
|
pass = "${pkgs.pass}/bin/pass";
|
||
|
sudo = "/run/wrappers/bin/doas";
|
||
|
mount = "/run/wrappers/bin/mount";
|
||
|
|
||
|
in
|
||
|
pkgs.writeScriptBin "mount_wallets" ''
|
||
|
#!${shell}
|
||
|
|
||
|
if [ ! -b "${device}" ]; then
|
||
|
${pass} "${pw_name}" | ${sudo} ${cryptsetup} open "UUID=${uuid}" ${dev_name}
|
||
|
fi
|
||
|
|
||
|
${mkdir} -p \
|
||
|
"${home}/.walletwasabi" \
|
||
|
"${home}/.local/share/Bisq" \
|
||
|
"${home}/.bitmonero" \
|
||
|
"${home}/monero-storage" \
|
||
|
"${home}/.electrumfair"
|
||
|
|
||
|
${sudo} ${mount} ${device} -o subvol=@wasabi,${opts} "${home}/.walletwasabi"
|
||
|
${sudo} ${mount} ${device} -o subvol=@bisq,${opts} "${home}/.local/share/Bisq"
|
||
|
${sudo} ${mount} ${device} -o subvol=@monero/@bitmonero,${opts} "${home}/.bitmonero"
|
||
|
${sudo} ${mount} ${device} -o subvol=@monero/@monero-storage,${opts} "${home}/monero-storage"
|
||
|
${sudo} ${mount} ${device} -o subvol=@electrumfair,${opts} "${home}/.electrumfair"
|
||
|
''
|