liminix-fork/modules/mount/service.nix

19 lines
396 B
Nix
Raw Permalink Normal View History

2023-09-04 22:17:52 +02:00
{
liminix
, lib
}:
{ device, mountpoint, options, fstype }:
let
inherit (liminix.services) oneshot;
in oneshot {
name = "mount.${lib.escapeURL mountpoint}";
up = ''
while ! findfs ${device}; do
echo waiting for device ${device}
sleep 1
done
mount -t ${fstype} -o ${lib.concatStringsSep "," options} ${device} ${mountpoint}
'';
down = "umount ${mountpoint}";
}