mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(bbuddy): evdev barcode scanner client
This commit is contained in:
parent
c3cd9b0564
commit
90901a302c
24 changed files with 847 additions and 253 deletions
|
|
@ -6,16 +6,18 @@
|
|||
}: let
|
||||
inherit (lib.strings) removePrefix;
|
||||
inherit (lib.trivial) importJSON;
|
||||
lock = importJSON ../flake.lock;
|
||||
lock = importJSON ../../flake.lock;
|
||||
inherit (lock.nodes) barcodebuddy;
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "barcodebuddy";
|
||||
version = removePrefix "v" barcodebuddy.original.ref;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
inherit (barcodebuddy.locked) repo owner rev;
|
||||
sha256 = barcodebuddy.locked.narHash;
|
||||
};
|
||||
|
||||
skipConfigure = true;
|
||||
skipBuild = true;
|
||||
|
||||
|
|
@ -27,4 +29,9 @@ in
|
|||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/Forceu/barcodebuddy";
|
||||
license = lib.licenses.agpl3Plus;
|
||||
};
|
||||
}
|
||||
47
packages/barcodebuddy/scanner-python.nix
Normal file
47
packages/barcodebuddy/scanner-python.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
stdenvNoCC,
|
||||
makeWrapper,
|
||||
barcodebuddy,
|
||||
barcodebuddy-scanner,
|
||||
screen,
|
||||
lib,
|
||||
enableRequests ? true,
|
||||
enablePhp ? false,
|
||||
php,
|
||||
python3,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.lists) optional optionals;
|
||||
inherit (lib.strings) makeBinPath;
|
||||
python = python3.withPackages (
|
||||
p:
|
||||
[p.evdev]
|
||||
++ optional enableRequests p.requests
|
||||
);
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "barcodebuddy-scanner.py";
|
||||
inherit (barcodebuddy) version src;
|
||||
inherit (barcodebuddy-scanner) patches meta;
|
||||
|
||||
skipConfigure = true;
|
||||
skipBuild = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [python];
|
||||
|
||||
scannerPath = makeBinPath (
|
||||
optionals enablePhp [screen php]
|
||||
);
|
||||
${
|
||||
if enablePhp
|
||||
then "barcodebuddyScript"
|
||||
else null
|
||||
} = "${barcodebuddy}/index.php";
|
||||
|
||||
scannerSource = "example/grabInput.py";
|
||||
inherit (barcodebuddy-scanner) installPhase postInstall;
|
||||
}
|
||||
63
packages/barcodebuddy/scanner.nix
Normal file
63
packages/barcodebuddy/scanner.nix
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
{
|
||||
stdenvNoCC,
|
||||
fetchpatch,
|
||||
makeWrapper,
|
||||
barcodebuddy,
|
||||
curl,
|
||||
evtest,
|
||||
screen,
|
||||
lib,
|
||||
enableCurl ? true,
|
||||
enablePhp ? false,
|
||||
php,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.lists) optional optionals;
|
||||
inherit (lib.strings) makeBinPath;
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "barcodebuddy-scanner";
|
||||
inherit (barcodebuddy) version src;
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
name = "barcodebuddy-grab-input.patch";
|
||||
url = "https://github.com/gensokyo-zone/barcodebuddy/commit/9497d88b7971f2b47c9dcc32183721e059cd6d1d.patch";
|
||||
sha256 = "sha256-1HV5VMlXR4VoMo01KhlZ3bTdVLMJ08qzFqhqK4hBHdg=";
|
||||
})
|
||||
];
|
||||
|
||||
skipConfigure = true;
|
||||
skipBuild = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
scannerSource = "example/grabInput.sh";
|
||||
scannerPath = makeBinPath (
|
||||
[evtest]
|
||||
++ optional enableCurl curl
|
||||
++ optionals enablePhp [screen php]
|
||||
);
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm 0755 $scannerSource $out/bin/barcodebuddy-grab-input
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/barcodebuddy-grab-input \
|
||||
--set-default SCRIPT_LOCATION "''${barcodebuddyScript-/var/www/html/barcodebuddy/index.php}" \
|
||||
--prefix PATH : "$scannerPath"
|
||||
'';
|
||||
|
||||
meta =
|
||||
barcodebuddy.meta
|
||||
// {
|
||||
mainProgram = "barcodebuddy-grab-input";
|
||||
};
|
||||
}
|
||||
|
|
@ -50,6 +50,8 @@
|
|||
krb5-ldap
|
||||
nfs-utils-ldap
|
||||
barcodebuddy
|
||||
barcodebuddy-scanner
|
||||
barcodebuddy-scanner-python
|
||||
openwebrxplus
|
||||
systemd2mqtt
|
||||
;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue