jadb/flake.nix

130 lines
3.1 KiB
Nix
Raw Normal View History

2022-06-20 20:06:07 +02:00
{
description = "A SQLite database containing open source japanese language translation data";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
2022-06-20 20:06:07 +02:00
nix-dart = {
url = "github:tadfisher/nix-dart";
inputs.nixpkgs.follows = "nixpkgs";
2022-06-20 20:06:07 +02:00
};
jmdict-src = {
2022-06-20 20:06:07 +02:00
url = "http://ftp.edrdg.org/pub/Nihongo/JMdict.gz";
flake = false;
};
jmdict-with-examples-src = {
2022-06-20 20:06:07 +02:00
url = "http://ftp.edrdg.org/pub/Nihongo/JMdict_e_examp.gz";
flake = false;
};
radkfile-src = {
2022-06-20 20:06:07 +02:00
url = "http://ftp.usf.edu/pub/ftp.monash.edu.au/pub/nihongo/radkfile.gz";
flake = false;
};
kanjidic2-src = {
2022-08-18 21:39:36 +02:00
url = "http://nihongo.monash.edu/kanjidic2/kanjidic2.xml.gz";
flake = false;
};
2022-06-20 20:06:07 +02:00
};
outputs = {
self,
nixpkgs,
nix-dart,
jmdict-src,
jmdict-with-examples-src,
radkfile-src,
kanjidic2-src
2022-06-20 20:06:07 +02:00
}: let
inherit (nixpkgs) lib;
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
"armv7l-linux"
];
forAllSystems = f: lib.genAttrs systems (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
nix-dart.overlay
];
};
in f system pkgs);
2022-06-20 20:06:07 +02:00
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; [
nix-dart.packages.${system}.pub2nix-lock
dart
gnumake
sqlite-interactive
sqlite-web
sqlint
sqlfluff
];
};
});
2022-06-20 20:06:07 +02:00
# defaultPackage.${system} = self.packages.${system}.database;
2022-06-20 20:06:07 +02:00
packages = let
2022-06-20 20:06:07 +02:00
edrdgMetadata = {
license = [{
2022-06-20 20:06:07 +02:00
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 ];
2022-06-20 20:06:07 +02:00
platforms = lib.platforms.all;
};
src = lib.cleanSource ./.;
in forAllSystems (system: pkgs: {
default = self.packages.${system}.database;
2022-06-20 20:06:07 +02:00
jmdict = pkgs.callPackage ./nix/jmdict.nix {
inherit jmdict-src jmdict-with-examples-src edrdgMetadata;
2022-06-20 20:06:07 +02:00
};
radkfile = pkgs.callPackage ./nix/radkfile.nix {
inherit radkfile-src edrdgMetadata;
2022-06-20 20:06:07 +02:00
};
kanjidic2 = pkgs.callPackage ./nix/kanjidic2.nix {
inherit kanjidic2-src edrdgMetadata;
2022-08-18 21:39:36 +02:00
};
database-tool = pkgs.callPackage ./nix/database_tool.nix {
inherit nix-dart src;
2022-06-20 20:06:07 +02:00
};
database = pkgs.callPackage ./nix/database.nix {
inherit (self.packages.${system}) database-tool jmdict radkfile kanjidic2;
inherit src;
2022-06-20 20:06:07 +02:00
};
2022-08-23 18:13:58 +02:00
docs = pkgs.callPackage ./nix/docs.nix {
inherit (self.packages.${system}) database;
};
});
2022-06-20 20:06:07 +02:00
};
}