flake.nix: add main executable as app
This commit is contained in:
parent
c98c0e04f2
commit
1f77fdeea9
@ -27,7 +27,7 @@ void addJadbArg(ArgParser argParser) {
|
||||
abbr: 'f',
|
||||
help: 'Path to the SQLite database file.',
|
||||
valueHelp: 'PATH',
|
||||
mandatory: true,
|
||||
defaultsTo: Platform.environment['JADB_PATH'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ class QueryKanji extends Command {
|
||||
|
||||
Future<void> run() async {
|
||||
if (argResults!.option('libsqlite') == null ||
|
||||
!argResults!.wasParsed('jadb')) {
|
||||
argResults!.option('jadb') == null) {
|
||||
print(argParser.usage);
|
||||
exit(64);
|
||||
}
|
||||
@ -115,7 +115,7 @@ class QueryWord extends Command {
|
||||
|
||||
Future<void> run() async {
|
||||
if (argResults!.option('libsqlite') == null ||
|
||||
!argResults!.wasParsed('jadb')) {
|
||||
argResults!.option('jadb') == null) {
|
||||
print(argParser.usage);
|
||||
exit(64);
|
||||
}
|
||||
|
32
flake.nix
32
flake.nix
@ -46,13 +46,32 @@
|
||||
forAllSystems = f: lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system});
|
||||
in {
|
||||
apps = forAllSystems (system: pkgs: {
|
||||
default = let
|
||||
inherit (self.packages.${system}) docs;
|
||||
in {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${pkgs.writeShellScript "host-docs" ''
|
||||
${pkgs.python3} -m http.server -d ${docs}
|
||||
''}";
|
||||
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}";
|
||||
};
|
||||
});
|
||||
|
||||
@ -68,6 +87,7 @@
|
||||
];
|
||||
env = {
|
||||
LIBSQLITE_PATH = "${pkgs.sqlite.out}/lib/libsqlite3.so";
|
||||
JADB_PATH = "result/jadb.sqlite";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user