2023-07-15 17:15:38 +00:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.esdm;
|
|
|
|
in
|
|
|
|
{
|
2024-04-21 15:54:59 +00:00
|
|
|
imports = [
|
|
|
|
# removed option 'services.esdm.cuseRandomEnable'
|
|
|
|
(lib.mkRemovedOptionModule [ "services" "esdm" "cuseRandomEnable" ] ''
|
|
|
|
Use services.esdm.enableLinuxCompatServices instead.
|
|
|
|
'')
|
|
|
|
# removed option 'services.esdm.cuseUrandomEnable'
|
|
|
|
(lib.mkRemovedOptionModule [ "services" "esdm" "cuseUrandomEnable" ] ''
|
|
|
|
Use services.esdm.enableLinuxCompatServices instead.
|
|
|
|
'')
|
|
|
|
# removed option 'services.esdm.procEnable'
|
|
|
|
(lib.mkRemovedOptionModule [ "services" "esdm" "procEnable" ] ''
|
|
|
|
Use services.esdm.enableLinuxCompatServices instead.
|
|
|
|
'')
|
|
|
|
# removed option 'services.esdm.verbose'
|
|
|
|
(lib.mkRemovedOptionModule [ "services" "esdm" "verbose" ] ''
|
|
|
|
There is no replacement.
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
options.services.esdm = {
|
2024-04-21 15:54:59 +00:00
|
|
|
enable = lib.mkEnableOption "ESDM service configuration";
|
2024-01-02 11:29:13 +00:00
|
|
|
package = lib.mkPackageOption pkgs "esdm" { };
|
2024-04-21 15:54:59 +00:00
|
|
|
enableLinuxCompatServices = lib.mkOption {
|
2023-07-15 17:15:38 +00:00
|
|
|
type = lib.types.bool;
|
|
|
|
default = true;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
|
|
|
Enable /dev/random, /dev/urandom and /proc/sys/kernel/random/* userspace wrapper.
|
2023-07-15 17:15:38 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable (
|
|
|
|
lib.mkMerge [
|
|
|
|
({
|
|
|
|
systemd.packages = [ cfg.package ];
|
|
|
|
systemd.services."esdm-server".wantedBy = [ "basic.target" ];
|
|
|
|
})
|
2024-04-21 15:54:59 +00:00
|
|
|
# It is necessary to set those options for these services to be started by systemd in NixOS
|
|
|
|
(lib.mkIf cfg.enableLinuxCompatServices {
|
|
|
|
systemd.targets."esdm-linux-compat".wantedBy = [ "basic.target" ];
|
|
|
|
systemd.services."esdm-server-suspend".wantedBy = [ "sleep.target" "suspend.target" "hibernate.target" ];
|
|
|
|
systemd.services."esdm-server-resume".wantedBy = [ "sleep.target" "suspend.target" "hibernate.target" ];
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|
|
|
|
]);
|
|
|
|
|
|
|
|
meta.maintainers = with lib.maintainers; [ orichter thillux ];
|
|
|
|
}
|