summary refs log tree commit diff
path: root/pkgs/applications/display-managers/lightdm/gtk-greeter.nix
blob: b012699a16bacabe93d42e6c51b6deff5b3ac3a2 (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
71
72
73
74
75
76
77
78
79
{ lib, stdenv
, lightdm_gtk_greeter
, fetchurl
, lightdm
, pkg-config
, intltool
, linkFarm
, wrapGAppsHook
, useGTK2 ? false
, gtk2
, gtk3 # gtk3 seems better supported
, xfce4-dev-tools
, at-spi2-core
, librsvg
, hicolor-icon-theme
}:

#ToDo: bad icons with gtk2;
#  avatar icon is missing in standard hicolor theme, I don't know where gtk3 takes it from

let
  ver_branch = "2.0";
  version = "2.0.7";
in
stdenv.mkDerivation rec {
  pname = "lightdm-gtk-greeter";
  inherit version;

  src = fetchurl {
    url = "${meta.homepage}/${ver_branch}/${version}/+download/${pname}-${version}.tar.gz";
    sha256 = "1g7wc3d3vqfa7mrdhx1w9ywydgjbffla6rbrxq9k3sc62br97qms";
  };

  nativeBuildInputs = [ pkg-config intltool xfce4-dev-tools wrapGAppsHook ];
  buildInputs = [ lightdm librsvg hicolor-icon-theme ]
    ++ (if useGTK2 then [ gtk2 ] else [ gtk3 ]);

  configureFlags = [
    "--localstatedir=/var"
    "--sysconfdir=/etc"
    "--disable-indicator-services-command"
    "--sbindir=${placeholder "out"}/bin" # for wrapGAppsHook to wrap automatically
  ] ++ lib.optional useGTK2 "--with-gtk2";

  postPatch = ''
    # exo-csource has been dropped from exo, and replaced by xdt-csource from xfce4-dev-tools
    for f in configure.ac src/Makefile.am; do
      substituteInPlace $f --replace exo-csource xdt-csource
    done
  '';

  preConfigure = ''
    configureFlagsArray+=( --enable-at-spi-command="${at-spi2-core}/libexec/at-spi-bus-launcher --launch-immediately" )
  '';

  NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";

  installFlags = [
    "localstatedir=\${TMPDIR}"
    "sysconfdir=${placeholder "out"}/etc"
  ];

  postInstall = ''
    substituteInPlace "$out/share/xgreeters/lightdm-gtk-greeter.desktop" \
      --replace "Exec=lightdm-gtk-greeter" "Exec=$out/bin/lightdm-gtk-greeter"
  '';

  passthru.xgreeters = linkFarm "lightdm-gtk-greeter-xgreeters" [{
    path = "${lightdm_gtk_greeter}/share/xgreeters/lightdm-gtk-greeter.desktop";
    name = "lightdm-gtk-greeter.desktop";
  }];

  meta = with lib; {
    homepage = "https://launchpad.net/lightdm-gtk-greeter";
    platforms = platforms.linux;
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ ];
  };
}