From 5cb16c34a8c5b803ec723934c1dc828c0e8e3bad Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Tue, 10 Sep 2024 11:52:55 -0500 Subject: Trying to get everything to actually work --- modules/kfmon/default.nix | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) (limited to 'modules/kfmon/default.nix') 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 + ]; + }) + ]; +} -- cgit v1.2.3