summaryrefslogtreecommitdiffstats
path: root/pkgs/simple/fzmenu/default.nix
blob: c4dccbf1b502c5e6d5d88ebd1d0cb811c16500ca (plain)
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
{ 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.xvkbd
        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.xvkbd
        terminal
      ]}
''