Add an activation script.

This commit is contained in:
R-VdP 2023-02-01 17:36:07 +00:00
parent 349255de8d
commit fe6fb907f7
No known key found for this signature in database

15
lib.nix
View file

@ -5,6 +5,8 @@ in
{ {
makeServiceConfig = { system, module }: makeServiceConfig = { system, module }:
let let
pkgs = nixpkgs.legacyPackages.${system};
nixosConfig = lib.nixosSystem { nixosConfig = lib.nixosSystem {
inherit system; inherit system;
specialArgs = { }; specialArgs = { };
@ -14,10 +16,19 @@ in
(serviceName: (serviceName:
nixosConfig.config.systemd.units."${serviceName}.service".unit) nixosConfig.config.systemd.units."${serviceName}.service".unit)
nixosConfig.config.service-manager.services; nixosConfig.config.service-manager.services;
in
nixpkgs.legacyPackages.${system}.writeTextFile { servicesPath =
pkgs.writeTextFile {
name = "services"; name = "services";
destination = "/services.json"; destination = "/services.json";
text = lib.generators.toJSON { } services; text = lib.generators.toJSON { } services;
}; };
activationScript = pkgs.writeShellScript "activate" ''
echo "${servicesPath}"
'';
in
pkgs.linkFarmFromDrvs "service-manager" [
servicesPath
activationScript
];
} }