about summary refs log tree commit diff
path: root/pkgs/by-name/ra/ratslap/package.nix
blob: 6ea5cc191652cf09f500c1759c010adeceba653c (plain) (blame)
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
{ stdenv
, lib
, fetchFromGitHub
, libusb1
, pkg-config
, installShellFiles
, git
}:

stdenv.mkDerivation rec {
  pname = "ratslap";
  version = "0.4.1";

  src = fetchFromGitHub {
    owner = "krayon";
    repo = "ratslap";
    rev = version;
    sha256 = "sha256-PO/79tTiO4TBtojrEtkSf5W6zuG+Ml2iJGAtYHDwHEY=";
    leaveDotGit = true;
  };

  nativeBuildInputs = [
    pkg-config
    installShellFiles
    git
  ];

  buildInputs = [
    libusb1
  ];

  preBuild = ''
    makeFlagsArray+=(
      "-W gitup"
      "VDIRTY="
      "MAJVER=${version}"
      "APPBRANCH=main"
      "BINNAME=${pname}"
      "MARKDOWN_GEN="
      "BUILD_DATE=$(git show -s --date=format:'%Y-%m-%d %H:%M:%S%z' --format=%cd)"
      "BUILD_MONTH=$(git show -s --date=format:'%B' --format=%cd)"
      "BUILD_YEAR=$(git show -s --date=format:'%Y' --format=%cd)"
    )
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp ratslap $out/bin

    mv manpage.1 ${pname}.1
    installManPage ${pname}.1

    runHook postInstall
  '';

  meta = with lib; {
    description = "Configure G300 and G300s Logitech mice";
    longDescription = ''
      A tool to configure Logitech mice on Linux. Supports remapping
      all buttons and configuring modes, DPI settings and the LED.
    '';
    homepage = "https://github.com/krayon/ratslap";
    changelog = "https://github.com/krayon/ratslap/releases/tag/${version}";
    license = licenses.gpl2Only;
    maintainers = with maintainers; [ zebreus ];
    platforms = platforms.all;
  };
}