diff --git a/flake.nix b/flake.nix index 7723128..d52cf16 100644 --- a/flake.nix +++ b/flake.nix @@ -51,82 +51,117 @@ platforms = lib.platforms.all; }; in forAllSystems (system: pkgs: { - jmdict = pkgs.stdenvNoCC.mkDerivation { + jmdict = pkgs.stdenvNoCC.mkDerivation (finalAttrs: { pname = "jmdict"; version = lib.fileContents ./jmdict/version.txt; + src = ./jmdict/jmdict.xml; dontUnpack = true; dontBuild = true; installPhase = '' runHook preInstall - install -Dm644 '${./jmdict/jmdict.xml}' "$out/JMdict.xml" + install -Dm644 "$src" "$out/JMdict.xml" runHook postInstall ''; + passthru = { + hash = lib.hashFile "sha256" finalAttrs.src; + date = lib.fileContents ./jmdict/version.txt; + }; + meta = edrdgMetadata // { description = "A Japanese-Multilingual Dictionary providing lexical data for japanese words"; homepage = "https://www.edrdg.org/jmdict/j_jmdict.html"; }; - }; + }); - kanjidic2 = pkgs.stdenvNoCC.mkDerivation { + kanjidic2 = pkgs.stdenvNoCC.mkDerivation (finalAttrs: { pname = "kanjidic2"; version = lib.fileContents ./kanjidic2/version.txt; + src = ./kanjidic2/kanjidic2.xml; dontUnpack = true; dontBuild = true; installPhase = '' runHook preInstall - install -Dm644 '${./kanjidic2/kanjidic2.xml}' "$out/kanjidic2.xml" + install -Dm644 "$src" "$out/kanjidic2.xml" runHook postInstall ''; + passthru = { + hash = lib.hashFile "sha256" finalAttrs.src; + date = lib.pipe ./kanjidic2/version.txt [ + lib.fileContents + (lib.splitString ".") + lib.head + ]; + }; + meta = edrdgMetadata // { description = "A consolidated XML-format kanji database"; homepage = "https://www.edrdg.org/kanjidic/kanjd2index_legacy.html"; }; - }; + }); - radkfile = pkgs.stdenvNoCC.mkDerivation { + radkfile = pkgs.stdenvNoCC.mkDerivation (finalAttrs: { pname = "radkfile"; version = lib.fileContents ./radkfile/version.txt; + src = ./radkfile/radkfile; dontUnpack = true; dontBuild = true; installPhase = '' runHook preInstall - install -Dm644 ${./radkfile/radkfile} "$out/RADKFILE" + install -Dm644 "$src" "$out/RADKFILE" runHook postInstall ''; + passthru = { + hash = lib.hashFile "sha256" finalAttrs.src; + date = lib.fileContents ./radkfile/version.txt; + }; + meta = edrdgMetadata // { description = "A file providing searchable decompositions of kanji characters"; homepage = "https://www.edrdg.org/krad/kradinf.html"; }; - }; + }); - tanos-jlpt = pkgs.stdenvNoCC.mkDerivation { + tanos-jlpt = pkgs.stdenvNoCC.mkDerivation (finalAttrs: { pname = "tanos-jlpt"; version = "2011"; + src = ./tanos-jlpt; dontUnpack = true; dontBuild = true; installPhase = '' runHook preInstall - for f in ${./tanos-jlpt}/*.csv; do + for f in "$src"/*.csv; do install -Dm644 -t "$out" "$f" done runHook postInstall ''; + passthru = { + hash = lib.pipe finalAttrs.src [ + lib.readDir + lib.attrNames + (lib.filter (lib.hasSuffix ".csv")) + (map (filename: lib.hashFile "sha256" /${finalAttrs.src}/${filename})) + (lib.concatStringsSep "") + (lib.hashString "sha256") + ]; + date = "2011"; + }; + meta = { description = "A CSV file containing JLPT-rated Japanese vocabulary"; homepage = "https://www.tanos.co.uk/jlpt/"; @@ -134,7 +169,7 @@ maintainers = [ lib.maintainers.h7x4 ]; platforms = lib.platforms.all; }; - }; + }); }); }; }