add a flask server

This commit is contained in:
Prunebutt 2025-09-26 00:26:43 +02:00
parent e1a7632b40
commit f672c6c706
3 changed files with 88 additions and 5 deletions

View file

@ -7,14 +7,53 @@
nixpkgs,
} @ inputs: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; config.allowUnfree = true;};
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in {
packages."${system}".default = pkgs.writeShellApplication {
name = "hello_world";
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
python313
python313Packages.flask
python313Packages.waitress
];
runtimeInputs = with pkgs; [sane-backends brscan5 ghostscript];
shellHook = ''
python --version
exec zsh
'';
};
packages.${system} = let
scanbuddy = pkgs.writeShellApplication {
name = "scanbuddy-script";
text = builtins.readFile ./scanbuddy.bash;
runtimeInputs = with pkgs; [sane-backends brscan5 ghostscript];
text = builtins.readFile ./scanbuddy.bash;
};
wrapper = pkgs.writeShellApplication {
name = "scanbuddy-wrapper";
text =
/*
bash
*/
''
#!/usr/bin/env bash
readarray -d '_' args < <(printf "%s" "$1")
scanbuddy "''${args[@]}"
'';
};
package = pkgs.symlinkJoin {
name = "scanbuddy";
paths = [scanbuddy wrapper];
};
in {
default = package;
inherit scanbuddy;
inherit wrapper;
};
};
}