Move the function to generate the store path into lib.
This commit is contained in:
parent
6a849d71d0
commit
95bd335d8c
1 changed files with 26 additions and 22 deletions
16
flake.nix
16
flake.nix
|
|
@ -6,7 +6,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils }: {
|
outputs = { self, nixpkgs, flake-utils }: {
|
||||||
serviceConfig =
|
serviceConfig = self.lib.makeServiceConfig
|
||||||
|
[
|
||||||
|
"service-1"
|
||||||
|
"service-2"
|
||||||
|
];
|
||||||
|
|
||||||
|
lib = {
|
||||||
|
makeServiceConfig = serviceNames:
|
||||||
let
|
let
|
||||||
system = flake-utils.lib.system.x86_64-linux;
|
system = flake-utils.lib.system.x86_64-linux;
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
|
|
@ -18,11 +25,7 @@
|
||||||
services = lib.flip lib.genAttrs
|
services = lib.flip lib.genAttrs
|
||||||
(serviceName:
|
(serviceName:
|
||||||
nixosConfig.config.systemd.units."${serviceName}.service".unit)
|
nixosConfig.config.systemd.units."${serviceName}.service".unit)
|
||||||
# TODO: generate this list from the config instead of hard coding
|
serviceNames;
|
||||||
[
|
|
||||||
"service-1"
|
|
||||||
"service-2"
|
|
||||||
];
|
|
||||||
in
|
in
|
||||||
nixpkgs.legacyPackages.${system}.writeTextFile {
|
nixpkgs.legacyPackages.${system}.writeTextFile {
|
||||||
name = "services";
|
name = "services";
|
||||||
|
|
@ -30,4 +33,5 @@
|
||||||
text = lib.generators.toJSON { } services;
|
text = lib.generators.toJSON { } services;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue