34 lines
1.0 KiB
Nix
34 lines
1.0 KiB
Nix
|
{ config, pkgs, lib, ... }:
|
||
|
with lib; {
|
||
|
|
||
|
options.systemd.services = lib.mkOption {
|
||
|
type = types.attrsOf (types.submodule ({ name, config, ... }: {
|
||
|
options.genode.enable = lib.mkOption {
|
||
|
type = types.bool;
|
||
|
default = false;
|
||
|
description = "Translate this systemd unit to a Genode subsystem.";
|
||
|
};
|
||
|
}));
|
||
|
};
|
||
|
|
||
|
config.services.klogd.enable = false;
|
||
|
# The default is determined by checking the Linux version
|
||
|
# which cannot be evaluated here.
|
||
|
|
||
|
config.genode.init.subinits = mapAttrs' (name: service:
|
||
|
let name' = "services." + name;
|
||
|
in {
|
||
|
name = name';
|
||
|
value = {
|
||
|
inputs = with pkgs; with genodePackages; [ bash libc posix vfs_pipe ];
|
||
|
configFile = pkgs.writeText "${name'}.dhall" ''
|
||
|
${./systemd-runner.dhall} {
|
||
|
, coreutils = "${pkgs.coreutils}"
|
||
|
, execStart = "${toString service.serviceConfig.ExecStart}"
|
||
|
}
|
||
|
'';
|
||
|
};
|
||
|
}) (filterAttrs (name: service: service.genode.enable)
|
||
|
config.systemd.services);
|
||
|
}
|