Work on properly implementing the activation of systemd services.

This commit is contained in:
R-VdP 2023-02-09 15:04:27 +00:00
parent c3be9ceb19
commit 9aa059887b
No known key found for this signature in database
10 changed files with 205 additions and 86 deletions

View file

@ -6,7 +6,7 @@ in
makeServiceConfig =
{ system
, modules
, service-manager
, system-manager
,
}:
let
@ -25,7 +25,7 @@ in
serviceName = "${name}.service";
in
lib.nameValuePair serviceName { storePath = ''${nixosConfig.config.systemd.units."${serviceName}".unit}/${serviceName}''; })
nixosConfig.config.service-manager.services);
nixosConfig.config.system-manager.services);
servicesPath = pkgs.writeTextFile {
name = "services";
@ -33,11 +33,11 @@ in
text = lib.generators.toJSON { } services;
};
activationScript = pkgs.writeShellScript "activate" ''
${service-manager}/bin/service-manager activate \
${system-manager}/bin/system-manager activate \
--store-path "$(realpath $(dirname ''${0}))"
'';
in
pkgs.linkFarmFromDrvs "service-manager" [
pkgs.linkFarmFromDrvs "system-manager" [
servicesPath
activationScript
];

View file

@ -33,13 +33,13 @@ let
in
{
options = {
service-manager.services = lib.mkOption {
system-manager.services = lib.mkOption {
type = with lib.types; listOf str;
};
};
config = {
service-manager.services = lib.attrNames services;
system-manager.services = lib.attrNames services;
systemd = { inherit services; };
};
}