about summary refs log tree commit diff
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2019-09-11 07:00:16 -0400
committerworldofpeace <worldofpeace@protonmail.ch>2019-09-18 11:13:42 -0400
commit7814a2f566b153fb7bc802bcc36aab7848b02484 (patch)
treeebeffaaa9241ad1b946a6078df19e1a1129cfd14
parentfeab607ae53499f235e25e0b2a370feaa87f7244 (diff)
nixos/enso-os: don't wrap in module
-rw-r--r--nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix36
-rw-r--r--pkgs/applications/display-managers/lightdm-enso-os-greeter/default.nix41
-rw-r--r--pkgs/applications/display-managers/lightdm-enso-os-greeter/fix-paths.patch24
3 files changed, 52 insertions, 49 deletions
diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix
index de128809ce307..129df139c61ab 100644
--- a/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix
+++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix
@@ -10,32 +10,6 @@ let
   icons = cfg.iconTheme.package;
   cursors = cfg.cursorTheme.package;
 
-  # We need a few things in the environment for the greeter to run with
-  # fonts/icons.
-  wrappedEnsoGreeter = pkgs.runCommand "lightdm-enso-os-greeter" {
-      buildInputs = [ pkgs.makeWrapper ];
-      preferLocalBuild = true;
-    } ''
-      # This wrapper ensures that we actually get themes
-      makeWrapper ${pkgs.lightdm-enso-os-greeter}/bin/pantheon-greeter \
-        $out/greeter \
-        --prefix PATH : "${pkgs.glibc.bin}/bin" \
-        --set GDK_PIXBUF_MODULE_FILE "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" \
-        --set GTK_PATH "${theme}:${pkgs.gtk3.out}" \
-        --set GTK_EXE_PREFIX "${theme}" \
-        --set GTK_DATA_PREFIX "${theme}" \
-        --set XDG_DATA_DIRS "${theme}/share:${icons}/share:${cursors}/share" \
-        --set XDG_CONFIG_HOME "${theme}/share"
-
-      cat - > $out/lightdm-enso-os-greeter.desktop << EOF
-      [Desktop Entry]
-      Name=LightDM Greeter
-      Comment=This runs the LightDM Greeter
-      Exec=$out/greeter
-      Type=Application
-      EOF
-    '';
-
   ensoGreeterConf = pkgs.writeText "lightdm-enso-os-greeter.conf" ''
     [greeter]
     default-wallpaper=${ldmcfg.background}
@@ -144,10 +118,16 @@ in {
   config = mkIf (ldmcfg.enable && cfg.enable) {
     environment.etc."lightdm/greeter.conf".source = ensoGreeterConf;
 
+    environment.systemPackages = [
+      cursors
+      icons
+      theme
+    ];
+
     services.xserver.displayManager.lightdm = {
       greeter = mkDefault {
-        package = wrappedEnsoGreeter;
-        name = "lightdm-enso-os-greeter";
+        package = pkgs.lightdm-enso-os-greeter.xgreeters;
+        name = "pantheon-greeter";
       };
 
       greeters = {
diff --git a/pkgs/applications/display-managers/lightdm-enso-os-greeter/default.nix b/pkgs/applications/display-managers/lightdm-enso-os-greeter/default.nix
index accdea3ae2d30..3128f125cd9eb 100644
--- a/pkgs/applications/display-managers/lightdm-enso-os-greeter/default.nix
+++ b/pkgs/applications/display-managers/lightdm-enso-os-greeter/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchgit, pkgconfig
+{ stdenv, fetchgit, pkgconfig, linkFarm, lightdm-enso-os-greeter
 , dbus, pcre, epoxy, libXdmcp, at-spi2-core, libxklavier, libxkbcommon, libpthreadstubs
-, gtk3, vala, cmake, libgee, libX11, lightdm, gdk-pixbuf, clutter-gtk }:
+, gtk3, vala, cmake, libgee, libX11, lightdm, gdk-pixbuf, clutter-gtk, wrapGAppsHook, librsvg }:
 
 stdenv.mkDerivation {
   version = "0.2.1";
@@ -12,12 +12,21 @@ stdenv.mkDerivation {
     sha256 = "11jm181jq1vbn83h235avpdxz7pqq6prqyzki5yryy53mkj4kgxz";
   };
 
+  patches = [
+    ./fix-paths.patch
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    pkgconfig
+    vala
+    wrapGAppsHook
+  ];
+
   buildInputs = [
     dbus
     gtk3
     pcre
-    vala
-    cmake
     epoxy
     libgee
     libX11
@@ -29,31 +38,21 @@ stdenv.mkDerivation {
     at-spi2-core
     libxkbcommon
     libpthreadstubs
+    librsvg
   ];
 
-  nativeBuildInputs = [
-    pkgconfig
-  ];
-
-  postPatch = ''
-    sed -i "s@\''${CMAKE_INSTALL_PREFIX}/@@" greeter/CMakeLists.txt
-  '';
-
   preConfigure = ''
     cd greeter
   '';
 
-  installFlags = [
-    "DESTDIR=$(out)"
-  ];
-
-  preFixup = ''
-    mv $out/usr/* $out
-    rm -r $out/usr
-  '';
+  passthru.xgreeters = linkFarm "enso-os-greeter-xgreeters" [{
+    path = "${lightdm-enso-os-greeter}/share/xgreeters/pantheon-greeter.desktop";
+    name = "pantheon-greeter.desktop";
+  }];
 
   postFixup = ''
-    rm -r $out/sbin
+    substituteInPlace $out/share/xgreeters/pantheon-greeter.desktop \
+      --replace "pantheon-greeter" "$out/bin/pantheon-greeter"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/display-managers/lightdm-enso-os-greeter/fix-paths.patch b/pkgs/applications/display-managers/lightdm-enso-os-greeter/fix-paths.patch
new file mode 100644
index 0000000000000..ab3ad2b10e411
--- /dev/null
+++ b/pkgs/applications/display-managers/lightdm-enso-os-greeter/fix-paths.patch
@@ -0,0 +1,24 @@
+diff --git a/greeter/CMakeLists.txt b/greeter/CMakeLists.txt
+index 57aebb0..ab50bff 100644
+--- a/greeter/CMakeLists.txt
++++ b/greeter/CMakeLists.txt
+@@ -9,7 +9,6 @@ list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+ set (CONF_DIR "/etc/lightdm")
+ set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
+ set (PKGDATADIR "${DATADIR}/enso/greeter")
+-set (CMAKE_INSTALL_PREFIX /usr)
+ set (VERSION "1.0.6")
+ 
+ 
+@@ -94,9 +93,9 @@ glib_compile_resources (GLIB_RESOURCES_CSS SOURCE data/css.gresource.xml)
+ add_executable (pantheon-greeter ${VALA_C} ${GLIB_RESOURCES_CSS})
+ target_link_libraries(pantheon-greeter m)
+ 
+-install (TARGETS pantheon-greeter RUNTIME DESTINATION sbin)
++install (TARGETS pantheon-greeter RUNTIME DESTINATION bin)
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/pantheon-greeter.desktop DESTINATION share/xgreeters)
+-install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/greeter.conf DESTINATION ${CONF_DIR})
++install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/greeter.conf DESTINATION etc/lightdm)
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/fingerprint.svg DESTINATION ${PKGDATADIR})
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/power.svg DESTINATION ${PKGDATADIR})
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/checked.svg DESTINATION ${PKGDATADIR})