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

a bit less hacky, i think
This commit is contained in:
Colin 2023-06-22 09:53:30 +00:00
parent c977665214
commit f62bd83eb8
6 changed files with 34 additions and 13 deletions

View File

@ -1,5 +1,5 @@
{ lib
, pkgs
, python3Packages
, static-nix-shell
, symlinkJoin
}:
@ -13,6 +13,19 @@ let
cp -R lib/* $out/bin/lib/
'';
});
sane-lib = {
bt = python3Packages.buildPythonPackage {
pname = "sane-lib-bt";
version = "0.1.0";
format = "setuptools";
src = ./src/lib/bt;
pythonImportChecks = [
"sane_bt"
];
};
};
nix-shell-scripts = {
# anything added to this attrset gets symlink-joined into `sane-scripts`
# and is made available through `sane-scripts.passthru`
@ -26,15 +39,17 @@ let
src = ./src;
pkgs = [ "duplicity" ];
};
bt-add = pythonWithLib {
bt-add = static-nix-shell.mkPython3Bin {
pname = "sane-bt-add";
src = ./src;
pkgs = [ "transmission" ];
pyPkgs = [ "sane-lib.bt" ];
};
bt-rm = pythonWithLib {
pname = "sane-bt-rm";
src = ./src;
pkgs = [ "transmission" ];
pyPkgs = [ "sane-lib.bt" ];
};
bt-search = static-nix-shell.mkPython3Bin {
pname = "sane-bt-search";
@ -215,7 +230,9 @@ in
symlinkJoin {
name = "sane-scripts";
paths = lib.attrValues nix-shell-scripts;
passthru = nix-shell-scripts;
passthru = nix-shell-scripts // {
lib = sane-lib;
};
meta = {
description = "collection of scripts associated with sane systems";
homepage = "https://git.uninsane.org";

View File

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

View File

@ -1,13 +1,10 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p transmission
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.sane-lib.bt ])" -p transmission
# vim: set filetype=python :
import argparse
import sys
sys.path.insert(0, ".") # to import `lib`
from lib.sane_torrent import MediaMeta, TransmissionApi
from sane_bt import MediaMeta, TransmissionApi
def main():

View File

@ -1,15 +1,12 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p transmission
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.sane-lib.bt ])" -p transmission
# vim: set filetype=python :
# removes a torrent and trashes its data
import argparse
import sys
sys.path.insert(0, ".") # to import `lib`
from lib.sane_torrent import TransmissionApi
from sane_bt import TransmissionApi
def main():

View File

@ -1,4 +1,5 @@
{ callPackage }:
{
feedsearch-crawler = callPackage ./feedsearch-crawler { };
sane-lib = (callPackage ../additional/sane-scripts { }).lib;
}