jadb/flake.nix

116 lines
2.8 KiB
Nix

{
description = "A SQLite database containing open source japanese language translation data";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
jmdict-src = {
url = "http://ftp.edrdg.org/pub/Nihongo/JMdict.gz";
flake = false;
};
jmdict-with-examples-src = {
url = "http://ftp.edrdg.org/pub/Nihongo/JMdict_e_examp.gz";
flake = false;
};
radkfile-src = {
url = "http://ftp.usf.edu/pub/ftp.monash.edu.au/pub/nihongo/radkfile.gz";
flake = false;
};
kanjidic2-src = {
url = "http://nihongo.monash.edu/kanjidic2/kanjidic2.xml.gz";
flake = false;
};
};
outputs = {
self,
nixpkgs,
jmdict-src,
jmdict-with-examples-src,
radkfile-src,
kanjidic2-src
}: let
inherit (nixpkgs) lib;
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
"armv7l-linux"
];
forAllSystems = f: lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system});
in {
apps = forAllSystems (system: pkgs: {
default = let
inherit (self.packages.${system}) docs;
in {
type = "app";
program = "${pkgs.writeShellScript "host-docs" ''
${pkgs.python3} -m http.server -d ${docs}
''}";
};
});
devShells = forAllSystems (system: pkgs: {
default = pkgs.mkShell {
buildInputs = with pkgs; [
dart
gnumake
sqlite-interactive
sqlite-web
sqlint
sqlfluff
];
};
});
# defaultPackage.${system} = self.packages.${system}.database;
packages = let
edrdgMetadata = {
license = [{
shortName = "EDRDG";
fullName = "Electronic Dictionary Research and Development Group General Dictionary Licence";
url = "http://www.csse.monash.edu.au/~jwb/edrdg/licence.html";
}];
maintainers = [ lib.maintainers.h7x4 ];
platforms = lib.platforms.all;
};
src = lib.cleanSource ./.;
in forAllSystems (system: pkgs: {
default = self.packages.${system}.database;
jmdict = pkgs.callPackage ./nix/jmdict.nix {
inherit jmdict-src jmdict-with-examples-src edrdgMetadata;
};
radkfile = pkgs.callPackage ./nix/radkfile.nix {
inherit radkfile-src edrdgMetadata;
};
kanjidic2 = pkgs.callPackage ./nix/kanjidic2.nix {
inherit kanjidic2-src edrdgMetadata;
};
database-tool = pkgs.callPackage ./nix/database_tool.nix {
inherit src;
};
database = pkgs.callPackage ./nix/database.nix {
inherit (self.packages.${system}) database-tool jmdict radkfile kanjidic2;
inherit src;
};
docs = pkgs.callPackage ./nix/docs.nix {
inherit (self.packages.${system}) database;
};
});
};
}