aboutsummaryrefslogtreecommitdiff
path: root/pkgs/plato.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/plato.nix')
-rw-r--r--pkgs/plato.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/pkgs/plato.nix b/pkgs/plato.nix
new file mode 100644
index 0000000..815ac76
--- /dev/null
+++ b/pkgs/plato.nix
@@ -0,0 +1,46 @@
+{ stdenvNoCC
+, formats
+, runCommand
+, writeScript
+, lib
+
+, platoSrc
+, platoSettings ? {}
+, platoCfg ? ""
+, dictionaries ? []
+, fonts ? []
+, ... }:
+with builtins // lib;
+stdenvNoCC.mkDerivation (finalAttrs: {
+ name = "plato";
+
+ src = platoSrc;
+
+ dontFix = true;
+ dontPatch = true;
+ dontConfigure = true;
+ dontBuild = true;
+
+ installPhase = ''
+ mkdir -p $out
+ cp -rv . $out
+
+ # mkdir -p $out/.adds/plato/dictionaries
+ for d in ${concatMapStringsSep " " toString dictionaries}; do
+ find $d/share/dictd/ -type f -regex '.*\.\(dict\(\.dz\)?\|index\)' -exec cp -v {} $out/.adds/plato/dictionaries/ \;
+ done
+
+ for d in ${concatMapStringsSep " " toString fonts}; do
+ find $d/share/fonts/truetype/ -type f -regex '.*\.\(ttf\|otf\)' -exec cp -v {} $out/.adds/plato/fonts/ \;
+ done
+
+ ${optionalString (platoSettings != {}) ''
+ cp -v ${(formats.toml {}).generate "Settings.toml" platoSettings} $out/.adds/plato/Settings.toml
+ ''}
+ ${optionalString (platoCfg != "") ''
+ cp -v ${writeScript "config.sh" platoCfg} $out/.adds/plato/config.sh
+ ''}
+ ''
+ ;
+
+})