diff options
Diffstat (limited to 'krebs/5pkgs/simple')
49 files changed, 1310 insertions, 595 deletions
diff --git a/krebs/5pkgs/simple/K_belwagen.nix b/krebs/5pkgs/simple/K_belwagen.nix index 80d377b0..2f64bb09 100644 --- a/krebs/5pkgs/simple/K_belwagen.nix +++ b/krebs/5pkgs/simple/K_belwagen.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation { buildInputs = [ pkgs.jack1 - pkgs.pkgconfig + pkgs.pkg-config ]; patchPhase = '' diff --git a/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh b/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh index c21dc877..6978e38c 100755 --- a/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh +++ b/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh @@ -1,7 +1,7 @@ #! /bin/sh set -euf -# require flock from util-linux (pkgs.utillinux) +# require flock from util-linux (pkgs.util-linux) if test "${FLOCK-}" != "$state_file"; then exec env FLOCK="$state_file" flock "$state_file" "$0" "$@" fi diff --git a/krebs/5pkgs/simple/brain/default.nix b/krebs/5pkgs/simple/brain/default.nix index 9b125862..bf52da75 100644 --- a/krebs/5pkgs/simple/brain/default.nix +++ b/krebs/5pkgs/simple/brain/default.nix @@ -1,4 +1,4 @@ -{ pass, write, writeDash, ... }: +{ pass, runCommand, write, writeDash, ... }: write "brain" { "/bin/brain".link = writeDash "brain" '' @@ -9,4 +9,14 @@ write "brain" { PASSWORD_STORE_DIR=$HOME/brain \ exec ${pass}/bin/passmenu $@ ''; + "/share/bash-completion/completions/brain".link = + runCommand "brain-completions" { + } /* sh */ '' + sed -r ' + s/\<_pass?(_|\>)/_brain\1/g + s/\<__password_store/_brain/g + s/\<pass\>/brain/ + s/\$HOME\/\.password-store/$HOME\/brain/ + ' < ${pass}/share/bash-completion/completions/pass > $out + ''; } diff --git a/krebs/5pkgs/simple/cac-api/default.nix b/krebs/5pkgs/simple/cac-api/default.nix index 5f37f668..59cd36cd 100644 --- a/krebs/5pkgs/simple/cac-api/default.nix +++ b/krebs/5pkgs/simple/cac-api/default.nix @@ -1,5 +1,5 @@ { fetchgit, lib, stdenv -, bc, cac-cert, coreutils, curl, dash, gnugrep, gnused, inotifyTools, jq, ncurses, openssh, sshpass +, bc, cac-cert, coreutils, curl, dash, gnugrep, gnused, inotify-tools, jq, ncurses, openssh, sshpass }: stdenv.mkDerivation { @@ -26,7 +26,7 @@ stdenv.mkDerivation { curl gnugrep gnused - inotifyTools + inotify-tools jq ncurses openssh diff --git a/krebs/5pkgs/simple/certaids.nix b/krebs/5pkgs/simple/certaids.nix new file mode 100644 index 00000000..34f4c3e1 --- /dev/null +++ b/krebs/5pkgs/simple/certaids.nix @@ -0,0 +1,109 @@ +{ pkgs }: + +pkgs.write "certaids" { + "/bin/cert2json".link = pkgs.writeDash "cert2json" '' + # usage: cert2json < CERT > JSON + set -efu + + ${pkgs.openssl}/bin/openssl crl2pkcs7 -nocrl -certfile /dev/stdin | + ${pkgs.openssl}/bin/openssl pkcs7 -print_certs -text | + ${pkgs.gawk}/bin/awk -F, -f ${pkgs.writeText "cert2json.awk" '' + function abort(msg) { + print(msg) > "/dev/stderr" + exit 1 + } + + function toJSON(x, type, ret) { + type = typeof(x) + switch (type) { + case "array": + if (isArray(x)) return arrayToJSON(x) + if (isObject(x)) return objectToJSON(x) + abort("cannot render array to JSON", x) + case "number": + return numberToJSON(x) + case "string": + return stringToJSON(x) + case "strnum": + case "unassigned": + case "regexp": + case "untyped": + default: + abort("cannot render type: " type) + } + } + + function isArray(x, i, k) { + i = 1 + for (k in x) { + if (k != i++) return 0 + i++ + } + return 1 + } + + function isObject(x, k) { + for (k in x) { + if (typeof(k) != "string") return 0 + } + return 1 + } + + function arrayToJSON(x, k, ret) { + ret = "[" + for (k in x) { + ret=ret toJSON(x[k]) "," + } + sub(/,$/,"",ret) + ret=ret "]" + return ret + } + + function objectToJSON(x, k,ret) { + ret = "{" + for (k in x) { + ret = ret toJSON(k) ":" toJSON(x[k]) "," + } + sub(/,$/, "", ret) + ret = ret "}" + return ret + } + + function numberToJSON(x) { + return x + } + + function stringToJSON(x) { + gsub(/\\/, "&&",x) + gsub(/\n/, "\\n", x) + return "\"" x "\"" + } + + $1 ~ /^ *(Subject|Issuer):/ { + sub(/^ */, "") + sub(/: */, ",") + key=tolower($1) + sub(/[^,]*,/, "") + + # Normalize separators between relative distinguished names. + # [1]: RFC2253, 3. Parsing a String back to a Distinguished Name + # TODO support any distinguished name + gsub(/ *[;,] */, ",") + + for(i = 0; i <= NF; i++) { + split($i, a, "=") + cache[key][a[1]] = a[2] + } + } + + /BEGIN CERTIFICATE/,/END CERTIFICATE/{ + cache["certificate"] = cache["certificate"] $0 "\n" + } + + /END CERTIFICATE/{ + print toJSON(cache) + delete cache + } + ''} + ''; +} diff --git a/krebs/5pkgs/simple/cunicu.nix b/krebs/5pkgs/simple/cunicu.nix new file mode 100644 index 00000000..4375a760 --- /dev/null +++ b/krebs/5pkgs/simple/cunicu.nix @@ -0,0 +1,22 @@ +{ lib, pkgs }: + +pkgs.buildGo120Module rec { + pname = "cunicu"; + version = "g${lib.substring 0 7 src.rev}"; + + buildInputs = [ + pkgs.libpcap + ]; + + # XXX tries to access https://relay.cunicu.li + doCheck = false; + + src = pkgs.fetchFromGitHub { + owner = "stv0g"; + repo = "cunicu"; + rev = "3ed8109bef97a10a438e5658c41823b7f812db8e"; + hash = "sha256-FpOJ6/jmnbpufc+kgKwlLtFhOcc2CTe+FvqeV8WEGMc="; + }; + + vendorHash = "sha256-eAawhJK9K8/7FCQiYMI9XCPePYsCVF045Di7SpRZvL4="; +} diff --git a/krebs/5pkgs/simple/dic/default.nix b/krebs/5pkgs/simple/dic/default.nix index 1825e4ee..39402c01 100644 --- a/krebs/5pkgs/simple/dic/default.nix +++ b/krebs/5pkgs/simple/dic/default.nix @@ -1,5 +1,5 @@ { fetchgit, lib, stdenv -, coreutils, curl, gnugrep, gnused, utillinux +, coreutils, curl, gnugrep, gnused, util-linux }: stdenv.mkDerivation { @@ -23,7 +23,7 @@ stdenv.mkDerivation { curl gnused gnugrep - utillinux + util-linux ]; in '' diff --git a/krebs/5pkgs/simple/ergo/default.nix b/krebs/5pkgs/simple/ergo/default.nix deleted file mode 100644 index 2c9223ee..00000000 --- a/krebs/5pkgs/simple/ergo/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ buildGo117Module , fetchFromGitHub, lib }: - -buildGo117Module rec { - pname = "ergo"; - version = "2.9.1"; - - src = fetchFromGitHub { - owner = "ergochat"; - repo = "ergo"; - rev = "v${version}"; - sha256 = "sha256-RxsmkTfHymferS/FRW0sLnstKfvGXkW6cEb/JbeS4lc="; - }; - - vendorSha256 = null; - - meta = { - description = "A modern IRC server (daemon/ircd) written in Go"; - homepage = "https://github.com/ergochat/ergo"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ lassulus tv ]; - platforms = lib.platforms.linux; - }; -} diff --git a/krebs/5pkgs/simple/flameshot-once/config.nix b/krebs/5pkgs/simple/flameshot-once/config.nix new file mode 100644 index 00000000..24df403a --- /dev/null +++ b/krebs/5pkgs/simple/flameshot-once/config.nix @@ -0,0 +1,416 @@ +{ 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 index 0524c2cf..3626409f 100644 --- a/krebs/5pkgs/simple/flameshot-once/default.nix +++ b/krebs/5pkgs/simple/flameshot-once/default.nix @@ -1,28 +1,149 @@ -{ pkgs, stockholm, ... }@args: -with stockholm.lib; +{ 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 {}; -in - pkgs.symlinkJoin { - name = "flameshot-once-wrapper"; - paths = [ - (pkgs.writeDashBin "flameshot-once" '' - export PATH=${makeBinPath [ - pkgs.flameshot - pkgs.qt5.qtbase - pkgs.xclip - pkgs.xwaitforwindow |