diff options
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r-- | krebs/5pkgs/simple/brain/default.nix | 20 | ||||
-rw-r--r-- | krebs/5pkgs/simple/cabal-read.nix | 39 | ||||
-rw-r--r-- | krebs/5pkgs/simple/flameshot-once/config.nix | 416 | ||||
-rw-r--r-- | krebs/5pkgs/simple/flameshot-once/default.nix | 149 | ||||
-rw-r--r-- | krebs/5pkgs/simple/flameshot-once/flameshot/default.nix | 16 | ||||
-rw-r--r-- | krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch | 28 | ||||
-rw-r--r-- | krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch | 43 | ||||
-rw-r--r-- | krebs/5pkgs/simple/krebs-pages/fixtures/index.html | 2 | ||||
-rw-r--r-- | krebs/5pkgs/simple/pager.nix | 40 | ||||
-rw-r--r-- | krebs/5pkgs/simple/q-power_supply.nix | 146 | ||||
-rw-r--r-- | krebs/5pkgs/simple/rss-bridge/default.nix | 33 | ||||
-rw-r--r-- | krebs/5pkgs/simple/vicuna-chat/default.nix | 33 |
12 files changed, 14 insertions, 951 deletions
diff --git a/krebs/5pkgs/simple/brain/default.nix b/krebs/5pkgs/simple/brain/default.nix index bf52da75f..d7e36a527 100644 --- a/krebs/5pkgs/simple/brain/default.nix +++ b/krebs/5pkgs/simple/brain/default.nix @@ -1,16 +1,22 @@ -{ pass, runCommand, write, writeDash, ... }: +{ pkgs }: -write "brain" { - "/bin/brain".link = writeDash "brain" '' +let + pass = pkgs.pass.withExtensions (ext: [ + ext.pass-otp + ]); +in + +pkgs.write "brain" { + "/bin/brain".link = pkgs.writeDash "brain" '' PASSWORD_STORE_DIR=$HOME/brain \ - exec ${pass}/bin/pass $@ + exec ${pass}/bin/pass "$@" ''; - "/bin/brainmenu".link = writeDash "brainmenu" '' + "/bin/brainmenu".link = pkgs.writeDash "brainmenu" '' PASSWORD_STORE_DIR=$HOME/brain \ - exec ${pass}/bin/passmenu $@ + exec ${pass}/bin/passmenu "$@" ''; "/share/bash-completion/completions/brain".link = - runCommand "brain-completions" { + pkgs.runCommand "brain-completions" { } /* sh */ '' sed -r ' s/\<_pass?(_|\>)/_brain\1/g diff --git a/krebs/5pkgs/simple/cabal-read.nix b/krebs/5pkgs/simple/cabal-read.nix deleted file mode 100644 index 03b42ef2c..000000000 --- a/krebs/5pkgs/simple/cabal-read.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ writeHaskellPackage }: - -# Because `sed -n 's/.*\<ghc-options:\s\+\(.*\)/\1/p'` is too simple. -writeHaskellPackage "cabal-read" { - executables.ghc-options = { - extra-depends = ["Cabal"]; - text = /* haskell */ '' - {-# LANGUAGE CPP #-} - module Main (main) where - import Data.List - import Data.Maybe - import Distribution.Compiler - import Distribution.PackageDescription.Parsec - import Distribution.Types.BuildInfo - import Distribution.Types.CondTree - import Distribution.Types.Executable - import Distribution.Types.GenericPackageDescription - import Distribution.Types.UnqualComponentName - import Distribution.Verbosity - import System.Environment - main :: IO () - main = do - [path, name] <- getArgs - - desc <- readGenericPackageDescription normal path - - case lookup (mkUnqualComponentName name) (condExecutables desc) of - Just exe -> - putStrLn . intercalate " " . fromMaybe [] . lookup GHC - #if MIN_VERSION_Cabal(3,0,0) - . perCompilerFlavorToList - #endif - . options . buildInfo . condTreeData $ exe - - Nothing -> - error ("executable " <> name <> " not found in " <> path) - ''; - }; -} diff --git a/krebs/5pkgs/simple/flameshot-once/config.nix b/krebs/5pkgs/simple/flameshot-once/config.nix deleted file mode 100644 index 24df403aa..000000000 --- a/krebs/5pkgs/simple/flameshot-once/config.nix +++ /dev/null @@ -1,416 +0,0 @@ -{ config, pkgs, ... }: -with pkgs.stockholm.lib; - -let - # Encode integer to C-escaped string of bytes, little endian / LSB 0 - le = rec { - x1 = i: let - i0 = mod i 16; - i1 = i / 16; - in - if i == 0 then - "\\0" - else if i < 16 then - "\\x${elemAt hexchars i0}" - else - "\\x${elemAt hexchars i1}${elemAt hexchars i0}"; - - x2 = i: let - i0 = mod i 256; - i1 = i / 256; - in - "${x1 i1}${x1 i0}"; - - x4 = i: let - i0 = mod i 65536; - i1 = i / 65536; - in - "${x2 i1}${x2 i0}"; - }; - - toQList = t: xs: - assert t == "int"; - "QList<${t}>${le.x4 0}${le.x1 (length xs)}${concatMapStrings le.x4 xs}"; -in - -{ - options = { - imgur = mkOption { - default = {}; - type = types.submodule { - options = { - enable = mkEnableOption "imgur"; - createUrl = mkOption { - example = "http://p.r/image"; - type = types.str; - }; - deleteUrl = mkOption { - example = "http://p.r/image/delete/%1"; - type = types.str; - }; - xdg-open = mkOption { - default = {}; - type = types.submodule { - options = { - enable = mkEnableOption "imgur.xdg-open" // { - default = true; - }; - browser = mkOption { - default = "${pkgs.coreutils}/bin/false"; - type = types.str; - }; - createPrefix = mkOption { - default = config.imgur.createUrl; - type = types.str; - }; - deletePrefix = mkOption { - default = removeSuffix "/%1" config.imgur.deleteUrl; - type = types.str; - }; - }; - }; - }; - }; - }; - }; - package = mkOption { - type = types.package; - default = import ./flameshot { inherit pkgs; }; - }; - settings = { - # Options without a description are not documented in flameshot's README. - # Compare with: - # nix-shell -p flameshot-once.dev --run get-recognizedGeneralOptions - General = mapAttrs (_: recursiveUpdate { default = null; }) { - allowMultipleGuiInstances = mkOption { - description = '' - Allow multiple instances of `flameshot gui` to run at the same time - ''; - type = with types; nullOr bool; - }; - antialiasingPinZoom = mkOption { - description = '' - Anti-aliasing image when zoom the pinned image - ''; - type = with types; nullOr bool; - }; - autoCloseIdleDaemon = mkOption { - description = '' - Automatically close daemon when it's not needed - ''; - type = with types; nullOr bool; - }; - buttons = let - buttonTypes = { - # Generated with: - # nix-shell -p flameshot-once.dev --run get-buttonTypes - TYPE_PENCIL = 0; - TYPE_DRAWER = 1; - TYPE_ARROW = 2; - TYPE_SELECTION = 3; - TYPE_RECTANGLE = 4; - TYPE_CIRCLE = 5; - TYPE_MARKER = 6; - TYPE_SELECTIONINDICATOR = 7; - TYPE_MOVESELECTION = 8; - TYPE_UNDO = 9; - TYPE_COPY = 10; - TYPE_SAVE = 11; - TYPE_EXIT = 12; - TYPE_IMAGEUPLOADER = 13; - TYPE_OPEN_APP = 14; - TYPE_PIXELATE = 15; - TYPE_REDO = 16; - TYPE_PIN = 17; - TYPE_TEXT = 18; - TYPE_CIRCLECOUNT = 19; - TYPE_SIZEINCREASE = 20; - TYPE_SIZEDECREASE = 21; - TYPE_INVERT = 22; - TYPE_ACCEPT = 23; - }; - iterableButtonTypes = [ - # Generated with: - # nix-shell -p flameshot-once.dev --run get-iterableButtonTypes - "TYPE_ACCEPT" - "TYPE_ARROW" - "TYPE_CIRCLE" - "TYPE_CIRCLECOUNT" - "TYPE_COPY" - "TYPE_DRAWER" - "TYPE_EXIT" - "TYPE_IMAGEUPLOADER" - "TYPE_MARKER" - "TYPE_MOVESELECTION" - "TYPE_OPEN_APP" - "TYPE_PENCIL" - "TYPE_PIN" - "TYPE_PIXELATE" - "TYPE_RECTANGLE" - "TYPE_REDO" - "TYPE_SAVE" - "TYPE_SELECTION" - "TYPE_SIZEDECREASE" - "TYPE_SIZEINCREASE" - "TYPE_TEXT" - "TYPE_UNDO" - ]; - in mkOption { - apply = names: - if names != null then let - values = map (name: buttonTypes.${name}) names; - in - ''@Variant(\0\0\0\x7f\0\0\0\v${toQList "int" values})'' - else - null; - description = '' - Configure which buttons to show after drawing a selection - ''; - type = with types; nullOr (listOf (enum iterableButtonTypes)); - }; - checkForUpdates = mkOption { - type = with types; nullOr bool; - }; - contrastOpacity = mkOption { - description = '' - Opacity of area outside selection - ''; - type = with types; nullOr (boundedInt 0 255); - }; - contrastUiColor = mkOption { - description = '' - Contrast UI color - ''; - type = with types; nullOr flameshot.color; - }; - copyAndCloseAfterUpload = mkOption { - type = with types; nullOr bool; - }; - copyOnDoubleClick = mkOption { - type = with types; nullOr bool; - }; - copyPathAfterSave = mkOption { - description = '' - Copy path to image after save - ''; - type = with types; nullOr bool; - }; - copyURLAfterUpload = mkOption { - description = '' - On successful upload, close the dialog and copy URL to clipboard - ''; - type = with types; nullOr bool; - }; - disabledTrayIcon = mkOption { - description = '' - Whether the tray icon is disabled - ''; - type = with types; nullOr bool; - }; - drawColor = mkOption { - description = '' - Last used color - ''; - type = with types; nullOr flameshot.color; - }; - drawFontSize = mkOption { - type = with types; nullOr positive; - }; - drawThickness = mkOption { - description = '' - Last used tool thickness - ''; - type = with types; nullOr positive; - }; - filenamePattern = mkOption { - description = '' - Filename pattern using C++ strftime formatting - ''; - type = - # This is types.filename extended by [%:][%:+]* - with types; - nullOr (addCheck str (test "[%:0-9A-Za-z._][%:+0-9A-Za-z._-]*")); - }; - fontFamily = mkOption { - type = with types; nullOr str; - }; - historyConfirmationToDelete = mkOption { - type = with types; nullOr bool; - }; - ignoreUpdateToVersion = mkOption { - description = '' - Ignore updates to versions less than this value - ''; - type = with types; nullOr str; - }; - keepOpenAppLauncher = mkOption { - description = '' - Keep the App Launcher open after selecting an app - ''; - type = with types; nullOr bool; - }; - predefinedColorPaletteLarge = mkOption { - description = '' - Use larger color palette as the default one - ''; - type = with types; nullOr bool; - }; - saveAfterCopy = mkOption { - description = '' - Save image after copy - ''; - type = with types; nullOr bool; - }; - saveAsFileExtension = mkOption { - description = '' - Default file extension for screenshots - ''; - type = with types; nullOr (addCheck filename (hasPrefix ".")); - }; - safeLastRegion = mkOption { - type = with types; nullOr bool; - }; - savePath = mkOption { - description = '' - Image Save Path - ''; - type = with types; nullOr absolute-pathname; - }; - savePathFixed = mkOption { - description = '' - Whether the savePath is a fixed path - ''; - type = with types; nullOr bool; - }; - showDesktopNotification = mkOption { - description = '' - Show desktop notifications - ''; - type = with types; nullOr bool; - }; - showHelp = mkOption { - description = '' - Show the help screen on startup - ''; - type = with types; nullOr bool; - }; - showMagnifier = mkOption { - type = with types; nullOr bool; - }; - showSelectionGeometry = mkOption { - type = with types; nullOr (boundedInt 0 5); - }; - showSelectionGeometryHideTime = mkOption { - type = with types; nullOr uint; - }; - showSidePanelButton = mkOption { - description = '' - Show the side panel button - ''; - type = with types; nullOr bool; - }; - showStartupLaunchMessage = mkOption { - type = with types; nullOr bool; - }; - squareMagnifier = mkOption { - type = with types; nullOr bool; - }; - startupLaunch = mkOption { - description = '' - Launch at startup - ''; - type = with types; nullOr bool; - }; - uiColor = mkOption { - description = '' - Main UI color - ''; - type = with types; nullOr flameshot.color; - }; - undoLimit = mkOption { - type = with types; nullOr (boundedInt 0 999); - }; - uploadClientSecret = mkOption { - type = with types; nullOr str; - }; - uploadHistoryMax = mkOption { - type = with types; nullOr uint; - }; - uploadWithoutConfirmation = mkOption { - description = '' - Upload to imgur without confirmation - ''; - type = with types; nullOr bool; - }; - useJpgForClipboard = mkOption { - description = '' - Use JPG format instead of PNG - ''; - type = with types; nullOr bool; - }; - userColors = mkOption { - apply = value: - if value != null then - concatStringsSep ", " value - else - null; - description = '' - List of colors for color picker - The colors are arranged counter-clockwise with the first being set - to the right of the cursor. "picker" adds a custom color picker. - ''; - type = - with types; - nullOr (listOf (either flameshot.color (enum ["picker"]))); - }; - }; - Shortcuts = genAttrs [ - # Generated with: - # nix-shell -p flameshot-once.dev --run get-Shortcuts - "TYPE_ACCEPT" - "TYPE_ARROW" - "TYPE_CIRCLE" - "TYPE_CIRCLECOUNT" - "TYPE_COMMIT_CURRENT_TOOL" - "TYPE_COPY" - "TYPE_DELETE_CURRENT_TOOL" - "TYPE_DRAWER" - "TYPE_EXIT" - "TYPE_IMAGEUPLOADER" - "TYPE_INVERT" - "TYPE_MARKER" - "TYPE_MOVESELECTION" - "TYPE_MOVE_DOWN" - "TYPE_MOVE_LEFT" - "TYPE_MOVE_RIGHT" - "TYPE_MOVE_UP" - "TYPE_OPEN_APP" - "TYPE_PENCIL" - "TYPE_PIN" - "TYPE_PIXELATE" - "TYPE_RECTANGLE" - "TYPE_REDO" - "TYPE_RESIZE_DOWN" - "TYPE_RESIZE_LEFT" - "TYPE_RESIZE_RIGHT" - "TYPE_RESIZE_UP" - "TYPE_SAVE" - "TYPE_SELECTION" - "TYPE_SELECTIONINDICATOR" - "TYPE_SELECT_ALL" - "TYPE_SIZEDECREASE" - "TYPE_SIZEINCREASE" - "TYPE_SYM_RESIZE_DOWN" - "TYPE_SYM_RESIZE_LEFT" - "TYPE_SYM_RESIZE_RIGHT" - "TYPE_SYM_RESIZE_UP" - "TYPE_TEXT" - "TYPE_TOGGLE_PANEL" - "TYPE_UNDO" - ] (name: mkOption { - default = null; - type = with types; nullOr str; - }); - }; - }; -} diff --git a/krebs/5pkgs/simple/flameshot-once/default.nix b/krebs/5pkgs/simple/flameshot-once/default.nix deleted file mode 100644 index 3626409f3..000000000 --- a/krebs/5pkgs/simple/flameshot-once/default.nix +++ /dev/null @@ -1,149 +0,0 @@ -{ name ? "flameshot-once", pkgs, ... }@args: -with pkgs.stockholm.lib; - -let - # config cannot be declared in the input attribute set because that would - # cause callPackage to inject the wrong config. Instead, get it from ... - # via args. - config = args.config or {}; - - cfg = evalModulesConfig (singleton { - _file = toString ./default.nix; - _module.args.pkgs = pkgs; - imports = [ - config - ./config.nix - ]; - }); -in - -pkgs.symlinkJoin { - inherit name; - paths = [ - (pkgs.write "flameshot-once" { - "/bin/flameshot-once" = { - executable = true; - text = /* sh */ '' - #! ${pkgs.dash}/bin/dash - export PATH=${makeBinPath [ - pkgs.qt5.qtbase - ]}:''${PATH+:$PATH} - ${optionalString (config != null) /* sh */ '' - export XDG_CONFIG_HOME=${placeholder "out"}/etc - ${optionalString cfg.imgur.enable /* sh */ '' - export IMGUR_CREATE_URL=${shell.escape cfg.imgur.createUrl} - export IMGUR_DELETE_URL=${shell.escape cfg.imgur.deleteUrl} - ${optionalString cfg.imgur.xdg-open.enable /* sh */ '' - export PATH=${placeholder "out"}/lib/imgur/bin''${PATH+:$PATH} - ''} - ''} - ''} - ${cfg.package}/bin/flameshot & - exec ${cfg.package}/bin/flameshot gui - ''; - }; - "/etc/flameshot/flameshot.ini".text = - lib.generators.toINI {} (stripAttr cfg.settings); - ${if cfg.imgur.enable then "/lib/imgur/bin/xdg-open" else null} = { - executable = true; - text = /* sh */ '' - #! ${pkgs.dash}/bin/dash - set -efu - uri=$1 - prefix=$(${pkgs.coreutils}/bin/dirname "$uri") - case $prefix in - (${shell.escape cfg.imgur.xdg-open.createPrefix}) - echo "opening image in browser: $uri" >&2 - exec ${config.imgur.xdg-open.browser} "$uri" - ;; - (${shell.escape cfg.imgur.xdg-open.deletePrefix}) - echo "deleting image: $uri" >&2 - exec ${pkgs.curl}/bin/curl -fsS -X DELETE "$uri" - ;; - (*) - echo "don't know how to open URI: $uri" >&2 - exit 1 - esac - ''; - }; - }) - ]; -} -// { - dev = pkgs.write "flameshot-once-tools" { - "/bin/get-buttonTypes" = { - executable = true; - text = /* sh */ '' - #! ${pkgs.dash}/bin/dash - indent=$(${placeholder "out"}/bin/indent-of buttonTypes) - src=${cfg.package.src}/src/tools/capturetool.h - ${pkgs.coreutils}/bin/cat "$src" | - ${pkgs.gnused}/bin/sed -nr ' - s/^\s*(TYPE_\S+)\s*=\s*([0-9]+),/\1 = \2;/p - ' | - ${placeholder "out"}/bin/prefix " $indent" - ''; - }; - "/bin/get-iterableButtonTypes" = { - executable = true; - text = /* sh */ '' - #! ${pkgs.dash}/bin/dash - indent=$(${placeholder "out"}/bin/indent-of iterableButtonTypes) - src=${cfg.package.src}/src/widgets/capture/capturetoolbutton.cpp - ${pkgs.coreutils}/bin/cat "$src" | - ${pkgs.gnused}/bin/sed -n '/\<iterableButtonTypes = {/,/^}/p' | - ${pkgs.gcc}/bin/cpp | - ${pkgs.coreutils}/bin/tr , \\n | - ${pkgs.gnused}/bin/sed -rn 's/^ *CaptureTool::(TYPE_[A-Z_]+).*/"\1"/p' | - ${pkgs.coreutils}/bin/sort | - ${placeholder "out"}/bin/prefix " $indent" - ''; - }; - "/bin/get-recognizedGeneralOptions" = { - executable = true; - text = /* sh */ '' - #! ${pkgs.dash}/bin/dash - src=${cfg.package.src}/src/utils/confighandler.cpp - ${pkgs.coreutils}/bin/cat "$src" | - ${pkgs.gnused}/bin/sed -n '/\<recognizedGeneralOptions = {/,/^};/p' | - ${pkgs.gcc}/bin/cpp | - ${pkgs.gnugrep}/bin/grep -F OPTION | - ${pkgs.coreutils}/bin/sort - ''; - }; - "/bin/get-Shortcuts" = { - executable = true; - text = /* sh */ '' - #! ${pkgs.dash}/bin/dash - indent=$(${placeholder "out"}/bin/indent-of Shortcuts) - src=${cfg.package.src}/src/utils/confighandler.cpp - ${pkgs.coreutils}/bin/cat "$src" | - ${pkgs.gnused}/bin/sed -n '/recognizedShortcuts = {/,/^};/p ' | - ${pkgs.gcc}/bin/cpp | - ${pkgs.gnused}/bin/sed -nr 's/^\s*SHORTCUT\("(TYPE_[^"]+).*/"\1"/p' | - ${pkgs.coreutils}/bin/sort | - ${placeholder "out"}/bin/prefix " $indent" - ''; - }; - "/bin/indent-of" = { - executable = true; - text = /* sh */ '' - #! ${pkgs.dash}/bin/dash - # usage: indent-of NAME NIX_FILE - exec ${pkgs.gawk}/bin/awk -v name="$1" ' - $1 == name && $2 == "=" { - sub("[^ ].*", "") - print - } - ' ${./config.nix} - ''; - }; - "/bin/prefix" = { - executable = true; - text = /* sh */ '' - #! ${pkgs.dash}/bin/dash - ${pkgs.gawk}/bin/awk -v prefix="$1" '{ print prefix $0 }' - ''; - }; - }; -} diff --git a/krebs/5pkgs/simple/flameshot-once/flameshot/default.nix b/krebs/5pkgs/simple/flameshot-once/flameshot/default.nix deleted file mode 100644 index f60acef08..000000000 --- a/krebs/5pkgs/simple/flameshot-once/flameshot/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs }: - -pkgs.flameshot.overrideAttrs (old: rec { - name = "flameshot-${version}"; - version = "12.1.0-pre"; - src = pkgs.fetchFromGitHub { - owner = "flameshot-org"; - repo = "flameshot"; - rev = "f7e41f4d708e50eeaec892408069da25a28e04a2"; - hash = "sha256-fZquXY0xSaN1hJgCh16MocIlvxHe1c2Nt+fGF2NIOVw="; - }; - patches = old.patches or [] ++ [ - ./flameshot-12.imgur.patch - ./flameshot-12.history.patch - ]; -}) diff --git a/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch b/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch deleted file mode 100644 index 66f28a661..000000000 --- a/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.history.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/src/utils/history.cpp b/src/utils/history.cpp -index f3ee09d0..7c85c34b 100644 ---- a/src/utils/history.cpp -+++ b/src/utils/history.cpp -@@ -76,9 +76,9 @@ const HistoryFileName& History::unpackFileName(const QString& fileNamePacked) - int nPathIndex = fileNamePacked.lastIndexOf("/"); - QStringList unpackedFileName; - if (nPathIndex == -1) { -- unpackedFileName = fileNamePacked.split("-"); -+ unpackedFileName = fileNamePacked.split("|"); - } else { -- unpackedFileName = fileNamePacked.mid(nPathIndex + 1).split("-"); -+ unpackedFileName = fileNamePacked.mid(nPathIndex + 1).split("|"); - } - - switch (unpackedFileName.length()) { -@@ -109,9 +109,9 @@ const QString& History::packFileName(const QString& storageType, - if (storageType.length() > 0) { - if (deleteToken.length() > 0) { - m_packedFileName = -- storageType + "-" + deleteToken + "-" + m_packedFileName; -+ storageType + "|" + deleteToken + "|" + m_packedFileName; - } else { -- m_packedFileName = storageType + "-" + m_packedFileName; -+ m_packedFileName = storageType + "|" + m_packedFileName; - } - } - return m_packedFileName; diff --git a/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch b/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch deleted file mode 100644 index b6c3f497a..000000000 --- a/krebs/5pkgs/simple/flameshot-once/flameshot/flameshot-12.imgur.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/src/tools/imgupload/storages/imgur/imguruploader.cpp b/src/tools/imgupload/storages/imgur/imguruploader.cpp -index d6748b5a..5bb8d7de 100644 ---- a/src/tools/imgupload/storages/imgur/imguruploader.cpp -+++ b/src/tools/imgupload/storages/imgur/imguruploader.cpp -@@ -16,6 +16,7 @@ - #include <QNetworkRequest> - #include <QShortcut> - #include <QUrlQuery> -+#include <stdlib.h> - - ImgurUploader::ImgurUploader(const QPixmap& capture, QWidget* parent) - : ImgUploaderBase(capture, parent) -@@ -70,7 +71,13 @@ void ImgurUploader::upload() - QString description = FileNameHandler().parsedPattern(); - urlQuery.addQueryItem(QStringLiteral("description"), description); - -- QUrl url(QStringLiteral("https://api.imgur.com/3/image")); -+ const char *IMGUR_CREATE_URL = secure_getenv("IMGUR_CREATE_URL"); -+ QString createUrlPattern = -+ IMGUR_CREATE_URL != NULL -+ ? QString::fromUtf8(IMGUR_CREATE_URL) -+ : QStringLiteral("https://api.imgur.com/3/image") -+ ; -+ QUrl url(createUrlPattern); - url.setQuery(urlQuery); - QNetworkRequest request(url); - request.setHeader(QNetworkRequest::ContentTypeHeader, -@@ -87,8 +94,14 @@ void ImgurUploader::deleteImage(const QString& fileName, - const QString& deleteToken) - { - Q_UNUSED(fileName) -+ const char *IMGUR_DELETE_URL = secure_getenv("IMGUR_DELETE_URL"); -+ QString deleteImageURLPattern = -+ IMGUR_DELETE_URL != NULL -+ ? QString::fromUtf8(IMGUR_DELETE_URL) -+ : QStringLiteral("https://imgur.com/delete/%1") -+ ; - bool successful = QDesktopServices::openUrl( -- QUrl(QStringLiteral("https://imgur.com/delete/%1").arg(deleteToken))); -+ QUrl(deleteImageURLPattern.arg(deleteToken))); - if (!successful) { - notification()->showMessage(tr("Unable to open the URL.")); - } diff --git a/krebs/5pkgs/simple/krebs-pages/fixtures/index.html b/krebs/5pkgs/simple/krebs-pages/fixtures/index.html index 68b2cbad6..040580520 100644 --- a/krebs/5pkgs/simple/krebs-pages/fixtures/index.html +++ b/krebs/5pkgs/simple/krebs-pages/fixtures/index.html @@ -26,7 +26,7 @@ <body> <p><a href='https://cgit.krebsco.de/krops/about/'>krops</a></p> <p><a href='https://github.com/krebs/cholerab/blob/master/thesauron.adoc'>Thesauron</a></p> - <p><a href='https://nixos.wiki/'>Project: The new NixOS wiki</a></p> + <p><a href='https://wiki.nixos.org/'>Project: The new NixOS wiki</a></p> <p><a target="_blank" href="https://www.amazon.de/?&_encoding=UTF8&tag=krebscode06-21&linkCode=ur2&linkId=d4430b368b8aceeca92101cd4a4cdd1d&camp=1638&creative=6742">Go through this amazon affiliate link and generate krebsgold</a><img src="//ir-de.amazon-adsystem.com/e/ir?t=krebscode06-21&l=ur2&o=3" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p> <p> <a href="https://s.click.aliexpress.com/e/_A5luNt" target="_parent">Go through this aliexpress affiliate link and generate krebsgold</a></p> diff --git a/krebs/5pkgs/simple/pager.nix b/krebs/5pkgs/simple/pager.nix deleted file mode 100644 index adc2cc67b..000000000 --- a/krebs/5pkgs/simple/pager.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ pkgs }: - -pkgs.symlinkJoin { - name = "pager-wrapper"; - paths = [ - (pkgs.writeDashBin "pager" '' - # usage: pager {view,shift,shiftview} - # - # Environment variables - # - # PAGER_NAME (default: Pager) - # The environment variables specifies the application name under - # which resources are to be obtained. PAGER_NAME should not contain - # “.” or “*” characters. - # - set -efu - - pidfile=$XDG_RUNTIME_DIR/pager.lock - name=''${PAGER_NAME-Pager} - - if test -e "$pidfile" && - ${pkgs.procps}/bin/pgrep --pidfile="$pidfile" >/dev/null - then - ${pkgs.procps}/bin/pkill --pidfile="$pidfile" - ${pkgs.coreutils}/bin/rm "$pidfile" - exit - fi - - echo $$ > "$pidfile" - - exec ${pkgs.xterm}/bin/xterm \ - -name "$name" \ - -ti vt340 \ - -xrm '*geometry: 32x10' \ - -xrm '*internalBorder: 2' \ - -e ${pkgs.haskellPackages.desktop-pager}/bin/pager "$@" - '') - pkgs.haskellPackages.pager - ]; -} diff --git a/krebs/5pkgs/simple/q-power_supply.nix b/krebs/5pkgs/simple/q-power_supply.nix deleted file mode 100644 index ef133bfbd..000000000 --- a/krebs/5pkgs/simple/q-power_supply.nix +++ /dev/null @@ -1,146 +0,0 @@ -{ gawk, gnused, writeDashBin }: - -writeDashBin "q-power_supply" '' - power_supply() {( - set -efu - uevent=$1 - eval "$(${gnused}/bin/sed -n ' - s/^\([A-Z_]\+=[0-9A-Za-z_-]*\)$/export \1/p - ' $uevent)" - case $POWER_SUPPLY_NAME in - AC|Mains) - exit # not battery - ;; - esac - exec </dev/null - exec ${gawk}/bin/awk ' - function die(s) { - printf "%s: %s\n", name, s - exit 1 - } - - function print_hm(h, m) { - m = (h - int(h)) * 60 - return sprintf("%dh%dm", h, m) - } - - function print_bar(r) { - return \ - (r >= .1 ? bar_gradient[0] : bar_background) "■" \ - (r >= .2 ? bar_gradient[1] : bar_background) "■" \ - (r >= .3 ? bar_gradient[2] : bar_background) "■" \ - (r >= .4 ? bar_gradient[3] : bar_background) "■" \ - (r >= .5 ? bar_gradient[4] : bar_background) "■" \ - (r >= .6 ? bar_gradient[5] : bar_background) "■" \ - (r >= .7 ? bar_gradient[6] : bar_background) "■" \ - (r >= .8 ? bar_gradient[7] : bar_background) "■" \ - (r >= .9 ? bar_gradient[8] : bar_background) "■" \ - (r >= 1 ? bar_gradient[9] : bar_background) "■" \ - sgr() - } - - function rgb(r, g, b) { - return sgr("38;2;" r ";" g ";" b) - } - - function sgr(p) { - return "\x1b[" p "m" - } - - BEGIN { - bar_gradient[0] = rgb(216, 100, 83) - bar_gradient[1] = rgb(210, 113, 72) - bar_gradient[2] = rgb(201, 125, 65) - bar_gradient[3] = rgb(190, 137, 63) - bar_gradient[4] = rgb(178, 148, 67) - bar_gradient[5] = rgb(166, 158, 75) - bar_gradient[6] = rgb(153, 167, 88) - bar_gradient[7] = rgb(140, 174, 104) - bar_gradient[8] = rgb(127, 181, 122) - bar_gradient[9] = rgb(116, 187, 141) - bar_background = rgb( 64, 64, 64) - } - - END { - name = ENVIRON["POWER_SUPPLY_NAME"] - status = ENVIRON["POWER_SUPPLY_STATUS"] - - charge_unit = "Ah" - charge_now = ENVIRON["POWER_SUPPLY_CHARGE_NOW"] / 10^6 - charge_full = ENVIRON["POWER_SUPPLY_CHARGE_FULL"] / 10^6 - - current_unit = "A" - current_now = ENVIRON["POWER_SUPPLY_CURRENT_NOW"] / 10^6 - - energy_unit = "Wh" - energy_now = ENVIRON["POWER_SUPPLY_ENERGY_NOW"] / 10^6 - energy_full = ENVIRON["POWER_SUPPLY_ENERGY_FULL"] / 10^6 - - power_unit = "W" - power_now = ENVIRON["POWER_SUPPLY_POWER_NOW"] / 10^6 - - voltage_unit = "V" - voltage_now = ENVIRON["POWER_SUPPLY_VOLTAGE_NOW"] / 10^6 - voltage_min_design = ENVIRON["POWER_SUPPLY_VOLTAGE_MIN_DESIGN"] / 10^6 - - #printf "charge_now: %s\n", charge_now - #printf "charge_full: %s\n", charge_full - #printf "current_now: %s\n", current_now - #printf "energy_now: %s\n", energy_now - #printf "energy_full: %s\n", energy_full - #printf "energy_full: %s\n", ENVIRON["POWER_SUPPLY_ENERGY_FULL"] - #printf "energy_full: %s\n", ENVIRON["POWER_SUPPLY_ENERGY_FULL"] / 10^6 - #printf "power_now: %s\n", power_now - #printf "voltage_now: %s\n", voltage_now - - if (current_now == 0 && voltage_now != 0) { - current_now = power_now / voltage_now - } - if (power_now == 0) { - power_now = current_now * voltage_now - } - if (charge_now == 0 && voltage_min_design != 0) { - charge_now = energy_now / voltage_min_design - } - if (energy_now == 0) { - energy_now = charge_now * voltage_min_design - } - if (charge_full == 0 && voltage_min_design != 0) { - charge_full = energy_full / voltage_min_design - } - if (energy_full == 0) { - energy_full = charge_full * voltage_min_design - } - - if (charge_now == 0 || charge_full == 0) { - die("unknown charge") - } - - charge_ratio = charge_now / charge_full - - out = out name - out = out sprintf(" %s", print_bar(charge_ratio)) - out = out sprintf(" %d%", charge_ratio * 100) - out = out sprintf(" %.2f%s", charge_now, charge_unit) - if (current_now != 0) { - out = out sprintf("/%.1f%s", current_now, cur |