{ description = "A SQLite database containing open source japanese language translation data"; inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; datasources = { url = "git+https://git.pvv.ntnu.no/Mugiten/datasources.git"; inputs.nixpkgs.follows = "nixpkgs"; }; kanjivg-src = { url = "git+https://git.pvv.ntnu.no/mugiten/kanjivg.git"; flake = false; }; }; outputs = { self, nixpkgs, datasources, kanjivg-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 = { type = "app"; program = let script = pkgs.writeShellApplication { name = "jadb-tool"; runtimeEnv = { JADB_PATH = "${self.packages.${system}.database}/jadb.sqlite"; LIBSQLITE_PATH = "${pkgs.sqlite.out}/lib/libsqlite3.so"; }; text = '' ${lib.getExe self.packages.${system}.database-tool} "$@" ''; }; in lib.getExe script; }; docs = { type = "app"; program = let inherit (self.packages.${system}) docs; script = pkgs.writeShellScript "host-docs" '' ${pkgs.python3} -m http.server -d ${docs} ''; in "${script}"; }; }); devShells = forAllSystems (system: pkgs: { default = pkgs.mkShell { packages = with pkgs; [ dart gnumake lcov sqldiff sqlite-interactive ]; env = { LIBSQLITE_PATH = "${pkgs.sqlite.out}/lib/libsqlite3.so"; JADB_PATH = "result/jadb.sqlite"; LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.sqlite ]; }; }; sqlite-debugging = pkgs.mkShell { packages = with pkgs; [ sqlite-interactive sqlite-analyzer sqlite-web # sqlint sqlfluff ]; }; }); 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 = builtins.filterSource (path: type: let baseName = baseNameOf (toString path); in !(lib.any (b: b) [ (!(lib.cleanSourceFilter path type)) (baseName == ".github" && type == "directory") (baseName == ".gitea" && type == "directory") (baseName == "nix" && type == "directory") (baseName == ".envrc" && type == "regular") (baseName == "flake.lock" && type == "regular") (baseName == "flake.nix" && type == "regular") (baseName == ".sqlfluff" && type == "regular") ])) ./.; in forAllSystems (system: pkgs: { default = self.packages.${system}.database; filteredSource = pkgs.runCommandLocal "filtered-source" { } '' ln -s ${src} $out ''; inherit (datasources.packages.${system}) jmdict radkfile kanjidic2; database-tool = pkgs.callPackage ./nix/database_tool.nix { inherit src; }; database = pkgs.callPackage ./nix/database.nix { inherit (datasources.packages.${system}) jmdict radkfile kanjidic2 tanos-jlpt; inherit (self.packages.${system}) database-tool; inherit src; }; database-wal = pkgs.callPackage ./nix/database.nix { inherit (datasources.packages.${system}) jmdict radkfile kanjidic2 tanos-jlpt; inherit (self.packages.${system}) database-tool; inherit src; wal = true; }; docs = pkgs.callPackage ./nix/docs.nix { inherit (self.packages.${system}) database; }; }); }; }