From 807f4a4d1cff8b0e2c6de3528c67947db131ca68 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 13 Mar 2020 10:46:05 +0100 Subject: [PATCH] ma 2configs: cleanup --- makefu/2configs/hw/cc2531.nix | 10 +++ makefu/2configs/main-laptop.nix | 9 ++- makefu/2configs/minimal.nix | 6 +- makefu/2configs/mqtt.nix | 2 +- makefu/2configs/nginx/rompr.nix | 1 - makefu/2configs/nur.nix | 6 +- makefu/2configs/sickbeard/cheetah3.nix | 25 +++++++ makefu/2configs/sickbeard/debug.patch | 91 ++++++++++++++++++++++++++ makefu/2configs/sickbeard/sickgear.nix | 16 +++-- 9 files changed, 147 insertions(+), 19 deletions(-) create mode 100644 makefu/2configs/hw/cc2531.nix create mode 100644 makefu/2configs/sickbeard/cheetah3.nix create mode 100644 makefu/2configs/sickbeard/debug.patch diff --git a/makefu/2configs/hw/cc2531.nix b/makefu/2configs/hw/cc2531.nix new file mode 100644 index 000000000..3bc2c6834 --- /dev/null +++ b/makefu/2configs/hw/cc2531.nix @@ -0,0 +1,10 @@ +{ config, lib, pkgs, ... }: + +{ + + users.users.${config.krebs.build.user.name}.extraGroups = [ "dialout" ]; + + services.udev.extraRules = '' + SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dailout" + ''; +} diff --git a/makefu/2configs/main-laptop.nix b/makefu/2configs/main-laptop.nix index 315fc4706..cb78c823f 100644 --- a/makefu/2configs/main-laptop.nix +++ b/makefu/2configs/main-laptop.nix @@ -68,11 +68,10 @@ in { }; security.sudo.extraConfig = "${config.krebs.power-action.user} ALL= (root) NOPASSWD: ${pkgs.systemd}/bin/systemctl suspend"; - services.redshift = { - enable = true; - latitude = "48.7"; - longitude = "9.1"; - }; + services.redshift.enable = true; + location.latitude = 48.7; + location.longitude = 9.1; + systemd.services.look-up = { startAt = "*:30"; serviceConfig = { diff --git a/makefu/2configs/minimal.nix b/makefu/2configs/minimal.nix index cb2ef09e3..ad4c128ec 100644 --- a/makefu/2configs/minimal.nix +++ b/makefu/2configs/minimal.nix @@ -74,11 +74,7 @@ }; # suppress chrome autit event messages - security.audit = { - rules = [ - "-a task,never" - ]; - }; + security.audit.rules = [ "-a task,never" ]; # Enable IPv6 Privacy Extensions boot.kernel.sysctl = { diff --git a/makefu/2configs/mqtt.nix b/makefu/2configs/mqtt.nix index 8b77df962..9d1da8392 100644 --- a/makefu/2configs/mqtt.nix +++ b/makefu/2configs/mqtt.nix @@ -6,7 +6,7 @@ users = {}; # TODO: secure that shit aclExtraConf = '' - pattern readwrite /# + pattern readwrite # ''; allowAnonymous = true; }; diff --git a/makefu/2configs/nginx/rompr.nix b/makefu/2configs/nginx/rompr.nix index 8c1fbc53b..c7dc3ff17 100644 --- a/makefu/2configs/nginx/rompr.nix +++ b/makefu/2configs/nginx/rompr.nix @@ -15,7 +15,6 @@ let in { services.phpfpm = { - # phpfpm does not have an enable option poolConfigs = { mpd = '' user = ${user} diff --git a/makefu/2configs/nur.nix b/makefu/2configs/nur.nix index 3cb4981e0..891144957 100644 --- a/makefu/2configs/nur.nix +++ b/makefu/2configs/nur.nix @@ -1,6 +1,10 @@ { pkgs, ... }:{ nixpkgs.config.packageOverrides = pkgs: { - nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { + nur = import (builtins.fetchTarball { + url = "https://github.com/nix-community/NUR/archive/7bfd0117b359d0f72d086ff7e1f0ba3aeaf8d91e.tar.gz"; + sha256 = "0gb2np1r2m9kkz1s374gxdqrwhkzx48iircy00y6mjr7h14rhyxk"; + } + ){ inherit pkgs; }; }; diff --git a/makefu/2configs/sickbeard/cheetah3.nix b/makefu/2configs/sickbeard/cheetah3.nix new file mode 100644 index 000000000..df928edd6 --- /dev/null +++ b/makefu/2configs/sickbeard/cheetah3.nix @@ -0,0 +1,25 @@ +{ lib +, buildPythonPackage +, fetchPypi +}: + +buildPythonPackage rec { + pname = "cheetah3"; + version = "3.2.4"; + + + src = fetchPypi { + pname = "Cheetah3"; + inherit version; + sha256 = "caabb9c22961a3413ac85cd1e5525ec9ca80daeba6555f4f60802b6c256e252b"; + }; + + doCheck = false; + + meta = with lib; { + description = "Cheetah is a template engine and code generation tool"; + homepage = https://cheetahtemplate.org/; + license = licenses.mit; + # maintainers = [ maintainers. ]; + }; +} diff --git a/makefu/2configs/sickbeard/debug.patch b/makefu/2configs/sickbeard/debug.patch new file mode 100644 index 000000000..aa22142c8 --- /dev/null +++ b/makefu/2configs/sickbeard/debug.patch @@ -0,0 +1,91 @@ +diff --git a/SickBeard.py b/SickBeard.py +index 31cfd1e1..10a4ef5e 100755 +--- a/SickBeard.py ++++ b/SickBeard.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python2 ++#!/usr/bin/env python3 + # + # This file is part of SickGear. + # +diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py +index 5c1f7bfe..8999b468 100644 +--- a/sickbeard/providers/generic.py ++++ b/sickbeard/providers/generic.py +@@ -1203,6 +1203,7 @@ class GenericProvider(object): + ep_num = None + if 1 == len(ep_obj_results): + ep_num = ep_obj_results[0].episode ++ logger.log(f'{ep_obj_results[0]}',logger.DEBUG) + logger.log(u'Single episode result.', logger.DEBUG) + elif 1 < len(ep_obj_results): + ep_num = MULTI_EP_RESULT +diff --git a/sickbeard/providers/horriblesubs.py b/sickbeard/providers/horriblesubs.py +index 870e8461..dbdeacc8 100644 +--- a/sickbeard/providers/horriblesubs.py ++++ b/sickbeard/providers/horriblesubs.py +@@ -98,6 +98,7 @@ class HorribleSubsProvider(generic.TorrentProvider): + + results = self._sort_seeding(mode, results + items[mode]) + ++ logger.log(f"{results}",logger.DEBUG) + return results + + def _season_strings(self, *args, **kwargs): +@@ -131,6 +132,7 @@ class HorribleSubsProvider(generic.TorrentProvider): + .find_all('a', href=re.compile('(?i)(torrent$|^magnet:)'))))[0] + except (BaseException, Exception): + pass ++ logger.log(f"{result}",logger.DEBUG) + return result + + +diff --git a/sickbeard/search.py b/sickbeard/search.py +index f4957c3a..dd3a352d 100644 +--- a/sickbeard/search.py ++++ b/sickbeard/search.py +@@ -986,22 +986,26 @@ def search_providers( + + best_result = pick_best_result(found_results[provider_id][cur_search_result], show_obj, quality_list, + filter_rls=orig_thread_name) +- ++ logger.log(f"Best result: {best_result}",logger.DEBUG) + # if all results were rejected move on to the next episode + if not best_result: + continue +- ++ + # filter out possible bad torrents from providers + if 'torrent' == best_result.resultType: ++ logger.log(f"Best result is torrent {best_result.url}",logger.DEBUG) + if not best_result.url.startswith('magnet') and None is not best_result.get_data_func: + best_result.url = best_result.get_data_func(best_result.url) + best_result.get_data_func = None # consume only once + if not best_result.url: + continue + if best_result.url.startswith('magnet'): ++ logger.log("url is magnet link",logger.DEBUG) + if 'blackhole' != sickbeard.TORRENT_METHOD: ++ logger.log(f"Setting content to None because TORRENT_METHODD is not blackhole ({sickbeard.TORRENT_METHOD} instead)",logger.DEBUG) + best_result.content = None + else: ++ logger.log("url is torrent link",logger.DEBUG) + cache_file = ek.ek(os.path.join, sickbeard.CACHE_DIR or helpers.get_system_temp_dir(), + '%s.torrent' % (helpers.sanitize_filename(best_result.name))) + if not helpers.download_file(best_result.url, cache_file, session=best_result.provider.session): +@@ -1044,6 +1048,7 @@ def search_providers( + best_result.after_get_data_func(best_result) + best_result.after_get_data_func = None # consume only once + ++ logger.log(f"After torrent detection",logger.DEBUG) + # add result if its not a duplicate + found = False + for i, result in enumerate(final_results): +@@ -1054,6 +1059,7 @@ def search_providers( + else: + found = True + if not found: ++ logger.log(f"Not already found, adding to best_result to final_results",logger.DEBUG) + final_results += [best_result] + + # check that we got all the episodes we wanted first before doing a match and snatch diff --git a/makefu/2configs/sickbeard/sickgear.nix b/makefu/2configs/sickbeard/sickgear.nix index 1b7a57e8b..281ec1845 100644 --- a/makefu/2configs/sickbeard/sickgear.nix +++ b/makefu/2configs/sickbeard/sickgear.nix @@ -1,16 +1,19 @@ -{ stdenv, fetchFromGitHub, python2, makeWrapper }: +{ stdenv, fetchFromGitHub, python3, makeWrapper }: let - pythonEnv = python2.withPackages(ps: with ps; [ cheetah ]); + pythonEnv = python3.withPackages(ps: with ps; [ + (python3.pkgs.callPackage ./cheetah3.nix {}) + ]); in stdenv.mkDerivation rec { pname = "sickgear"; - version = "0.20.0"; + #version = "0.21.6"; + version = "0.21.7"; src = fetchFromGitHub { owner = "SickGear"; repo = "SickGear"; - rev = "release_${version}"; - sha256 = "1zg95szvfbmwinx1z5nlbmyck7ximvyna0x71yflmadkgf88nv0k"; + rev = "hotfix/${version}"; + sha256 = "0kj8l6xq7vycr6d15lxybnk02b39z0zk4jzy0b2lbapgk0kx3ims"; }; dontBuild = true; @@ -18,12 +21,13 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ makeWrapper ]; buildInputs = [ pythonEnv ]; + patches = [ ./debug.patch ]; installPhase = '' mkdir -p $out/bin cp -R {autoProcessTV,gui,lib,sickbeard,sickgear.py,SickBeard.py} $out/ - makeWrapper $out/SickBeard.py $out/bin/sickgear + makeWrapper $out/sickgear.py $out/bin/sickgear ''; meta = with stdenv.lib; {