aboutsummaryrefslogtreecommitdiff
path: root/modules/kfmon/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/kfmon/default.nix')
-rw-r--r--modules/kfmon/default.nix43
1 files changed, 29 insertions, 14 deletions
diff --git a/modules/kfmon/default.nix b/modules/kfmon/default.nix
index 8557a3e..ac20b86 100644
--- a/modules/kfmon/default.nix
+++ b/modules/kfmon/default.nix
@@ -26,13 +26,17 @@ in {
file = mkOption {
default = {};
type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {}));
+ apply = filterAttrs (_: v: v.enable);
};
_allFiles = mkOption {
type = types.package;
internal = true;
readOnly = true;
- default = (pkgs.callPackage ../lib/merge-files.nix {}) (attrValues file);
+ default = pkgs.symlinkJoin {
+ name = "kfmon-files";
+ paths = mapAttrsToList (v: v._package) cfg.file;
+ };
};
configs = mkOption {
@@ -44,16 +48,27 @@ in {
};
};
- config = {
- kfmon.file = mapAttrs' (n: v: {
- name = "kfmon-config-${n}";
- value = {
- text = generators.toINI {} v;
- target =
- let
- fixedN = if isSuffix ".ini" n then n else "${n}.ini";
- in "config/${fixedN}";
- };
- });
- };
-};
+ config = mkMerge [
+ {
+ kfmon.file = mapAttrs' (n: v: {
+ name = "kfmon-config-${n}";
+ value = {
+ text = generators.toINI {} v;
+ target =
+ let
+ fixedN = if isSuffix ".ini" n then n else "${n}.ini";
+ in "config/${fixedN}";
+ };
+ });
+ }
+ (mkIf cfg.enable {
+ koboroot.include = [
+ (pkgs.linkFarm [{
+ name = cfg.devicePath;
+ path = cfg._allFiles;
+ }])
+ cfg.package.KoboRoot
+ ];
+ })
+ ];
+}