diff options
Diffstat (limited to 'modules/main.nix')
| -rw-r--r-- | modules/main.nix | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/modules/main.nix b/modules/main.nix index b568efa..974f599 100644 --- a/modules/main.nix +++ b/modules/main.nix @@ -17,32 +17,49 @@ with builtins // lib; with types; nullOr <| enum [ + "raw" "kobo" "pocketbook" ]; default = null; }; basePackage = mkOption { - type = types.package; + type = types.path; }; koreaderPath = mkOption { type = types.str; }; + finalPackage = mkOption { + type = types.package; + readOnly = true; + default = pkgs.runCommandLocal "merge" { nativeBuildInputs = [ pkgs.rsync ]; } '' + RSYNC="rsync -a --copy-links -v" + + $RSYNC "${config.koreader.basePackage}/" "$out/" + $RSYNC "${config._files}/" "$out/${config.koreaderPath}/" + ''; + }; }; }; config = mkMerge [ (mkIf (config.koreader.flavor == "kobo") { koreader = { - basePackage = mkOptionDefault pkgs.koreader-kobo; + basePackage = mkOptionDefault <| pkgs.callPackage ../pkgs/kobo.nix { }; koreaderPath = mkOptionDefault ".adds/koreader"; }; }) (mkIf (config.koreader.flavor == "pocketbook") { koreader = { - basePackage = mkOptionDefault pkgs.koreader-pocketbook; + basePackage = mkOptionDefault <| pkgs.callPackage ../pkgs/pocketbook.nix { }; koreaderPath = mkOptionDefault "applications/koreader"; }; }) + (mkIf (config.koreader.flavor == "raw") { + koreader = { + basePackage = mkOptionDefault <| pkgs.runCommandLocal "raw" { } "mkdir $out"; + koreaderPath = mkOptionDefault ""; + }; + }) ]; } |
