flake.nix: make update scripts runnable with nix run
This commit is contained in:
25
flake.nix
25
flake.nix
@@ -15,6 +15,31 @@
|
||||
|
||||
forAllSystems = f: lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system});
|
||||
in {
|
||||
apps = forAllSystems (system: pkgs: let
|
||||
wrapUpdateScript = name: path: {
|
||||
type = "app";
|
||||
meta.description = "A script to update the ${name} data";
|
||||
program = let
|
||||
drv = pkgs.writeShellApplication {
|
||||
name = "update-${name}";
|
||||
text = lib.readFile path;
|
||||
runtimeInputs = lib.pipe path [
|
||||
lib.readFile
|
||||
(lib.splitString "\n")
|
||||
(x: lib.elemAt x 1)
|
||||
(lib.splitString " ")
|
||||
(lib.drop 4) # "#!nix-shell -i bash -p"
|
||||
(map (dep: pkgs.${dep}))
|
||||
];
|
||||
};
|
||||
in lib.getExe drv;
|
||||
};
|
||||
in {
|
||||
update-jmdict = wrapUpdateScript "jmdict" ./scripts/update-jmdict.sh;
|
||||
update-kanjidic2 = wrapUpdateScript "kanjidic2" ./scripts/update-kanjidic2.sh;
|
||||
update-radkfile = wrapUpdateScript "radkfile" ./scripts/update-radkfile.sh;
|
||||
});
|
||||
|
||||
packages = let
|
||||
edrdgMetadata = {
|
||||
license = [{
|
||||
|
||||
Reference in New Issue
Block a user