extract "mount filesystem" to module

This commit is contained in:
Daniel Barlow
2023-09-04 21:17:52 +01:00
parent 83092b7b73
commit 3bdc986dd7
4 changed files with 75 additions and 16 deletions

18
modules/mount/service.nix Normal file
View File

@@ -0,0 +1,18 @@
{
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}";
}