1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{ depot, pkgs, lib, ... }:

let
  bins = depot.nix.getBins pkgs.findutils [ "find" ]
    // depot.nix.getBins pkgs.which [ "which" ]
    // depot.nix.getBins pkgs.glib [ "gsettings" ];

in
rec {

  vim-for-cmd = depot.nix.writeExecline "vim-for-cmd" { readNArgs = 1; } [
    "backtick"
    "-iE"
    "path"
    [ bins.which "$1" ]
    "vim"
    "$path"
  ];

  findia = depot.nix.writeExecline "findia"
    {
      readNArgs = 1;
      # TODO: comment out, thanks to sterni blocking the runExecline change
      # meta.description = ''
      #   Find case-insensitive anywhere (globbing)

      #   Usage: findia <pattern> <more find(1) arguments>
      # '';
    } [
    bins.find
    "-iname"
    "*\${1}*"
    "$@"
  ];

  findial = depot.nix.writeExecline "findial"
    {
      readNArgs = 1;
      # TODO: comment out, thanks to sterni blocking the runExecline change
      # meta.description = ''
      #   Find case-insensitive anywhere (globbing), follow symlinks";

      #   Usage: findial <pattern> <more find(1) arguments>
      # '';
    } [
    bins.find
    "-L"
    "-iname"
    "*\${1}*"
    "$@"
  ];

  findian = depot.nix.writeExecline "findian"
    {
      readNArgs = 2;
      # TODO: comment out, thanks to sterni blocking the runExecline change
      # meta.description = ''
      #   Find case-insensitive anywhere (globbing) in directory

      #   Usage: findian <directory> <pattern> <more find(1) arguments>
      # '';
    } [
    bins.find
    "$1"
    "-iname"
    "*\${2}*"
    "$@"
  ];

  findiap = depot.nix.writeExecline "findiap"
    {
      readNArgs = 2;
      # TODO: comment out, thanks to sterni blocking the runExecline change
      # meta.description = ''
      #   Find case-insensitive anywhere (globbing) in directory, the pattern allows for paths.

      #   Usage: findiap <directory> <pattern> <more find(1) arguments>
      # '';
    } [
    bins.find
    "$1"
    "-ipath"
    "*\${2}*"
    "$@"
  ];

  bell = depot.nix.writeExecline "bell" { } [
    "if"
    [
      "pactl"
      "upload-sample"
      "${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/complete.oga"
      "bell-window-system"
    ]
    "pactl"
    "play-sample"
    "bell-window-system"
  ];

  prefer-dark = prefer-theme "prefer-dark";
  prefer-light = prefer-theme "prefer-light";

  # turn this command into a writeExecline call:
  prefer-theme = theme: depot.nix.writeExecline "prefer-theme" { } [
    "env"
    "GSETTINGS_SCHEMA_DIR=${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-${pkgs.gsettings-desktop-schemas.version}/glib-2.0/schemas/"
    bins.gsettings
    "set"
    "org.gnome.desktop.interface"
    "color-scheme"
    theme
  ];

}