diff --git a/.drone.yml b/.drone.yml index 788c052..0987ec2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -52,3 +52,19 @@ steps: pull: always commands: - cd tools && cargo test + +--- + +kind: pipeline +name: dictionary verification +workspace: + base: /lewa + +steps: + - name: build dictionary files + image: "monacoremo/nix:2020-04-05-05f09348-circleci" + pull: always + commands: + - nix-env -if ./nix/dhall.nix + - cd words + - dhall ./dictionary.dhall diff --git a/nix/dhall-json.nix b/nix/dhall-json.nix new file mode 100644 index 0000000..06c4db4 --- /dev/null +++ b/nix/dhall-json.nix @@ -0,0 +1,24 @@ +{ pkgs ? import {} }: + +pkgs.stdenv.mkDerivation rec { + name = "dhall-json-simple"; + + src = pkgs.fetchurl { + url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.32.0/dhall-json-1.6.4-x86_64-linux.tar.bz2"; + sha256 = "1qd2nfmwgdmffwjmvcs2cjm1jkqkv7mi8hf3lcvsx3gjcc2mv3jw"; + }; + + installPhase = '' + mkdir -p $out/bin + DHALL_TO_JSON=$out/bin/dhall-to-json + DHALL_TO_YAML=$out/bin/dhall-to-yaml + JSON_TO_DHALL=$out/bin/json-to-dhall + install -D -m555 -T dhall-to-json $DHALL_TO_JSON + install -D -m555 -T dhall-to-yaml $DHALL_TO_YAML + install -D -m555 -T json-to-dhall $JSON_TO_DHALL + mkdir -p $out/etc/bash_completion.d/ + $DHALL_TO_JSON --bash-completion-script $DHALL_TO_JSON > $out/etc/bash_completion.d/dhall-to-json-completion.bash + $DHALL_TO_YAML --bash-completion-script $DHALL_TO_YAML > $out/etc/bash_completion.d/dhall-to-yaml-completion.bash + $JSON_TO_DHALL --bash-completion-script $JSON_TO_DHALL > $out/etc/bash_completion.d/json-to-dhall-completion.bash + ''; +} diff --git a/nix/dhall.nix b/nix/dhall.nix new file mode 100644 index 0000000..66a5549 --- /dev/null +++ b/nix/dhall.nix @@ -0,0 +1,18 @@ +{ pkgs ? import {} }: + +pkgs.stdenv.mkDerivation rec { + name = "dhall-simple"; + + src = pkgs.fetchurl { + url = "https://github.com/dhall-lang/dhall-haskell/releases/download/1.32.0/dhall-1.32.0-x86_64-linux.tar.bz2"; + sha256 = "0p7j7msik1sgg287yrkp2si2fvw8lrsxy3lhc2xaxxa8d9y9k5aq"; + }; + + installPhase = '' + mkdir -p $out/bin + DHALL=$out/bin/dhall + install -D -m555 -T dhall $DHALL + mkdir -p $out/etc/bash_completion.d/ + $DHALL --bash-completion-script $DHALL > $out/etc/bash_completion.d/dhall-completion.bash + ''; +} diff --git a/shell.nix b/shell.nix index fb60e72..b7e7e4a 100644 --- a/shell.nix +++ b/shell.nix @@ -5,6 +5,8 @@ let "https://github.com/nix-community/NUR/archive/master.tar.gz") { inherit pkgs; }; + dhall = pkgs.callPackage ./nix/dhall.nix { }; + dhall-json = pkgs.callPackage ./nix/dhall-json.nix { }; dyson = pkgs.callPackage ./nix/dyson.nix { }; tex = pkgs.callPackage ./nix/texlive.nix { }; in pkgs.mkShell { @@ -23,6 +25,15 @@ in pkgs.mkShell { # preview nur.repos.xe.zathura + # dhall + dhall + dhall-json + + # deno + nur.repos.xe.deno + nodePackages.typescript + nodePackages.typescript-language-server + # rust cargo cargo-watch diff --git a/words/dictionary.dhall b/words/dictionary.dhall new file mode 100644 index 0000000..f73be64 --- /dev/null +++ b/words/dictionary.dhall @@ -0,0 +1,13 @@ +let ContentWord = ./types/ContentWord.dhall + +let ParticleWord = ./types/ParticleWord.dhall + +in { rootWords = + [ ./roots/lewa.dhall + , ./roots/madsa.dhall + , ./roots/qate.dhall + , ./roots/spalo.dhall + , ./roots/zasko.dhall + ] + , particles = [] : List ParticleWord.Type + } diff --git a/words/roots/lewa.dhall b/words/roots/lewa.dhall new file mode 100644 index 0000000..82e526c --- /dev/null +++ b/words/roots/lewa.dhall @@ -0,0 +1,7 @@ +let ContentWord = ../types/ContentWord.dhall + +in ContentWord::{ + , word = "l'ewa" + , gloss = "language" + , definition = "is a language" + } diff --git a/words/roots/madsa.dhall b/words/roots/madsa.dhall new file mode 100644 index 0000000..047d102 --- /dev/null +++ b/words/roots/madsa.dhall @@ -0,0 +1,7 @@ +let ContentWord = ../types/ContentWord.dhall + +in ContentWord::{ + , word = "madsa" + , gloss = "eat" + , definition = "eats/is eating/to eat" + } diff --git a/words/roots/qate.dhall b/words/roots/qate.dhall new file mode 100644 index 0000000..2cf4b28 --- /dev/null +++ b/words/roots/qate.dhall @@ -0,0 +1,7 @@ +let ContentWord = ../types/ContentWord.dhall + +in ContentWord::{ + , word = "qa'te" + , gloss = "fast" + , definition = "is fast/rapid in rate" + } diff --git a/words/roots/spalo.dhall b/words/roots/spalo.dhall new file mode 100644 index 0000000..bdbbaae --- /dev/null +++ b/words/roots/spalo.dhall @@ -0,0 +1,3 @@ +let ContentWord = ../types/ContentWord.dhall + +in ContentWord::{ word = "spalo", gloss = "apple", definition = "is an apple" } diff --git a/words/roots/zasko.dhall b/words/roots/zasko.dhall new file mode 100644 index 0000000..5c2a364 --- /dev/null +++ b/words/roots/zasko.dhall @@ -0,0 +1,7 @@ +let ContentWord = ../types/ContentWord.dhall + +in ContentWord::{ + , word = "zasko" + , gloss = "plant" + , definition = "is a plant/is vegetation" + } diff --git a/words/types/ContentWord.dhall b/words/types/ContentWord.dhall new file mode 100644 index 0000000..5c8c564 --- /dev/null +++ b/words/types/ContentWord.dhall @@ -0,0 +1,5 @@ +{ Type = + { word : Text, gloss : Text, definition : Text, usageExamples : List Text } +, default = + { word = "", gloss = "", definition = "", usageExamples = [] : List Text } +} diff --git a/words/types/ParticleWord.dhall b/words/types/ParticleWord.dhall new file mode 100644 index 0000000..fd523ea --- /dev/null +++ b/words/types/ParticleWord.dhall @@ -0,0 +1,15 @@ +{ Type = + { word : Text + , gloss : Text + , definition : Text + , family : Text + , usageExamples : List Text + } +, default = + { word = "" + , gloss = "" + , definition = "" + , family = "" + , usageExamples = [] : List Text + } +} diff --git a/words/utils/showContentWord.dhall b/words/utils/showContentWord.dhall new file mode 100644 index 0000000..42cae5a --- /dev/null +++ b/words/utils/showContentWord.dhall @@ -0,0 +1,14 @@ +let ContentWord = ../types/ContentWord.dhall + +let render + : ContentWord.Type → Text + = λ(word : ContentWord.Type) → + '' + ### ${word.word} + + *${word.gloss}* + + ${word.definition} + '' + +in render