aboutsummaryrefslogtreecommitdiff
path: root/modules/redux
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2024-01-25 11:26:31 -0600
committerChris Wells <chris@mathematicaster.org>2024-01-25 11:26:31 -0600
commit45156e2bdb359c22398f8c7a60fb729ad168786a (patch)
treee8e8ca1e9a1b4505df1187028091f9cf2b173ef9 /modules/redux
parentd6949fe35c1b4c7a9e93d1430e5c1b1d5dd4d9c6 (diff)
downloadkobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.gz
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.bz2
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.lz
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.xz
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.tar.zst
kobo-manager-45156e2bdb359c22398f8c7a60fb729ad168786a.zip
This distribution is coming together
Diffstat (limited to 'modules/redux')
-rw-r--r--modules/redux/builder.nix11
-rw-r--r--modules/redux/file.nix44
-rw-r--r--modules/redux/kfmon.nix30
-rw-r--r--modules/redux/koreader.nix42
-rw-r--r--modules/redux/nickle.nix41
-rw-r--r--modules/redux/plato.nix179
6 files changed, 0 insertions, 347 deletions
diff --git a/modules/redux/builder.nix b/modules/redux/builder.nix
deleted file mode 100644
index 5f74a1e..0000000
--- a/modules/redux/builder.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{ pkgs, lib, ... }:
-with builtins // lib;
-{
- copyFile = { source, directory, executable, target, ... }: ''
- cp -${if directory then "r" else ""}v "${source}" "${target}"
-
- ${optionalString (isBool executable) ''
- chmod ${if executable then "+" else "-"}x "${target}"
- ''}
- '';
-}
diff --git a/modules/redux/file.nix b/modules/redux/file.nix
deleted file mode 100644
index e05318d..0000000
--- a/modules/redux/file.nix
+++ /dev/null
@@ -1,44 +0,0 @@
-{ config, pkgs, lib, ... }:
-with builtins // lib;
-let
- cfg = config.file;
-in {
- options.file = mkOption {
- default = {};
- type = with types; lazyAttrsOf (submodule ({ name, config, ... }: {
- options = {
- enable = mkEnableOption name // { default = true; };
- target = mkOption {
- type = types.str;
- default = name;
- };
- executable = mkOption {
- type = with types; nullOr bool;
- default = null;
- };
- directory = mkOption {
- type = types.bool;
- default = false;
- description = "Enable this if the source file is a directory";
- };
- source = mkOption {
- type = types.path;
- };
- text = mkOption {
- type = with types; nullOr lines;
- default = null;
- };
- };
-
- config = mkMerge [
- (mkIf (config.text != null) {
- directory = false;
- source = pkgs.writeText name config.text;
- })
- (mkIf (config.text == "") {
- enable = false;
- })
- ];
- }));
- };
-}
diff --git a/modules/redux/kfmon.nix b/modules/redux/kfmon.nix
deleted file mode 100644
index 772a10b..0000000
--- a/modules/redux/kfmon.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ config, pkgs, lib, options, ... }:
-with builtins // lib;
-let
- cfg = config.kfmon;
-in {
- options.kfmon = {
- enable = mkEnableOption "KFMon";
-
- path = mkOption {
- type = types.str;
- default = ".adds/kfmon";
- description = "Relative path to kfmon within src";
- };
-
- file = mkOption {
- type = options.file.type;
- default = {};
- description = "Files relative to ${cfg.path}";
- };
- };
-
- config = mkIf cfg.enable {
- file = mapAttrs' (n: v: {
- name = "kfmon-${n}";
- value = v // {
- target = "${cfg.path}/${v.target}";
- };
- }) cfg.file
- };
-}
diff --git a/modules/redux/koreader.nix b/modules/redux/koreader.nix
deleted file mode 100644
index 1c885a8..0000000
--- a/modules/redux/koreader.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ config, pkgs, lib, options, ... }:
-with builtins // lib;
-let
- cfg = config.koreader;
-in {
- options.koreader = {
- enable = mkEnableOption "KOReader";
-
- path = mkOption {
- type = types.str;
- default = ".adds/koreader";
- description = "Relative path to KOReader within src";
- };
-
- nickleEntry = mkEnableOption "Launch KOReader directly via NickleMenu";
-
- file = mkOption {
- type = options.file.type;
- default = {};
- description = "Files relative to ${cfg.path}";
- };
- };
-
- config = mkIf cfg.enable {
- file = mapAttrs' (n: v: {
- name = "koreader-${n}";
- value = v // {
- target = "${cfg.path}/${v.target}";
- };
- }) cfg.file
-
- nickle.menuItems = mkIf cfg.nickleEntry {
- "koreader" = [
- "main"
- "KOReader"
- "cmd_spawn"
- "quiet"
- "exec /mnt/onboard/${cfg.path}/koreader.sh"
- ];
- };
- };
-}
diff --git a/modules/redux/nickle.nix b/modules/redux/nickle.nix
deleted file mode 100644
index b08a6ec..0000000
--- a/modules/redux/nickle.nix
+++ /dev/null
@@ -1,41 +0,0 @@
-{ config, pkgs, lib, options, ... }:
-with builtins // lib;
-let
- cfg = config.nickle;
-in {
- options.nickle = {
- enable = mkEnableOption "NickleMenu";
-
- path = mkOption {
- type = types.str;
- default = ".adds/nm";
- description = "Relative path to NickleMenu within src";
- };
-
- file = mkOption {
- type = options.file.type;
- default = {};
- description = "Files relative to ${cfg.path}";
- };
-
- menuItems = mkOption {
- type = with types; attrsOf (listOf str);
- default = {};
- };
- };
-
- config = mkIf cfg.enable {
- nickle = {
- file = mapAttrs (_: v: {
- text = concatStringsSep " : " ([ "menu_item" ] ++ v)
- }) cfg.menuItems
- };
-
- file = mapAttrs' (n: v: {
- name = "nm-${n}";
- value = v // {
- target = "${cfg.path}/${v.target}";
- };
- }) cfg.file
- };
-}
diff --git a/modules/redux/plato.nix b/modules/redux/plato.nix
deleted file mode 100644
index 6735133..0000000
--- a/modules/redux/plato.nix
+++ /dev/null
@@ -1,179 +0,0 @@
-{ config, pkgs, lib, options, ... }:
-with builtins // lib;
-let
- cfg = config.plato;
- toml = pkgs.formats.toml {};
-in {
- imports = [
- ./nickle.nix
- ];
-
- options.plato = {
- enable = mkEnableOpiton "Plato";
-
- path = mkOption {
- type = types.srt;
- default = ".adds/plato";
- description = "Relative path to Plato within src";
- };
-
- file = mkOption {
- type = options.file.type;
- default = {};
- description = "Files relative to ${cfg.path}";
- };
-
- nickleEntry = mkEnableOption "Launch Plato directly from NickleMenu";
-
- config = mkOption {
- type = types.lines;
- default = "";
- description = "Plato config.sh";
- };
-
- hyphenation = mkEnableOption "hyphenation" // { default = true; };
-
- convertDictionaries = mkEnableOption "convert StarDict" // { default = true; };
-
- setFramebufferDepth = mkEnableOption "set framebuffer's depth" // { default = true; };
-
- settings = mkOption {
- type = toml.type;
- default = {};
- description = "Plato Settings.toml";
- };
-
- css = mkOption {
- default = {};
- type = with types; attrsOf lines;
- description = ''
- css style sheets.
- Only use this for epub-user dictionary-user html-user
- '';
- };
-
- scripts = mkOption {
- default = {};
- type = with types; attrsOf lines;
- description = ''
- Only use this for wifi-post-up wifi-post-down wifi-pre-up wifi-pre-down.
- '';
- # apply = mapAttrs (_: text: ''
- # #!/bin/sh
-
- # ${text}
- # '')
- };
-
- dictionaries = mkOption {
- type = with types; listOf package;
- default = [];
- };
-
- allDictionaries = mkOption {
- type = types.package;
- readOnly = true;
- internal = true;
- default = pkgs.runCommand "PlatoDictionaries" {} (''
- mkdir -p $out
- '' + concatMapStringsSep "\n" (pkg: ''
- find ${pkg}/share/dictd/ -type f -regex '.*\.\(dict\(\.dz\)?\|index\)' -exec cp -v {} $out/ \;
- '') cfg.dictionaries
- );
-
- };
-
- fonts = mkOption {
- type = with types; listOf package;
- default = [];
- };
-
- allFonts = mkOption {
- type = types.package;
- readOnly = true;
- internal = true;
- default = pkgs.runCommand "PlatoFonts" {} (''
- mkdir -p $out
- '' + concatMapStringsSep "\n" (pkg: ''
- find ${pkg}/share/fonts/truetype/ -type f -regex '.*\.\(ttf\|otf\)' -exec cp -v {} $out/ \;
- '') cfg.fonts
- );
-
- };
- };
-
- config = mkIf cfg.enable {
- plato = {
- config = concatStringsSep "\n\n" (
- optional (!cfg.convertDictionaries) ''
- unset PLATO_CONVERT_DICTIONARIES
- ''
- ++
- optional (!cfg.setFramebufferDepth) ''
- unset PLATO_SET_FRAMEBUFFER_DEPTH
- ''
- ++
- optional (!cfg.hyphenation) ''
- [ -d hyphenation-patterns ] && rm -rf hyphenation-patterns
- ''
- );
- file = mkMerge [
- (mkIf (cfg.settings != {}) {
- "Settings.toml".source = toml.generate "Settings.toml" cfg.settings;
- })
-
- (mkIf (cfg.config != "") {
- "config.sh".text = cfg.config;
- })
-
- (mapAttrs' (n: text:
- let
- n1 = if hasPrefix "css/" n then n else "css/${n}";
- name = if hasSuffix ".css" n1 then n1 else "{n1}.css";
- in {
- inherit name;
- value = { inherit text; }
- }) cfg.css)
-
- (mapAttrs' (n: t:
- let
- n1 = if hasPrefix "scripts/" n then n else "scripts/${n}";
- name = if hasSuffix ".sh" n1 then n1 else "${n1}.sh";
- text = if hasPrefix "#!/" t then t else "#!/bin/sh\n\n${t}";
- in {
- inherit name;
- value = { inherit text; };
- }) cfg.scripts)
-
- {
- dictionaries = {
- directory = true;
- source = cfg.allDictionaries;
- };
- fonts = {
- directory = true;
- source = cfg.allFonts;
- };
- }
- ];
- };
-
- file = mapAttrs' (n: v: {
- name = "plato-${n}";
- value = v // {
- target = "${cfg.path}/${v.target}";
- };
- }) cfg.file;
-
- nickle.menuItems = mkIf cfg.nickleEntry {
- "plato" = [
- "main"
- "Plato"
- "cmd_spawn"
- "quiet"
- "exec /mnt/onboard/${cfg.path}/plato.sh"
- ];
- }
-
- };
-}