repo-clone/module.nix

40 lines
972 B
Nix

{ lib, config, pkgs, ... }:
let
service = "repo-clone";
cfg = config.repo-clone;
inherit (lib) mkIf mkOption mkEnableOption types;
inherit (lib.strings) concatStringsSep;
inherit (lib.attrsets) mapAttrsToList;
inherit (pkgs) writeText;
in
{
options.${service} = {
enable = mkEnableOption "${service} service";
repos = mkOption {
type = import ./repo.nix { inherit lib; };
description = ''
attrs of repos to clone
'';
default = { };
};
pkg = mkOption {
type = types.package;
};
};
# /nix/store/pxd7wc8icz577hpl6pmz02b74nhbrj6h-unit-home-manager-ravenshade.service/home-manager-ravenshade.service
config = mkIf cfg.enable {
systemd.user.services.${service} = import ./service.nix { inherit service pkgs config; };
repo-clone.pkg = writeText "${service}.conf"
(concatStringsSep "\n"
(mapAttrsToList (target: settings: "${settings.url} ${target}") cfg.repos));
};
}