wip: figuring it out, slowly
This commit is contained in:
@@ -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; };
|
||||
}
|
||||
Reference in New Issue
Block a user