59 lines
1.2 KiB
Nix
59 lines
1.2 KiB
Nix
{ pkgs }:
|
|
{
|
|
appOptions = opts: with pkgs.lib; {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable";
|
|
};
|
|
|
|
autoSync = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Auto sync";
|
|
};
|
|
|
|
prune = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = "Prune";
|
|
};
|
|
|
|
serverSideDiff = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Enable server-side diffing";
|
|
};
|
|
|
|
values = mkOption {
|
|
type = types.attrsOf types.anything;
|
|
default = {};
|
|
description = "Values";
|
|
};
|
|
} // opts;
|
|
|
|
appConfig = cfg: name: conf:
|
|
with pkgs.lib;
|
|
let
|
|
app = conf // {
|
|
createNamespace = true;
|
|
|
|
compareOptions = {
|
|
serverSideDiff = cfg.serverSideDiff;
|
|
};
|
|
|
|
syncPolicy = {
|
|
syncOptions = {
|
|
applyOutOfSyncOnly = true;
|
|
};
|
|
|
|
autoSync = mkIf cfg.autoSync {
|
|
prune = cfg.prune;
|
|
selfHeal = false;
|
|
};
|
|
};
|
|
};
|
|
|
|
in mkIf cfg.enable { applications.${name} = app; };
|
|
}
|