From a07a40b018390b5832da6cf201c26ecfd4d1b7b3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 17 Aug 2020 00:46:25 +0200 Subject: ma pkgs.nsrenamer: init --- makefu/5pkgs/nsrenamer/default.nix | 3 ++ makefu/5pkgs/nsrenamer/nsrenamer.sh | 58 +++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 makefu/5pkgs/nsrenamer/default.nix create mode 100755 makefu/5pkgs/nsrenamer/nsrenamer.sh (limited to 'makefu/5pkgs') diff --git a/makefu/5pkgs/nsrenamer/default.nix b/makefu/5pkgs/nsrenamer/default.nix new file mode 100644 index 00000000..9dbd3ad4 --- /dev/null +++ b/makefu/5pkgs/nsrenamer/default.nix @@ -0,0 +1,3 @@ +{ pkgs,... }: +# TODO: dependencies: coreutils, nx_game_info, +pkgs.writeScriptBin "nsrenamer" ./nsrenamer.sh diff --git a/makefu/5pkgs/nsrenamer/nsrenamer.sh b/makefu/5pkgs/nsrenamer/nsrenamer.sh new file mode 100755 index 00000000..3d60d1ae --- /dev/null +++ b/makefu/5pkgs/nsrenamer/nsrenamer.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +set -euf +indir=$(dirname "$1") +inname=$(basename "$1") +out=$(nxgameinfo_cli "$1") +ext=${1##*.} +id=$(awk -F: '/├ Title ID:/{print $2}' <<<$out |xargs) +baseid=$(awk -F: '/Base Title ID:/{print $2}' <<<$out |xargs) +version=$(awk -F: '/├ Display Version:/{print $2}' <<<$out |xargs) +name=$(awk -F: '/Title Name/{print $2}' <<<$out |xargs) +type=$(awk -F: '/Type:/{print $2}' <<<$out | xargs) + +! test -n "$id" && echo "Title ID cannot be empty!" && exit 1 +! test -n "$type" && echo "type cannot be empty!" && exit 1 + +if test "$type" == Base;then + ! test -n "$name" && echo "Title Name cannot be empty!" && exit 1 + NAME="[$id] $name Base Game.$ext" +elif test "$type" == Update;then + ! test -n "$name" && echo "Title Name cannot be empty!" && exit 1 + ! test -n "$version" && echo "Version cannot be empty!" && exit 1 + NAME="[$id] $name Update $version.$ext" +elif test "$type" == DLC;then + dlcname=$(jq -r --arg id "$id" '.[$id].name' < ~/.switch/titles.US.en.json) + if test -n "$dlcname" ;then + NAME="[$id] $dlcname DLC.$ext" + else + ! test -n "$name" && echo "dlcname cannot be found in titles.US.en.json and $name is empty!" && exit 1 + NAME="[$id] $name DLC.$ext" + fi +else + echo "unknown type '$type'" + exit 1 +fi +newname=$indir/$NAME + +if test "$NAME" == "${inname}";then + echo "name didn't change,doing nothing" + exit 0 +fi +if test -e "$newname" ;then + echo "'$NAME' already exists, will not override" + exit 1 +fi + +if test -n "${FORCE:-}" ;then + CONFIRM=y +else + read -p "rename '$inname' to '$NAME' - [y/N]" CONFIRM +fi + +if test -n "${FORCE:-}" -o "$CONFIRM" == "y" -o "$CONFIRM" == "Y";then + mv -nv "$1" "$newname" +else + echo "bailing out" + exit 1 +fi + -- cgit v1.2.3 From 9b30bf0814bd142052c30d0184d589fede04e1cf Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 18 Aug 2020 23:26:51 +0200 Subject: ma pkgs.nsrenamer: new naming scheme --- makefu/5pkgs/nsrenamer/default.nix | 2 +- makefu/5pkgs/nsrenamer/nsrenamer.sh | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'makefu/5pkgs') diff --git a/makefu/5pkgs/nsrenamer/default.nix b/makefu/5pkgs/nsrenamer/default.nix index 9dbd3ad4..16b9a4f2 100644 --- a/makefu/5pkgs/nsrenamer/default.nix +++ b/makefu/5pkgs/nsrenamer/default.nix @@ -1,3 +1,3 @@ { pkgs,... }: # TODO: dependencies: coreutils, nx_game_info, -pkgs.writeScriptBin "nsrenamer" ./nsrenamer.sh +pkgs.writeScriptBin "nsrenamer" (builtins.readFile ./nsrenamer.sh) diff --git a/makefu/5pkgs/nsrenamer/nsrenamer.sh b/makefu/5pkgs/nsrenamer/nsrenamer.sh index 3d60d1ae..16aec311 100755 --- a/makefu/5pkgs/nsrenamer/nsrenamer.sh +++ b/makefu/5pkgs/nsrenamer/nsrenamer.sh @@ -4,29 +4,29 @@ indir=$(dirname "$1") inname=$(basename "$1") out=$(nxgameinfo_cli "$1") ext=${1##*.} -id=$(awk -F: '/├ Title ID:/{print $2}' <<<$out |xargs) -baseid=$(awk -F: '/Base Title ID:/{print $2}' <<<$out |xargs) -version=$(awk -F: '/├ Display Version:/{print $2}' <<<$out |xargs) -name=$(awk -F: '/Title Name/{print $2}' <<<$out |xargs) -type=$(awk -F: '/Type:/{print $2}' <<<$out | xargs) +id=$(awk -F: '/├ Title ID:/{print $2}' <<<"$out" |xargs) +baseid=$(awk -F: '/Base Title ID:/{print $2}' <<<"$out" |xargs) +version=$(awk -F: '/├ Version:/{print $2}' <<<"$out" |xargs) +name=$(awk -F: '/Title Name/{print $2}' <<<"$out" | sed "s/[:']//g" | xargs ) +type=$(awk -F: '/Type:/{print $2}' <<<"$out" | xargs) ! test -n "$id" && echo "Title ID cannot be empty!" && exit 1 ! test -n "$type" && echo "type cannot be empty!" && exit 1 if test "$type" == Base;then ! test -n "$name" && echo "Title Name cannot be empty!" && exit 1 - NAME="[$id] $name Base Game.$ext" + NAME="$name [$id][v$version].$ext" elif test "$type" == Update;then ! test -n "$name" && echo "Title Name cannot be empty!" && exit 1 ! test -n "$version" && echo "Version cannot be empty!" && exit 1 - NAME="[$id] $name Update $version.$ext" + NAME="$name [UPD][$id][v$version].$ext" elif test "$type" == DLC;then - dlcname=$(jq -r --arg id "$id" '.[$id].name' < ~/.switch/titles.US.en.json) + dlcname=$(jq -r --arg id "$id" '.[$id].name' < ~/.switch/titles.US.en.json | sed "s/[:']//g") if test -n "$dlcname" ;then - NAME="[$id] $dlcname DLC.$ext" + NAME="$dlcname [DLC][$id][v$version].$ext" else ! test -n "$name" && echo "dlcname cannot be found in titles.US.en.json and $name is empty!" && exit 1 - NAME="[$id] $name DLC.$ext" + NAME="$dlcname [DLC][$id][v$version].$ext" fi else echo "unknown type '$type'" -- cgit v1.2.3 From 865f527886722416c9a65a6b31ef7cff1f3e45ca Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Sep 2020 00:19:59 +0200 Subject: ma pkgs.chapter-marker: bump to latest master --- makefu/5pkgs/chapter-marker/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'makefu/5pkgs') diff --git a/makefu/5pkgs/chapter-marker/default.nix b/makefu/5pkgs/chapter-marker/default.nix index fe3e4814..5ffb63ae 100644 --- a/makefu/5pkgs/chapter-marker/default.nix +++ b/makefu/5pkgs/chapter-marker/default.nix @@ -1,4 +1,4 @@ -{ coreutils, fetchFromGitHub, makeWrapper, xdotool, stdenv, ... }: +{ coreutils, fetchFromGitHub, makeWrapper, xclip, libnotify, stdenv, ... }: stdenv.mkDerivation rec { name = "chapter-marker-${version}"; @@ -6,8 +6,8 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "makefu"; repo = "chapter-marker"; - rev = "7602b611fb3d67fdb8a86db23220074dfa9dfa1e"; - sha256 = "0cwh650c3qhdrcvrqfzgrwpsnj4lbq64fw2sfwvnbxz94b4q36av"; + rev = "71b9bb8bc4d6fa87de6bea8f42d5486d05cf5443"; + sha256 = "13cvk24pwwyv9i21h57690s5niwkcrcvn8l24zfxwbgq0wwzw38x"; }; buildInputs = [ makeWrapper ]; @@ -16,7 +16,8 @@ stdenv.mkDerivation rec { let path = stdenv.lib.makeBinPath [ coreutils - xdotool + libnotify + xclip ]; in '' -- cgit v1.2.3 From 8bec9d2662ba65e3c65c6e416618af24a4d6832f Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 2 Sep 2020 00:43:34 +0200 Subject: ma pkgs.awesomecfg: start chapter-marks with ctrl-u, create new entry with ctrl-j --- makefu/5pkgs/awesomecfg/full.cfg | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'makefu/5pkgs') diff --git a/makefu/5pkgs/awesomecfg/full.cfg b/makefu/5pkgs/awesomecfg/full.cfg index d96b61ad..86b401cf 100644 --- a/makefu/5pkgs/awesomecfg/full.cfg +++ b/makefu/5pkgs/awesomecfg/full.cfg @@ -376,6 +376,12 @@ globalkeys = awful.util.table.join( awful.key({ }, "XF86AudioMute", function () awful.util.spawn("@alsaUtils@/bin/amixer -q -D default sset Master toggle", false) end), + -- chapter-marker + awful.key({ "Control" }, "u", function () awful.spawn("@chaptermarker@/bin/chapter-start") end, + {description = "start the chapter marker",}), + awful.key({ "Control" }, "j", function () awful.spawn("@chaptermarker@/bin/chapter-mark") end, + {description = "create a chapter mark",}), + -- Prompt awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end, {description = "run prompt", group = "launcher"}), @@ -492,9 +498,16 @@ awful.rules.rules = { properties = { floating = true } }, --{ rule = { class = "gimp" }, -- properties = { floating = true } }, - -- Set Firefox to always map on tags number 2 of screen 1. - -- { rule = { class = "Firefox" }, - -- properties = { tag = tags[1][2] } }, + { rule = { class = "Firefox" }, + properties = { tag = tags[3] } }, + { rule = { class = "signal-desktop" }, + properties = { tag = tags[4] } }, + { rule = { class = "telegram-desktop" }, + properties = { tag = tags[4] } }, + { rule = { class = "mutt" }, + properties = { tag = tags[5] } }, + { rule = { class = "mosh" }, + properties = { tag = tags[2] } }, } -- }}} @@ -569,7 +582,7 @@ local os = { -- {{{ autostart do - awful.spawn("urxvt", { tag = tags[1] }) -- dev shell + -- awful.spawn("urxvt", { tag = tags[1] }) -- dev shell awful.spawn("urxvt -e mosh makefu@gum.i", { tag = tags[2] }) awful.spawn("firefox", { tag = tags[3] }) awful.spawn("telegram-desktop", { tag = tags[4] }) -- cgit v1.2.3 From ce41b987239abbac0f817a9ae1f7019ad9f4035a Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 16 Sep 2020 22:25:40 +0200 Subject: ma awesomecfg: add chapter-marker --- makefu/5pkgs/awesomecfg/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'makefu/5pkgs') diff --git a/makefu/5pkgs/awesomecfg/default.nix b/makefu/5pkgs/awesomecfg/default.nix index 1ae2f50d..acbe61f3 100644 --- a/makefu/5pkgs/awesomecfg/default.nix +++ b/makefu/5pkgs/awesomecfg/default.nix @@ -6,15 +6,17 @@ , blueman , clipit , flameshot +, chapter-marker , modkey ? "Mod4" , locker? "${pkgs.xlock}/bin/xlock -mode blank" , ... }: { - # replace: @alsaUtils@ @xlockmore@ @xbacklight@ @modkey@ + # replace: @alsaUtils@ @xlockmore@ @xbacklight@ @modkey@ @chapter-marker@ full = lib.makeOverridable pkgs.substituteAll { name = "awesome_full_config"; inherit alsaUtils locker xbacklight modkey networkmanagerapplet blueman clipit flameshot ; + chaptermarker = chapter-marker; isExecutable = false; src = ./full.cfg; }; -- cgit v1.2.3 From 3a93c400a3f8e58a4d10ae743fbdbada216d8641 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 16 Sep 2020 22:28:13 +0200 Subject: ma pkgs.kalauerbot: init --- makefu/5pkgs/kalauerbot/default.nix | 18 ++++++++++++++++ makefu/5pkgs/kalauerbot/matrixbot.patch | 12 +++++++++++ makefu/5pkgs/kalauerbot/python-matrixbot.nix | 31 ++++++++++++++++++++++++++++ makefu/5pkgs/kalauerbot/translate.patch | 17 +++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 makefu/5pkgs/kalauerbot/default.nix create mode 100644 makefu/5pkgs/kalauerbot/matrixbot.patch create mode 100644 makefu/5pkgs/kalauerbot/python-matrixbot.nix create mode 100644 makefu/5pkgs/kalauerbot/translate.patch (limited to 'makefu/5pkgs') diff --git a/makefu/5pkgs/kalauerbot/default.nix b/makefu/5pkgs/kalauerbot/default.nix new file mode 100644 index 00000000..2cecbc3f --- /dev/null +++ b/makefu/5pkgs/kalauerbot/default.nix @@ -0,0 +1,18 @@ +{ stdenv, python3, fetchgit }: +python3.pkgs.buildPythonPackage rec { +name = "kalauerbot"; +rev = "08d98aa"; + src = fetchgit { + url = "http://cgit.euer.krebsco.de/kalauerbot"; + inherit rev; + sha256 = "017hh61smgq4zsxd10brgwmykwgwabgllxjs31xayvs1hnqmkv2v"; + }; + propagatedBuildInputs = with python3.pkgs;[ + (callPackage ./python-matrixbot.nix {}) + (stdenv.lib.overrideDerivation googletrans (self: { + patches = [ ./translate.patch ]; + })) + ]; + checkInputs = [ python3.pkgs.black ]; +} + diff --git a/makefu/5pkgs/kalauerbot/matrixbot.patch b/makefu/5pkgs/kalauerbot/matrixbot.patch new file mode 100644 index 00000000..2b9bbbea --- /dev/null +++ b/makefu/5pkgs/kalauerbot/matrixbot.patch @@ -0,0 +1,12 @@ +diff --git a/matrixbot/matrixbot.py b/matrixbot/matrixbot.py +index 8e5598c..d8c23d2 100644 +--- a/matrixbot/matrixbot.py ++++ b/matrixbot/matrixbot.py +@@ -51,7 +51,6 @@ class MatrixBot: + self.user = None + if self.token is not None and self.user_id is not None: + self.user = self.client.get_user(self.user_id) +- self.user.set_display_name(self.display_name) + self.init_rooms(self.client.rooms) + self.invite_listener = self.client.add_invite_listener(self.handle_invite) + self.cache = Cache(dbfile=cache_db) diff --git a/makefu/5pkgs/kalauerbot/python-matrixbot.nix b/makefu/5pkgs/kalauerbot/python-matrixbot.nix new file mode 100644 index 00000000..7bc5aa7f --- /dev/null +++ b/makefu/5pkgs/kalauerbot/python-matrixbot.nix @@ -0,0 +1,31 @@ +{ lib +, buildPythonPackage +, fetchPypi +, markdown +, matrix-client +}: + +buildPythonPackage rec { + pname = "python-matrixbot"; + version = "0.0.7"; + CI_COMMIT_TAG = version; + + #src = ./python-matrixbot; + src = fetchPypi { + inherit pname version; + sha256 = "9412981b14ff3ab7ffbb1bfc1691758113ab8d71f731b3093d8808c286b69c71"; + }; + patches = [ ./matrixbot.patch ]; + + propagatedBuildInputs = [ + markdown + matrix-client + ]; + + meta = with lib; { + description = "A basic bot for Matrix"; + homepage = https://gitlab.com/gibberfish/python-matrixbot; + license = licenses.mit; + # maintainers = [ maintainers. ]; + }; +} diff --git a/makefu/5pkgs/kalauerbot/translate.patch b/makefu/5pkgs/kalauerbot/translate.patch new file mode 100644 index 00000000..6ff82072 --- /dev/null +++ b/makefu/5pkgs/kalauerbot/translate.patch @@ -0,0 +1,17 @@ +diff --git a/googletrans/client.py b/googletrans/client.py +index 89c2237..c203b44 100644 +--- a/googletrans/client.py ++++ b/googletrans/client.py +@@ -190,6 +190,13 @@ class Translator(object): + pass + if not PY3 and isinstance(pron, unicode) and isinstance(origin, str): # pragma: nocover + origin = origin.decode('utf-8') ++ ++ if pron is None: ++ try: ++ pron = data[0][2][2] ++ except: # pragma: nocover ++ pass ++ + if dest in EXCLUDES and pron == origin: + pron = translated -- cgit v1.2.3 From 75e3df7fd3c2c83fff5d58c05870a00052ec34a5 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 24 Sep 2020 23:38:15 +0200 Subject: ma pkgs.tt-rss: bump to 2020-09-23 fixes critical security issues as reported in https://www.digeex.de/blog/tinytinyrss/ --- makefu/5pkgs/tt-rss/default.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 makefu/5pkgs/tt-rss/default.nix (limited to 'makefu/5pkgs') diff --git a/makefu/5pkgs/tt-rss/default.nix b/makefu/5pkgs/tt-rss/default.nix new file mode 100644 index 00000000..4907a73a --- /dev/null +++ b/makefu/5pkgs/tt-rss/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "tt-rss"; + version = "2020-09-23"; + rev = "d0ed7890df"; + + src = fetchurl { + url = "https://git.tt-rss.org/git/tt-rss/archive/${rev}.tar.gz"; + sha256 = "1b2fczd41bqg9bq37r99svrqswr9qrp35m6gn3nz032yqcwc22ij"; + }; + + installPhase = '' + mkdir $out + cp -ra * $out/ + ''; + + meta = with stdenv.lib; { + description = "Web-based news feed (RSS/Atom) aggregator"; + license = licenses.gpl2Plus; + homepage = "https://tt-rss.org"; + maintainers = with maintainers; [ globin zohl ]; + platforms = platforms.all; + }; +} -- cgit v1.2.3