refactor: move options into own module

This commit is contained in:
2022-12-07 11:43:18 +01:00
parent e1ce751171
commit f794ce0d9e
2 changed files with 45 additions and 27 deletions

View File

@@ -1,34 +1,10 @@
{ config, pkgs, lib, ... }: with lib; let
cfg = config.services.ssh-cert-dist;
directoryModule = { name, ... }: {
options = {
name = mkOption {
type = types.str;
default = last (splitString "/" name);
};
fetch = mkOption {
type = types.bool;
default = true;
};
upload = mkOption {
type = types.bool;
default = false;
};
};
};
in
{
options.services.ssh-cert-dist = {
enable = mkEnableOption "ssh-cert-dist";
endpoint = mkOption {
type = types.str;
description = "API endpoint url";
};
directories = mkOption {
type = with types; attrsOf (submodule directoryModule);
default = { };
};
};
config.imports = [
./options.nix
];
config.systemd.user.services = mkIf cfg.enable (mapAttrs'
(path: options: {
inherit (options) name; value = {