Set the services to be included as an option in the module.

This commit is contained in:
R-VdP 2023-02-01 16:55:43 +00:00
parent 95bd335d8c
commit 504f413c02
No known key found for this signature in database
2 changed files with 55 additions and 45 deletions

View file

@ -6,26 +6,24 @@
};
outputs = { self, nixpkgs, flake-utils }: {
serviceConfig = self.lib.makeServiceConfig
[
"service-1"
"service-2"
];
serviceConfig = self.lib.makeServiceConfig {
module = { imports = [ ./modules ]; };
};
lib = {
makeServiceConfig = serviceNames:
makeServiceConfig = { module }:
let
system = flake-utils.lib.system.x86_64-linux;
lib = nixpkgs.lib;
nixosConfig = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { };
modules = [ ./modules ];
modules = [ module ];
};
services = lib.flip lib.genAttrs
(serviceName:
nixosConfig.config.systemd.units."${serviceName}.service".unit)
serviceNames;
nixosConfig.config.service-manager.services;
in
nixpkgs.legacyPackages.${system}.writeTextFile {
name = "services";