Move the function to generate the store path into lib.

This commit is contained in:
R-VdP 2023-02-01 16:47:43 +00:00
parent 6a849d71d0
commit 95bd335d8c
No known key found for this signature in database

View file

@ -6,7 +6,14 @@
};
outputs = { self, nixpkgs, flake-utils }: {
serviceConfig =
serviceConfig = self.lib.makeServiceConfig
[
"service-1"
"service-2"
];
lib = {
makeServiceConfig = serviceNames:
let
system = flake-utils.lib.system.x86_64-linux;
lib = nixpkgs.lib;
@ -18,11 +25,7 @@
services = lib.flip lib.genAttrs
(serviceName:
nixosConfig.config.systemd.units."${serviceName}.service".unit)
# TODO: generate this list from the config instead of hard coding
[
"service-1"
"service-2"
];
serviceNames;
in
nixpkgs.legacyPackages.${system}.writeTextFile {
name = "services";
@ -30,4 +33,5 @@
text = lib.generators.toJSON { } services;
};
};
};
}