~kaction/config

ref: 59e61027018d27fb8fcf0f9fea5708c2d88532e5 config/universe/selectors/default.nix -rw-r--r-- 875 bytes
59e61027 — Dmitry Bogatov Add new derivation "selectors" into the universe 1 year, 1 month ago
                                                                                
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
{ fzy, git, git-bug, substituteAll, execline, busybox, runCommandLocal
, writeScript }:
let
  bug = writeScript "bug-selector" ''
    #!${execline}/bin/execlineb -WS0
    pipeline { ${git-bug}/bin/git-bug ls $@ }
    pipeline { ${fzy}/bin/fzy }
    ${busybox}/bin/cut -d " " -f1
  '';
  commit = writeScript "commit-selector" ''
    #!${execline}/bin/execlineb -WS0
    pipeline {
      ${git}/bin/git
        log --date=short
            --format="%h %cd %s"
            --since="last month" $@
    } pipeline { ${fzy}/bin/fzy }
    ${busybox}/bin/cut -d " " -f1
  '';
  file = writeScript "file-selector" ''
    #!${execline}/bin/execlineb -WS0
    pipeline { ${git}/bin/git ls-files $@ }
    ${fzy}/bin/fzy
  '';
in runCommandLocal "selectors" { } ''
  mkdir -p $out/bin
  ln -sf ${bug} $out/bin/%bug
  ln -sf ${commit} $out/bin/%commit
  ln -sf ${file} $out/bin/%file
''