summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/cl/clerk/package.nix
blob: fac71dda786c674803f4afada532639fbf31c11b (plain)
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
{
  lib,
  fetchFromGitHub,
  fzf,
  installShellFiles,
  libnotify,
  makeWrapper,
  mpc,
  perlPackages,
  rofi,
  stdenv,
  tmux,
  unstableGitUpdater,
  util-linux,
}:

stdenv.mkDerivation {
  pname = "clerk";
  version = "0-unstable-2024-02-20";

  src = fetchFromGitHub {
    owner = "carnager";
    repo = "clerk";
    rev = "a3c4a0b88597e8194a5b29a20bc9eab1a12f4de9";
    hash = "sha256-UlACMlH4iYj1l/GIpBf6Pb7MuRHWlgxLPgAqzc+Zol8=";
  };

  nativeBuildInputs = [
    installShellFiles
    makeWrapper
  ];

  buildInputs = with perlPackages; [
    perl
    DataMessagePack
    DataSectionSimple
    ConfigSimple
    TryTiny
    IPCRun
    HTTPDate
    FileSlurper
    ArrayUtils
    NetMPD
  ];

  dontBuild = true;

  strictDeps = true;

  postPatch = ''
    substituteInPlace clerk_rating_client.service \
      --replace "/usr" "$out"
  '';

  installPhase = ''
    runHook preInstall

    mv clerk.pl clerk
    installBin clerk clerk_rating_client
    install -D clerk_rating_client.service $out/lib/systemd/user/clerk_rating_client.service

    runHook postInstall
  '';

  postFixup =
    let
      binPath = lib.makeBinPath [
        fzf
        libnotify
        mpc
        rofi
        tmux
        util-linux
      ];
    in
    ''
      for f in clerk clerk_rating_client; do
        wrapProgram $out/bin/$f \
          --prefix PATH : "${binPath}" \
          --set PERL5LIB $PERL5LIB
      done
    '';

  passthru.updateScript = unstableGitUpdater {
    url = "https://github.com/carnager/clerk.git";
    hardcodeZeroVersion = true;
  };

  meta = {
    homepage = "https://github.com/carnager/clerk";
    description = "MPD client based on rofi/fzf";
    license = lib.licenses.mit;
    mainProgram = "clerk";
    maintainers = with lib.maintainers; [
      anderspapitto
      wineee
    ];
    platforms = lib.platforms.linux;
  };
}