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