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

21
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;
servicesPath =
pkgs.writeTextFile {
name = "services";
destination = "/services.json";
text = lib.generators.toJSON { } services;
};
activationScript = pkgs.writeShellScript "activate" ''
echo "${servicesPath}"
'';
in in
nixpkgs.legacyPackages.${system}.writeTextFile { pkgs.linkFarmFromDrvs "service-manager" [
name = "services"; servicesPath
destination = "/services.json"; activationScript
text = lib.generators.toJSON { } services; ];
};
} }