1{ lib, stdenv, fetchFromGitHub, libedit, libsecret, ncurses, pkg-config, readline, Security }:
2
3stdenv.mkDerivation rec {
4 pname = "envchain";
5 version = "1.1.0";
6
7 src = fetchFromGitHub {
8 owner = "sorah";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "sha256-QUy38kJzMbYOyT86as4/yq2ctcszSnB8a3eVWxgd4Fo=";
12 };
13
14 postPatch = ''
15 sed -i -e "s|-ltermcap|-lncurses|" Makefile
16 '';
17
18 nativeBuildInputs = [ pkg-config ];
19
20 buildInputs = [ libsecret readline ]
21 ++ lib.optionals stdenv.isDarwin [ libedit ncurses Security ];
22
23 makeFlags = [ "DESTDIR=$(out)" ];
24
25 meta = with lib; {
26 description = "Set environment variables with macOS keychain or D-Bus secret service";
27 homepage = "https://github.com/sorah/envchain";
28 license = licenses.mit;
29 platforms = platforms.unix;
30 maintainers = with maintainers; [ ];
31 mainProgram = "envchain";
32 };
33}