Work on properly implementing the activation of systemd services.
This commit is contained in:
parent
c3be9ceb19
commit
9aa059887b
10 changed files with 205 additions and 86 deletions
|
|
@ -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
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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; };
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue