diff options
Diffstat (limited to 'pkgs/simple')
35 files changed, 1733 insertions, 0 deletions
diff --git a/pkgs/simple/alacritty-tv.nix b/pkgs/simple/alacritty-tv.nix new file mode 100644 index 0000000..efbcc6e --- /dev/null +++ b/pkgs/simple/alacritty-tv.nix @@ -0,0 +1,155 @@ +{ lib +, pkgs +, variant ? "x220" +}: + +let + mylib = import ../../lib/pure.nix { + inherit lib; + }; + font-size = arg: { + program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty"; + args = [arg]; + }; + configs.default = lib.recursiveUpdate variants.${variant} { + bell.animation = "EaseOut"; + bell.duration = 50; + bell.color = "#ff00ff"; + colors.cursor.cursor = "#f042b0"; + colors.primary.background = "#202020"; + colors.primary.foreground = "#d0d7d0"; + colors.normal.black = "#000000"; + colors.normal.red = "#cd0000"; + colors.normal.green = "#00cd00"; + colors.normal.yellow = "#bc7004"; + colors.normal.blue = "#4343be"; + colors.normal.magenta = "#cb06cb"; + colors.normal.cyan = "#04c9c9"; + colors.normal.white = "#bebebe"; + colors.bright.black = "#727272"; + colors.bright.red = "#fb6262"; + colors.bright.green = "#72fb72"; + colors.bright.yellow = "#fbfb72"; + colors.bright.blue = "#7272fb"; + colors.bright.magenta = "#fb53fb"; + colors.bright.cyan = "#72fbfb"; + colors.bright.white = "#fbfbfb"; + draw_bold_text_with_bright_colors = true; + hints.enabled = [ + { + regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\s{-}\\^⟨⟩`]+"; + mouse.enabled = true; + post_processing = true; + action = "Select"; + } + ]; + scrolling.multiplier = 8; + }; + configs.root = lib.recursiveUpdate configs.default { + colors.primary.background = "#230000"; + colors.primary.foreground = "#e0c0c0"; + colors.normal.black = "#800000"; + }; + configs.fzmenu = lib.recursiveUpdate configs.default { + colors.primary.background = "#2A172A"; + window.dimensions.columns = 70; + window.dimensions.lines = 9; + }; + variants.hidpi = { + font.normal.family = "iosevka tv 2 Light"; + font.italic.family = "iosevka tv 2 Light"; + font.bold.family = "iosevka tv 2 Medium"; + font.bold_italic.family = "iosevka tv 2 Medium"; + font.size = 5; + key_bindings = [ + { key = "Up"; mods = "Control"; action = "IncreaseFontSize"; } + { key = "Down"; mods = "Control"; action = "DecreaseFontSize"; } + { key = "Down"; mods = "Shift|Control"; action = "ResetFontSize"; } + ]; + }; + variants.x220 = { + font.normal.family = "Clean"; + font.bold.family = "Clean"; + font.bold.style = "Regular"; + font.size = 10; + key_bindings = [ + { key = "Up"; mods = "Shift|Control"; command = font-size "=14"; } + { key = "Up"; mods = "Control"; command = font-size "+1"; } + { key = "Down"; mods = "Control"; command = font-size "-1"; } + { key = "Down"; mods = "Shift|Control"; command = font-size "=0"; } + ]; + }; + writeProfile = name: config: let + config-file = + assert mylib.types.filename.check name; + pkgs.writeJSON "alacritty-tv-${name}.json" config; + in pkgs.writeText "alacritty-tv-${name}.profile" /* sh */ '' + # Use home so Alacritty can find the configuration without arguments. + # HOME will be reset once in Alacritty. + HOME=$XDG_RUNTIME_DIR/Alacritty-${name} + export HOME + + # Tell Alacritty via XDG_RUNTIME_DIR where to create sockets. + # XDG_RUNTIME_DIR needs to be reset manually. + export ALACRITTY_XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" + export BASH_EXTRA_INIT=${pkgs.writeDash "alacritty-tv.cleanup.sh" '' + XDG_RUNTIME_DIR=$ALACRITTY_XDG_RUNTIME_DIR + unset ALACRITTY_XDG_RUNTIME_DIR + unset BASH_EXTRA_INIT + ''} + export XDG_RUNTIME_DIR="$HOME" + + # Install stored configuration if it has changed. + # This allows for both declarative updates and runtime modifications. + # rust-xdg requires XDG_RUNTIME_DIR to be secure: + # https://docs.rs/xdg/2.4.1/src/xdg/lib.rs.html#311 + ${pkgs.coreutils}/bin/mkdir -m 0700 -p "$HOME" + ref=$(! test -e "$HOME"/ref || ${pkgs.coreutils}/bin/cat "$HOME"/ref) + if test "$ref" != ${config-file}; then + echo ${config-file} > "$HOME"/ref + ${pkgs.coreutils}/bin/install -m 644 ${config-file} "$HOME"/.alacritty.yml + fi + ''; +in + +pkgs.symlinkJoin { + name = "alacritty-tv"; + paths = [ + (pkgs.writeDashBin "alacritty" '' + # usage: + # alacritty [--profile=PROFILE] [--singleton] [ARGS...] + # where + # PROFILE one of ${builtins.toJSON (builtins.attrNames configs)} + + set -efu + + case ''${1-} in + ${lib.concatMapStringsSep "\n" (name: /* sh */ '' + --${mylib.shell.escape name}|--profile=${mylib.shell.escape name}) + shift + profile=${writeProfile name configs.${name}} + ;; + '') (builtins.attrNames configs)} + *) + profile=${writeProfile "default" configs.default} + ;; + esac + + + case ''${1-} in + --singleton) + shift + if ! ${pkgs.alacritty}/bin/alacritty msg create-window "$@"; then + . "$profile" + ${pkgs.alacritty}/bin/alacritty "$@" & + fi + ;; + *) + . "$profile" + exec ${pkgs.alacritty}/bin/alacritty "$@" + ;; + esac + '') + pkgs.alacritty + ]; +} diff --git a/pkgs/simple/bash-fzf-history.nix b/pkgs/simple/bash-fzf-history.nix new file mode 100644 index 0000000..f35d5e8 --- /dev/null +++ b/pkgs/simple/bash-fzf-history.nix @@ -0,0 +1,107 @@ +{ lib +, pkgs + +, edit-key ? "ctrl-e" +, exec-key ? "enter" +, edit-mark ? "${mark-prefix}${edit-key}" +, exec-mark ? "${mark-prefix}${exec-key}" +, edit-command ? "\"\"" +, exec-command ? "accept-line" +, mark-prefix ? " #FZFKEY:" +, finish-keyseq ? "\\C-x\\C-p" +, rebind-keyseq ? "\\C-x\\C-o" + +, start-keyseq ? "\\C-f" +, load-keyseq ? start-keyseq +}: let + + mylib = import ../../lib/pure.nix { + inherit lib; + }; + + script = pkgs.writeBash "bash-fzf-history.sh" '' + if ! command -v fzf >/dev/null; then + # Alternatively rewrite ${pkgs.fzf}/share/fzf/* to use absolute paths. + fzf() { + ${pkgs.fzf}/bin/fzf "$@" + } + fi + + . ${pkgs.fzf}/share/fzf/key-bindings.bash + . ${pkgs.fzf}/share/fzf/completion.bash + + FZF_DEFAULT_OPTS='${toString [ + /* sh */ "--height=40%" + /* sh */ "--inline-info" + /* sh */ "--min-height=4" + /* sh */ "--reverse" + ]}' + + __fzf_history__() ( + IFS=$'\n' + result=( $( + # To add "unknown timestamps" to each line of the history: + # sed -i '/^#[0-9]/{n;b};s/^/#1\n/' "$HISTFILE" + HISTTIMEFORMAT=$'\e[38;5;244m%Y-%m-%dT%H:%M:%S\e[m ' history | + ${pkgs.gnused}/bin/sed ' + s/\(\x1b\[[0-9;]*\)244m1970-[0-9T:-]*/\1237m????-??-??T??:??:??/ + ' | + FZF_DEFAULT_OPTS="${toString [ + /* sh */ "--ansi" + /* sh */ "--tac" + /* sh */ "--sync" + /* sh */ "-n2..,.." + /* sh */ "--tiebreak=index" + /* sh */ "--bind=ctrl-r:toggle-sort" + /* sh */ "--expect=${edit-key},${exec-key}" + /* sh */ "$FZF_DEFAULT_OPTS" + /* sh */ "+m" + ]}" \ + ${pkgs.fzf}/bin/fzf | + ${pkgs.gnused}/bin/sed ' + /^ *[0-9]/{ + s/^ *// + s/ \+/\n/;# index + s/ \+/\n/;# date + } + ' + ) ) + if test -n "$result"; then + key=''${result[0]} + index=''${result[1]} + date=''${result[2]} + command=''${result[3]} + + echo "$command${mark-prefix}$key" + else + # Ensure no empty new line gets produced when fzf was aborted. + echo '${edit-mark}' + fi + ) + + __fzf_rebind_finish_keyseq__() { + local suffix= + case $READLINE_LINE in + *'${edit-mark}') + suffix='${edit-mark}' + bind '"${finish-keyseq}": ${edit-command}' + ;; + *'${exec-mark}') + suffix='${exec-mark}' + bind '"${finish-keyseq}": ${exec-command}' + ;; + esac + READLINE_LINE=${"\${READLINE_LINE:0:-\${#suffix}}"} + } + bind -x '"${rebind-keyseq}": __fzf_rebind_finish_keyseq__' + + bind '"\C-r": reverse-search-history' + bind '"${start-keyseq}": " \C-e\C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er\e^${rebind-keyseq}${finish-keyseq}"' + + echo '# fzf key bindings loaded:' >&2 + bind -s | ${pkgs.gnugrep}/bin/grep __fzf_ >&2 + ''; +in + script.overrideAttrs (old: rec { + bind = /* sh */ ''bind -x '"${load-keyseq}": . ${script}' ''; + }) diff --git a/pkgs/simple/cr.nix b/pkgs/simple/cr.nix new file mode 100644 index 0000000..048d779 --- /dev/null +++ b/pkgs/simple/cr.nix @@ -0,0 +1,16 @@ +{ pkgs }: + +pkgs.writeDashBin "cr" '' + set -efu + if test -n "''${XDG_RUNTIME_DIR-}"; then + cache_dir=$XDG_RUNTIME_DIR/chromium-disk-cache + else + cache_dir=/tmp/chromium-disk-cache_$LOGNAME + fi + export LC_TIME=de_DE.utf8 + exec ${pkgs.chromium}/bin/chromium \ + --ssl-version-min=tls1 \ + --disk-cache-dir="$cache_dir" \ + --disk-cache-size=50000000 \ + "$@" +'' diff --git a/pkgs/simple/default.nix b/pkgs/simple/default.nix new file mode 100644 index 0000000..1c4a53b --- /dev/null +++ b/pkgs/simple/default.nix @@ -0,0 +1,22 @@ +self: super: + +let + inherit (super) lib; + + mylib = import ../../lib/pure.nix { + inherit lib; + }; + + # This callPackage will try to detect obsolete overrides. + callPackage = path: args: let + override = self.callPackage path args; + upstream = lib.optionalAttrs (override ? "name") + (super.${(builtins.parseDrvName override.name).name} or {}); + in if upstream ? "name" && + override ? "name" && + builtins.compareVersions upstream.name override.name != -1 + then builtins.trace "Upstream `${upstream.name}' gets overridden by `${override.name}'." override + else override; +in + + mylib.mapNixDir (path: callPackage path {}) ./. diff --git a/pkgs/simple/diff-so-fancy.nix b/pkgs/simple/diff-so-fancy.nix new file mode 100644 index 0000000..d57e6e7 --- /dev/null +++ b/pkgs/simple/diff-so-fancy.nix @@ -0,0 +1,50 @@ +{ fetchFromGitHub, lib, stdenv +, coreutils, git, makeWrapper, ncurses, perl +}: + +stdenv.mkDerivation rec { + name = "diff-so-fancy-${version}"; + version = "ed8cf17"; + + src = fetchFromGitHub { + owner = "so-fancy"; + repo = "diff-so-fancy"; + rev = "ed8cf1763d38bdd79ceb55a73b9ce7e30f1e184d"; + sha256 = "176qn0w2rn6mr5ymvkblyiznqq7yyibfsnnjfivcyhz69w6yr9r9"; + }; + + # Perl is needed here for patchShebangs + nativeBuildInputs = [ perl makeWrapper ]; + + buildPhase = null; + + installPhase = '' + mkdir -p $out/bin $out/lib/diff-so-fancy + + # diff-so-fancy executable searches for it's library relative to + # itself, so we are copying executable to lib, and only symlink it + # from bin/ + cp diff-so-fancy $out/lib/diff-so-fancy + cp -r lib $out/lib/diff-so-fancy + ln -s $out/lib/diff-so-fancy/diff-so-fancy $out/bin + + # ncurses is needed for `tput` + wrapProgram $out/lib/diff-so-fancy/diff-so-fancy \ + --prefix PATH : "${git}/share/git/contrib/diff-highlight" \ + --prefix PATH : "${git}/bin" \ + --prefix PATH : "${coreutils}/bin" \ + --prefix PATH : "${ncurses.out}/bin" + ''; + + meta = with lib; { + homepage = https://github.com/so-fancy/diff-so-fancy; + description = "Good-looking diffs filter for git"; + license = licenses.mit; + platforms = platforms.all; + longDescription = '' + diff-so-fancy builds on the good-lookin' output of git contrib's + diff-highlight to upgrade your diffs' appearances. + ''; + maintainers = with maintainers; [ fpletz ]; + }; +} diff --git a/pkgs/simple/disko.nix b/pkgs/simple/disko.nix new file mode 100644 index 0000000..de8f1df --- /dev/null +++ b/pkgs/simple/disko.nix @@ -0,0 +1,13 @@ +{ fetchgit }: + +let + src = fetchgit { + url = https://cgit.krebsco.de/disko; + rev = "16cd458af06d3caf687eb7d80ca3df26b71fe28c"; + sha256 = "16cd458af06d3caf687eb7d80ca3df26b71fe28c"; + }; +in + +{ + lib = import "${src}/lib"; +} diff --git a/pkgs/simple/editor-input.nix b/pkgs/simple/editor-input.nix new file mode 100644 index 0000000..931179a --- /dev/null +++ b/pkgs/simple/editor-input.nix @@ -0,0 +1,18 @@ +{ pkgs }: +pkgs.writeDashBin "editor-input" '' + exec \ + ${pkgs.utillinux}/bin/setsid -f \ + ${pkgs.with-tmpdir}/bin/with-tmpdir -t editor-input.XXXXXXXX \ + ${pkgs.writeDash "editor-input.sh" '' + f=$TMPDIR/input + ${pkgs.rxvt_unicode}/bin/urxvt -name editor-input-urxvt -e \ + ${pkgs.vim}/bin/vim --cmd ':set noeol binary' -c startinsert "$f" + if test -e "$f"; then + ${pkgs.xsel}/bin/xsel -ip < "$f" + ${pkgs.xsel}/bin/xsel -ib < "$f" + ${pkgs.xdotool}/bin/xdotool key --clearmodifiers shift+Insert + ${pkgs.xsel}/bin/xsel -dp + ${pkgs.xsel}/bin/xsel -db + fi + ''} +'' diff --git a/pkgs/simple/ff.nix b/pkgs/simple/ff.nix new file mode 100644 index 0000000..b6022c6 --- /dev/null +++ b/pkgs/simple/ff.nix @@ -0,0 +1,8 @@ +{ pkgs }: + +pkgs.writeDashBin "ff" '' + case $TOUCHSCREEN in 1) + export MOZ_USE_XINPUT2=1 + esac + exec ${pkgs.firefox}/bin/firefox "$@" +'' diff --git a/pkgs/simple/field.nix b/pkgs/simple/field.nix new file mode 100644 index 0000000..7136239 --- /dev/null +++ b/pkgs/simple/field.nix @@ -0,0 +1,6 @@ +{ gawk, writeDashBin }: + +writeDashBin "field" '' + set -u + exec ${gawk}/bin/awk -v n="$1" '{print$n}' +'' diff --git a/pkgs/simple/flameshot-once-tv.nix b/pkgs/simple/flameshot-once-tv.nix new file mode 100644 index 0000000..e3a9f9a --- /dev/null +++ b/pkgs/simple/flameshot-once-tv.nix @@ -0,0 +1,48 @@ +{ pkgs }: + +pkgs.flameshot-once.override { + name = "flameshot-once-tv"; + config.imgur.enable = true; + config.imgur.createUrl = "http://ni.r/image"; + config.imgur.deleteUrl = "http://ni.r/image/delete/%1"; + config.imgur.xdg-open.browser = "/etc/profiles/per-user/tv/bin/cr"; + config.settings.General = { + autoCloseIdleDaemon = true; + buttons = [ + "TYPE_ARROW" + "TYPE_CIRCLE" + "TYPE_CIRCLECOUNT" + "TYPE_COPY" + "TYPE_DRAWER" + "TYPE_IMAGEUPLOADER" + "TYPE_MARKER" + "TYPE_MOVESELECTION" + "TYPE_PENCIL" + "TYPE_PIXELATE" + "TYPE_RECTANGLE" + "TYPE_SAVE" + "TYPE_SELECTION" + "TYPE_TEXT" + ]; + checkForUpdates = false; + contrastOpacity = 220; + copyPathAfterSave = true; + disabledTrayIcon = true; + drawColor = "#E4002B"; + drawThickness = 8; + filenamePattern = "%FT%T%z_flameshot"; + fontFamily = "iosevka tv 2"; + savePath = "/tmp"; + savePathFixed = true; + showDesktopNotification = false; + showHelp = false; + showSidePanelButton = false; + showStartupLaunchMessage = false; + squareMagnifier = true; + uploadWithoutConfirmation = true; + }; + config.settings.Shortcuts = { + TYPE_COPY = "Return"; + TYPE_TOGGLE_PANEL = "`"; + }; +} diff --git a/pkgs/simple/font-size-alacritty.nix b/pkgs/simple/font-size-alacritty.nix new file mode 100644 index 0000000..d37f0f0 --- /dev/null +++ b/pkgs/simple/font-size-alacritty.nix @@ -0,0 +1,67 @@ +{ pkgs }: + +pkgs.writeDashBin "font-size-alacritty" '' + # usage: font-size-alacritty (+N|-N|=N) + # Increase by, decrease by, or set font size to the value N. + + set -efu + + min_size=5 + + op=''${1%%[0-9]*} + op=''${op:-=} + + value=''${1#[=+-]} + + window_id=$(${pkgs.xdotool}/bin/xdotool getactivewindow) + + current_size=$( + ${pkgs.xorg.xprop}/bin/xprop -notype -id $window_id FONT_SIZE | + ${pkgs.gnused}/bin/sed -rn 's/.* = ([0-9]+)$/\1/p' + ) + + # usage: set_font_size WINDOW_ID FONT_SIZE + set_font_size() { + ${pkgs.alacritty}/bin/alacritty msg config -w $1 font.size=$2 + ${pkgs.xorg.xprop}/bin/xprop -id $1 -f FONT_SIZE 32c -set FONT_SIZE $2 + } + + # usage: reset_font_size WINDOW_ID + reset_font_size() { + ${pkgs.alacritty}/bin/alacritty msg config -w $1 font.size=$min_size + ${pkgs.xorg.xprop}/bin/xprop -id $1 -remove FONT_SIZE + } + + # usage: make_next_size + make_next_size() { + case $op in + -) next_size=$(expr $current_size - $value) ;; + =) next_size=$value ;; + +) + next_size=$(expr $current_size + $value) + test $next_size -ge $min_size || next_size=$min_size + ;; + esac + } + + if test -z "$current_size"; then + current_size=0 + make_next_size + if test $next_size -ge $min_size; then + ${pkgs.alacritty}/bin/alacritty msg config -w $window_id \ + font.normal.family='Input Mono' \ + font.normal.style=Condensed \ + font.bold.family='Input Mono' \ + font.bold.style=Bold + set_font_size $window_id $next_size + fi + else + make_next_size + if test $next_size -ge $min_size; then + set_font_size $window_id $next_size + else + ${pkgs.alacritty}/bin/alacritty msg config -w $window_id -r + reset_font_size $window_id + fi + fi +'' diff --git a/pkgs/simple/fzmenu/bin/otpmenu b/pkgs/simple/fzmenu/bin/otpmenu new file mode 100755 index 0000000..273a408 --- /dev/null +++ b/pkgs/simple/fzmenu/bin/otpmenu @@ -0,0 +1,44 @@ +#! /bin/sh +set -efu + +#PATH= + +case ${FZMENU_PHASE-0} in + 0) + export FZMENU_PHASE=1 + exec setsid -f terminal dash "$0" + ;; + 1) + if result=$( + PASSWORD_STORE_DIR=${PASSWORD_STORE_DIR-$HOME/.password-store} + FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-} + if test -n "$FZF_DEFAULT_OPTS"; then + export FZF_DEFAULT_OPTS + fi + find -L "$PASSWORD_STORE_DIR" -type f -name 'otp.gpg' | + awk -F / -v PASSWORD_STORE_DIR="$PASSWORD_STORE_DIR" ' + { n = length(PASSWORD_STORE_DIR "/") } + $NF == "otp.gpg" { + print substr($0, 1 + n, length($0)-length("/otp.gpg")-n) + } + ' | + exec fzf \ + --history=/dev/null \ + --no-sort \ + --prompt='OTP: ' \ + ) + then + export FZMENU_PHASE=2 + export FZMENU_RESULT="$result" + setsid -f "$0" + fi + ;; + 2) + pass=$(pass otp code "$FZMENU_RESULT/otp") + printf %s "$pass" | + xdotool type -f - + ;; + *) + echo "$0: error: bad phase: $FZMENU_PHASE" >&2 + exit -1 +esac diff --git a/pkgs/simple/fzmenu/bin/passmenu b/pkgs/simple/fzmenu/bin/passmenu new file mode 100755 index 0000000..76153f5 --- /dev/null +++ b/pkgs/simple/fzmenu/bin/passmenu @@ -0,0 +1,45 @@ +#! /bin/sh +set -efu + +#PATH= + +case ${FZMENU_PHASE-0} in + 0) + export FZMENU_PHASE=1 + exec setsid -f terminal dash "$0" + ;; + 1) + if result=$( + PASSWORD_STORE_DIR=${PASSWORD_STORE_DIR-$HOME/.password-store} + FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-} + if test -n "$FZF_DEFAULT_OPTS"; then + export FZF_DEFAULT_OPTS + fi + find -L "$PASSWORD_STORE_DIR" -type f -name '*.gpg' | + awk -F / -v PASSWORD_STORE_DIR="$PASSWORD_STORE_DIR" ' + { n = length(PASSWORD_STORE_DIR "/") } + $NF == "otp.gpg" { next } + /.*\.gpg$/ { + print substr($0, 1 + n, length($0)-length(".gpg")-n) + } + ' | + exec fzf \ + --history=/dev/null \ + --no-sort \ + --prompt='pass: ' \ + ) + then + export FZMENU_PHASE=2 + export FZMENU_RESULT="$result" + setsid -f "$0" + fi + ;; + 2) + pass=$(pass show "$FZMENU_RESULT") + printf %s "$pass" | + xdotool type -f - + ;; + *) + echo "$0: error: bad phase: $FZMENU_PHASE" >&2 + exit -1 +esac diff --git a/pkgs/simple/fzmenu/default.nix b/pkgs/simple/fzmenu/default.nix new file mode 100644 index 0000000..1a285ee --- /dev/null +++ b/pkgs/simple/fzmenu/default.nix @@ -0,0 +1,50 @@ +{ lib, pkgs, stdenv }: + +let + terminal = pkgs.writeDashBin "terminal" '' + # usage: terminal COMMAND [ARGS...] + exec ${pkgs.alacritty-tv}/bin/alacritty \ + --profile=fzmenu \ + --class AlacrittyFzmenuFloat \ + -e "$@" + ''; +in + +pkgs.runCommand "fzmenu" { +} /* sh */ '' + mkdir $out + + cp -r ${./bin} $out/bin + + substituteInPlace $out/bin/otpmenu \ + --replace '#! /bin/sh' '#! ${pkgs.dash}/bin/dash' \ + --replace '#PATH=' PATH=${lib.makeBinPath [ + pkgs.coreutils + pkgs.dash + pkgs.findutils + pkgs.fzf + pkgs.gawk + (pkgs.pass.withExtensions (ext: [ + ext.pass-otp + ])) + pkgs.utillinux + pkgs.xdotool + terminal + ]} + + substituteInPlace $out/bin/passmenu \ + --replace '#! /bin/sh' '#! ${pkgs.dash}/bin/dash' \ + --replace '#PATH=' PATH=${lib.makeBinPath [ + pkgs.coreutils + pkgs.dash + pkgs.findutils + pkgs.fzf + pkgs.gawk + (pkgs.pass.withExtensions (ext: [ + ext.pass-otp + ])) + pkgs.utillinux + pkgs.xdotool + terminal + ]} +'' diff --git a/pkgs/simple/hc.nix b/pkgs/simple/hc.nix new file mode 100644 index 0000000..086445e --- /dev/null +++ b/pkgs/simple/hc.nix @@ -0,0 +1,39 @@ +{ fetchgit, lib, makeWrapper, stdenv +, coreutils, findutils, gawk, gnugrep, qrencode, texlive, utillinux, zbar +}: + +stdenv.mkDerivation rec { + name = "hc-${meta.version}"; + + src = fetchgit { + url = "https://cgit.krebsco.de/hc"; + rev = "refs/tags/v${meta.version}"; + sha256 = "09349gja22p0j3xs082kp0fnaaada14bafszn4r3q7rg1id2slfb"; + }; + + nativeBuildInputs = [ makeWrapper ]; + + buildPhase = null; + + installPhase = '' + mkdir -p $out/bin + + cp $src/bin/hc $out/bin/hc + + wrapProgram $out/bin/hc \ + --prefix PATH : ${lib.makeBinPath [ + coreutils + findutils + gawk + gnugrep + qrencode + texlive.combined.scheme-full + utillinux + zbar + ]} + ''; + + meta = { + version = "1.0.0"; + }; +} diff --git a/pkgs/simple/iosevka-tv-1.nix b/pkgs/simple/iosevka-tv-1.nix new file mode 100644 index 0000000..0f8b4d4 --- /dev/null +++ b/pkgs/simple/iosevka-tv-1.nix @@ -0,0 +1,18 @@ +{ pkgs }: + +pkgs.iosevka.override { + # https://typeof.net/Iosevka/customizer + privateBuildPlan = { + family = "iosevka tv 1"; + spacing = "term"; + serifs = "sans"; + export-glyph-names = true; + no-ligation = true; + no-cv-ss = false; + + widths.normal.shape = 600; + widths.normal.menu = 5; + widths.normal.css = "normal"; + }; + set = "tv-1"; +} diff --git a/pkgs/simple/iosevka-tv-2.nix b/pkgs/simple/iosevka-tv-2.nix new file mode 100644 index 0000000..888ba6a --- /dev/null +++ b/pkgs/simple/iosevka-tv-2.nix @@ -0,0 +1,20 @@ +{ pkgs }: + +pkgs.iosevka.override { + # https://typeof.net/Iosevka/customizer + privateBuildPlan = { + family = "iosevka tv 2"; + spacing = "term"; + serifs = "sans"; + export-glyph-names = true; + no-ligation = true; + no-cv-ss = false; + + variants.inherits = "ss10"; + + widths.normal.shape = 600; + widths.normal.menu = 5; + widths.normal.css = "normal"; + }; + set = "tv-2"; +} diff --git a/pkgs/simple/libinput-tv.nix b/pkgs/simple/libinput-tv.nix new file mode 100644 index 0000000..6f08689 --- /dev/null +++ b/pkgs/simple/libinput-tv.nix @@ -0,0 +1,11 @@ +{ pkgs }: + +pkgs.libinput.overrideAttrs (old: { + patches = old.patches or [] ++ [ + (pkgs.fetchurl { + name = "libinput-winmax2.patch"; + url = "https://github.com/4z3/libinput/commit/2d0ff41.patch"; + sha256 = "0ipsxzjf98g9w2m163gp49zl14wbxs84s0psdnvk7wfiivgcnm1f"; + }) + ]; +}) diff --git a/pkgs/simple/mpvterm/default.nix b/pkgs/simple/mpvterm/default.nix new file mode 100644 index 0000000..66ad08a --- /dev/null +++ b/pkgs/simple/mpvterm/default.nix @@ -0,0 +1,8 @@ +{ pkgs }: + +pkgs.mpv-unwrapped.overrideAttrs (old: rec { + pname = "mpvterm"; + patches = old.patches or [] ++ [ + ./mpvterm.patch + ]; +}) diff --git a/pkgs/simple/mpvterm/mpvterm.patch b/pkgs/simple/mpvterm/mpvterm.patch new file mode 100644 index 0000000..1263688 --- /dev/null +++ b/pkgs/simple/mpvterm/mpvterm.patch @@ -0,0 +1,146 @@ +commit 5ded4dac370ce5d8d727c5d3891448f942edbfdf +Author: tv <tv@krebsco.de> +Date: Sat Feb 27 22:54:55 2021 +0100 + + x11: add input forwarding support + +diff --git a/video/out/x11_common.c b/video/out/x11_common.c +index ac551fae8e..2e95451d7f 100644 +--- a/video/out/x11_common.c ++++ b/video/out/x11_common.c +@@ -25,6 +25,10 @@ + #include <string.h> + #include <assert.h> + ++#include <stdarg.h> ++#include <sys/socket.h> ++#include <sys/un.h> ++ + #include <X11/Xmd.h> + #include <X11/Xlib.h> + #include <X11/Xutil.h> +@@ -1097,6 +1101,73 @@ static void release_all_keys(struct vo *vo) + x11->win_drag_button1_down = false; + } + ++ ++#define FORWARD_START 1 ++#define FORWARD_READY 2 ++#define FORWARD_ERROR 3 ++static int forward_state = FORWARD_START; ++static int forward_fd, forward_len; ++static struct sockaddr_un forward_un; ++static char forward_buf[BUFSIZ]; ++ ++static void forward_start(void) { ++ const char *socket_path = getenv("FORWARD_SOCKET"); ++ if (socket_path == NULL) { ++ fprintf(stderr, "forward_start: environment variable FORWARD_SOCKET not set\n"); ++ forward_state = FORWARD_ERROR; ++ return; ++ } ++ ++ if ((forward_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) { ++ perror("socket"); ++ } else { ++ memset(&forward_un, 0, sizeof(forward_un)); ++ forward_un.sun_family = AF_UNIX; ++ strcpy(forward_un.sun_path, socket_path); ++ forward_len = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); ++ forward_state = FORWARD_READY; ++ } ++} ++static void forward_send(const char *fmt, ...) { ++ if (forward_st |