sane-scripts: split sane-lib-ssdp into an actual, nix-level library

This commit is contained in:
2023-06-22 09:58:56 +00:00
parent f62bd83eb8
commit 74891fb2f0
5 changed files with 23 additions and 20 deletions

View File

@@ -5,15 +5,6 @@
}:
let
# for a python script that needs the lib/ directory
# TODO: would be better to package the lib directory as its own python library
pythonWithLib = args: static-nix-shell.mkPython3Bin (args // {
postInstall = args.postInstall or "" + ''
mkdir -p $out/bin/lib
cp -R lib/* $out/bin/lib/
'';
});
sane-lib = {
bt = python3Packages.buildPythonPackage {
pname = "sane-lib-bt";
@@ -24,6 +15,15 @@ let
"sane_bt"
];
};
ssdp = python3Packages.buildPythonPackage {
pname = "sane-lib-ssdp";
version = "0.1.0";
format = "setuptools";
src = ./src/lib/ssdp;
pythonImportChecks = [
"sane_ssdp"
];
};
};
nix-shell-scripts = {
@@ -45,7 +45,7 @@ let
pkgs = [ "transmission" ];
pyPkgs = [ "sane-lib.bt" ];
};
bt-rm = pythonWithLib {
bt-rm = static-nix-shell.mkPython3Bin {
pname = "sane-bt-rm";
src = ./src;
pkgs = [ "transmission" ];
@@ -90,19 +90,13 @@ let
pname = "sane-ip-check-upnp";
src = ./src;
pkgs = [ "miniupnpc" ];
postInstall = ''
mkdir -p $out/bin/lib
cp -R lib/* $out/bin/lib/
'';
pyPkgs = [ "sane-lib.ssdp" ];
};
ip-port-forward = static-nix-shell.mkPython3Bin {
pname = "sane-ip-port-forward";
src = ./src;
pkgs = [ "inetutils" "miniupnpc" ];
postInstall = ''
mkdir -p $out/bin/lib
cp -R lib/* $out/bin/lib/
'';
pyPkgs = [ "sane-lib.ssdp" ];
};
ip-reconnect = static-nix-shell.mkPython3Bin {
pname = "sane-ip-reconnect";

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env python
from distutils.core import setup
setup(
name='sane-lib-ssdp',
version='0.1.0',
description='utilities for sane-scripts',
)

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p miniupnpc
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.sane-lib.ssdp ])" -p miniupnpc
# best to run this with an external timeout. e.g.
# - `timeout 60 sane-ip-check-upnp`

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p inetutils -p miniupnpc
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.sane-lib.ssdp ])" -p inetutils -p miniupnpc
'''
USAGE: sane-ip-port-forward [options] [proto:port[:desc]]*