From 4f471484b3a1e16230979a8406503a220b9101f4 Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Tue, 10 Sep 2024 14:51:28 -0500 Subject: I think this is almost working! --- modules/kobo/default.nix | 52 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 15 deletions(-) (limited to 'modules/kobo/default.nix') diff --git a/modules/kobo/default.nix b/modules/kobo/default.nix index cdf9728..48bca11 100644 --- a/modules/kobo/default.nix +++ b/modules/kobo/default.nix @@ -21,22 +21,45 @@ in { default = "/mnt/onboard/${cfg.path}"; }; - file = mkOption { - default = {}; - type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {})); - apply = filterAttrs (_: v: v.enable); + _createdFiles = mkOption { + type = types.package; + internal = true; + readOnly = true; + default = pkgs.buildEnv { + name = "kobo-files-created"; + paths = mapAttrsToList (_: v: v._package) cfg.file; + extraPrefix = cfg.devicePath; + }; }; - _allFiles = mkOption { + finalPackage = mkOption { type = types.package; - readOnly = true; internal = true; - default = pkgs.symlinkJoin { - name = "kobo-files"; - paths = mapAttrsToList (v: v._package) cfg.file; + readOnly = true; + default = pkgs.mergePaths { + name = "kobo-package"; + paths = [ + cfg._createdFiles + ]; }; }; + file = mkOption { + default = {}; + type = types.attrsOf (types.submodule (pkgs.callPackage ../lib/file-type.nix {})); + apply = filterAttrs (_: v: v.enable); + }; + + # _allFiles = mkOption { + # type = types.package; + # readOnly = true; + # internal = true; + # default = pkgs.symlinkJoin { + # name = "kobo-files"; + # paths = mapAttrsToList (v: v._package) cfg.file; + # }; + # }; + conf = mkOption { type = ini.type; default = {}; @@ -55,16 +78,15 @@ in { }; }; - file = mkIf (cfg.conf != {}) { - "Kobo eReader.conf".text = generators.toINI {} cfg.conf; + file = { + "Kobo eReader.conf" = mkIf (cfg.conf != {}) { + text = generators.toINI {} cfg.conf; + }; }; }; } (mkIf cfg.enable { - koboroot.include = singleton (pkgs.linkFarm [{ - name = cfg.devicePath; - path = cfg._allFiles; - }]); + koboroot.include = singleton cfg.finalPackage; }) ]; } -- cgit v1.2.3