wip: figuring it out, slowly

This commit is contained in:
Jonas Juselius
2024-10-11 18:56:56 +02:00
parent a5cf93c758
commit 768cb1ddef
4 changed files with 77 additions and 44 deletions
+58
View File
@@ -0,0 +1,58 @@
{ 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; };
}