Move nix code under nix/
This commit is contained in:
parent
fe6fb907f7
commit
929da3e3c3
3 changed files with 2 additions and 2 deletions
34
nix/lib.nix
Normal file
34
nix/lib.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ nixpkgs }:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
in
|
||||
{
|
||||
makeServiceConfig = { system, module }:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
nixosConfig = lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { };
|
||||
modules = [ module ];
|
||||
};
|
||||
services = lib.flip lib.genAttrs
|
||||
(serviceName:
|
||||
nixosConfig.config.systemd.units."${serviceName}.service".unit)
|
||||
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
|
||||
pkgs.linkFarmFromDrvs "service-manager" [
|
||||
servicesPath
|
||||
activationScript
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue