add lib.serviceDependZpool
This commit is contained in:
parent
a827438a4c
commit
df8a22760c
19
lib.nix
19
lib.nix
@ -78,5 +78,24 @@ inputs.nixpkgs.lib.extend (
|
|||||||
vpnNamespace = "wg";
|
vpnNamespace = "wg";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
serviceDependZpool =
|
||||||
|
serviceName: zpool:
|
||||||
|
{ config, ... }:
|
||||||
|
{
|
||||||
|
systemd.services.${serviceName} = {
|
||||||
|
wants = [ "zfs-import-${zpool}.service" ];
|
||||||
|
after = [ "zfs-import-${zpool}.service" ];
|
||||||
|
requires = [ "zfs-import-${zpool}.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# assert that the pool is even enabled
|
||||||
|
config.assertions = [
|
||||||
|
{
|
||||||
|
assertion = builtins.elem zpool config.boot.zfs.extraPools;
|
||||||
|
message = "${zpool} is not enabled in `boot.zfs.extraPools`";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user