@@ -2,33 +2,46 @@
22
33stdenv.mkDerivation rec {
44 name = "1password-${version}";
5− version = "0.4";
6− src = if stdenv.system == "i686-linux" then fetchzip {
7− url = "https://cache.agilebits.com/dist/1P/op/pkg/v${version}/op_linux_386_v${version}.zip";
8− sha256 = "0mhlqvd3az50gnfil0xlq10855v3bg7yb05j6ndg4h2c551jrq41";
9− stripRoot = false;
10− } else fetchzip {
11− url = "https://cache.agilebits.com/dist/1P/op/pkg/v${version}/op_linux_amd64_v${version}.zip";
12− sha256 = "15cv8xi4slid9jicdmc5xx2r9ag63wcx1mn7hcgzxbxbhyrvwhyf";
13− stripRoot = false;
14− };
5+ version = "0.4.1";
6+ src =
7+ if stdenv.system == "i686-linux" then
8+ fetchzip {
9+ url = "https://cache.agilebits.com/dist/1P/op/pkg/v0.4.1/op_linux_386_v${version}.zip";
10+ sha256 = "0mv2m6rm6bdpca8vhyx213bg4kh06jl2sx8q7mnrp22c3f0yzh7f";
11+ stripRoot = false;
12+ }
13+ else if stdenv.system == "x86_64-linux" then
14+ fetchzip {
15+ url = "https://cache.agilebits.com/dist/1P/op/pkg/v0.4.1/op_linux_amd64_v${version}.zip";
16+ sha256 = "016h5jcy6jic8j3mvlnpcig9jxs22vj71gh6rrap2q950bzi6fi1";
17+ stripRoot = false;
18+ }
19+ else if stdenv.system == "x86_64-darwin" then
20+ fetchzip {
21+ url = "https://cache.agilebits.com/dist/1P/op/pkg/v0.4.1/op_darwin_amd64_v${version}.zip";
22+ sha256 = "1l0bi0f6gd4q19wn3v409gj64wp51mr0xpb09da1fl33rl5fpszb";
23+ stripRoot = false;
24+ }
25+ else throw "Architecture not supported";
1526
1627 nativeBuildInputs = [ makeWrapper ];
1728 installPhase = ''
18− mkdir -p $out/bin
19− install -D op $out/share/1password/op
20−
21− # https://github.com/NixOS/patchelf/issues/66#issuecomment-267743051
22− makeWrapper $(cat $NIX_CC/nix-support/dynamic-linker) $out/bin/op \
23− --argv0 op \
24− --add-flags $out/share/1password/op
29+ install -D op $out/bin/op
30+ '';
31+ postFixup = stdenv.lib.optionalString stdenv.isLinux ''
32+ patchelf \
33+ --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
34+ $out/bin/op
2535 '';
2636
2737 meta = with stdenv.lib; {
2838 description = "1Password command-line tool";
29− homepage = "https://blog.agilebits.com/2017/09/06/announcing-the-1password-command-line-tool-public-beta/";
39+ homepage = [
40+ "https://blog.agilebits.com/2017/09/06/announcing-the-1password-command-line-tool-public-beta/"
41+ "https://app-updates.agilebits.com/product_history/CLI"
42+ ];
3043 maintainers = with maintainers; [ joelburget ];
3144 license = licenses.unfree;
32− platforms = [ "i686-linux" "x86_64-linux" ];
45+ platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
3346 };
3447}