File: package.nix

package info (click to toggle)
picom 13-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,432 kB
  • sloc: ansic: 25,725; python: 685; sh: 365; makefile: 11
file content (110 lines) | stat: -rw-r--r-- 2,063 bytes parent folder | download
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
101
102
103
104
105
106
107
108
109
110
{
  asciidoctor,
  dbus,
  docbook_xml_dtd_45,
  docbook_xsl,
  llvmPackages,
  lib,
  libconfig,
  libev,
  libGL,
  libepoxy,
  libX11,
  libxcb,
  makeWrapper,
  meson,
  ninja,
  pcre2,
  pixman,
  pkg-config,
  python3,
  stdenv,
  uthash,
  xcbutil,
  xcbutilimage,
  xcbutilrenderutil,
  xorgproto,
  xwininfo,
  withDebug ? false,
  withDocs ? false,
  withTools ? false,
  git-ignore-nix,
  devShell ? false,
}:

let
  versionFromMeson =
    s: builtins.head (builtins.match "project\\('picom',.*version: *'([0-9.]*)'.*" s);
in
stdenv.mkDerivation (finalAttrs: {
  pname = "picom";
  version = versionFromMeson (builtins.readFile ./meson.build);

  src = git-ignore-nix.lib.gitignoreSource ./.;

  strictDeps = true;

  nativeBuildInputs = [
    makeWrapper
    meson
    ninja
    pkg-config
  ]
  ++ (lib.optional devShell [
    llvmPackages.clang-tools
    llvmPackages.clang-unwrapped.python
    llvmPackages.libllvm
    (python3.withPackages (
      ps: with ps; [
        xcffib
        pip
        dbus-next
        pygit2
      ]
    ))
  ])
  ++ (lib.optional withDocs [
    asciidoctor
    docbook_xml_dtd_45
    docbook_xsl
  ]);

  buildInputs = [
    dbus
    libconfig
    libev
    libGL
    libepoxy
    libX11
    libxcb
    pcre2
    pixman
    uthash
    xcbutil
    xcbutilimage
    xcbutilrenderutil
    xorgproto
  ];

  # Use "debugoptimized" instead of "debug" so perhaps picom works better in
  # normal usage too, not just temporary debugging.
  mesonBuildType = if withDebug then "debugoptimized" else "release";
  dontStrip = withDebug;

  mesonFlags = [
    (lib.mesonBool "with_docs" withDocs)
  ];

  installFlags = [ "PREFIX=$(out)" ];

  # In debug mode, also copy src directory to store. If you then run `gdb picom`
  # in the bin directory of picom store path, gdb finds the source files.
  postInstall =
    lib.optionalString withTools ''
      wrapProgram $out/bin/picom-trans \
        --prefix PATH : ${lib.makeBinPath [ xwininfo ]}
    ''
    + lib.optionalString withDebug ''
      cp -r ../src $out/
    '';
})