-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hag.nix
104 lines (92 loc) · 2.02 KB
/
hag.nix
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
#with import <nixpkgs> {};
{ lib
, resholve
, fetchFromGitHub
, bashInteractive
, coreutils
, findutils
, gnugrep
, gnused
, shellswain
, smenu
, sqlite
, rlwrap
# history daemon
, python3
, libossp_uuid
, callPackage
}:
let
# service/daemon
in
resholve.mkDerivation rec {
pname = "hag";
version = "unreleased";
# src = fetchFromGitHub {
# owner = "abathur";
# repo = "shell-hag";
# # rev = "v${version}";
# rev = "acb6beff57438a84d0d63e7f8fddb3bed72834c6";
# hash = "sha256-eynd6be/xzg2g5kSjSOvXmIj5Nbgv8eFzlOe7EI3GQc=";
# };
src = lib.cleanSource ./.;
buildInputs = [ bashInteractive python3 ];
solutions = {
profile = {
scripts = [ "bin/hag.bash" ];
interpreter = "none";
keep = {
source = [ "$HAG_PURPOSE_PWD_FILE" ];
command = [ "$command_path" ];
rlwrap = [ "$command_path" ];
"$command_history_file" = true;
};
inputs = [
coreutils
findutils
gnugrep
shellswain
sqlite
rlwrap
];
};
cmd = {
scripts = [ "bin/hag_import_history.bash" ];
interpreter = "${bashInteractive}/bin/bash";
inputs = [
coreutils
gnused
smenu
];
};
daemon = {
scripts = [ "bin/hagd.bash" ];
# doesn't require interactive, but we already use it...
interpreter = "${bashInteractive}/bin/bash";
inputs = [
libossp_uuid
coreutils
sqlite
python3
"libexec/daemon.py"
];
fix = {
"$HAG_SRC" = [ "${placeholder "out"}" ];
};
};
};
prePatch = ''
patchShebangs daemon.py tests
'';
makeFlags = [ "prefix=${placeholder "out"}" ];
doCheck = false;
# TODO: below likely needs fixing
passthru.tests = callPackage ./test.nix { };
meta = with lib; {
description = "A shell history aggregator";
homepage = https://github.com/abathur/shell-hag;
license = licenses.mit;
maintainers = with maintainers; [ abathur ];
platforms = platforms.all;
};
}