{ pkgs, ... }:

# All common packages go here. Linux-specific should go in `linux.nix'

with pkgs;

let
  urwid-readline = python3.pkgs.buildPythonPackage rec {
    pname = "urwid_readline";
    version = "0.13";
    src = python3.pkgs.fetchPypi {
      inherit pname version;
      sha256 = "1x7s3vnvvhxad72skwr9rdajgbly0rmw4zg1ggc5xfv4r35j1001";
    };
    propagatedBuildInputs = [ python3Packages.urwid ];
    doCheck = false;
  };
  zulip-terminal = python3.pkgs.buildPythonApplication rec {
    pname = "zulip-terminal";
    version = "0.6.0";
    src = pkgs.fetchFromGitHub {
      owner = "zulip";
      repo = pname;
      rev = "${version}";
      sha256 = "0nah8dxgzv2q2gnkzlbc2sm68b1mlgsw8izny2p10i8mcdldjnwy";
    };
    propagatedBuildInputs = with python3Packages; [
      urwid
      zulip
      urwid-readline
      beautifulsoup4
      lxml
      pygments
      typing-extensions
      dateutil
      pytz
      tzlocal
      pyperclip
    ];
    doCheck = false;
  };

  zebra = pkgs.stdenv.mkDerivation {
    name = "zebra";
    src = fetchGit {
      url = "https://github.com/jb55/zebra";
      ref = "master";
      rev = "8fd29bc1c2e9b7b695d61e0f1329c819f57f74bb";
      #sha256 = "11apyy90n26l3c4diqg8y8m4a4ndz9mp8nr8prcxkcsckpa3vqi2";
    };
    buildPhase = "make";
    installPhase = ''
      mkdir -p $out/bin
      cp ./zebra $out/bin
    '';
  };
in {
  home.packages = [
    amfora
    asciinema
    aspellDicts.en
    bat
    barrier
    bc
    cabal2nix
    cloc
    cmatrix
    ctags
    dhall
    direnv
    entr
    eternal-terminal
    expect
    fd
    figlet
    file
    font-awesome_5
    forgit
    fossil
    gcal
    git-lfs
    git-revise
    gitAndTools.stgit
    github-cli
    gotop
    hashcash
    htop
    httpstat
    inetutils
    ispell
    jq
    lsof
    material-icons
    mononoki
    mpc_cli
    ncdu
    nmap
    ncmpc
    nix-prefetch-scripts
    nixos-generators
    noto-fonts-emoji
    obsidian
    opentimestamps-client
    ormolu
    paperkey
    pass
    perlPackages.GitAutofixup
    pianobar
    pup
    pv
    pwgen
    python37Packages.black
    python37Packages.howdoi
    qrencode
    ranger
    ripgrep
    shellcheck
    silver-searcher
    tmux
    tree
    tut
    unrar
    unzip
    urlscan
    vimpager
    w3m
    zebra
    zip
  ];
}