flip dependencies for triggered/controlled services
Instead of treating the trigger as the "main" service and the triggered service as subsidary, now we treat the triggered service as the service and the trigger as "subsidary". This needs some special handling when we work out which services go in the default bundle, but it works better for declaring dependencies on triggered services because it means the dependency runs after the triggered service comes up, not just when the watcher-for-events starts
This commit is contained in:
@@ -7,19 +7,21 @@
|
||||
let
|
||||
inherit (liminix.services) longrun oneshot;
|
||||
device = "/dev/disk/by-partlabel/${partlabel}";
|
||||
name = "mount.${lib.strings.sanitizeDerivationName (lib.escapeURL mountpoint)}";
|
||||
options_string =
|
||||
if options == [] then "" else "-o ${lib.concatStringsSep "," options}";
|
||||
mount_service = oneshot {
|
||||
name = "mount.${lib.escapeURL mountpoint}";
|
||||
timeout-up = 3600;
|
||||
up = "mount -t ${fstype} ${options_string} ${device} ${mountpoint}";
|
||||
down = "umount ${mountpoint}";
|
||||
};
|
||||
in svc.uevent-rule.build {
|
||||
service = mount_service;
|
||||
symlink = device;
|
||||
terms = {
|
||||
partname = partlabel;
|
||||
devtype = "partition";
|
||||
controller = svc.uevent-rule.build {
|
||||
serviceName = name;
|
||||
symlink = device;
|
||||
terms = {
|
||||
partname = partlabel;
|
||||
devtype = "partition";
|
||||
};
|
||||
};
|
||||
in oneshot {
|
||||
inherit name;
|
||||
timeout-up = 3600;
|
||||
up = "mount -t ${fstype} ${options_string} ${device} ${mountpoint}";
|
||||
down = "umount ${mountpoint}";
|
||||
inherit controller;
|
||||
}
|
||||
|
Reference in New Issue
Block a user