summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorPatrick Chilton <chpatrick@gmail.com>2019-01-09 09:52:58 +0100
committerPatrick Chilton <chpatrick@gmail.com>2019-01-21 11:17:49 +0100
commitb25095bcda9a8f8d401b7ed27f412654c905adf0 (patch)
tree053879d2b0fe59b8b0bb49d53e4956e0c0a2d0ed /pkgs
parentd06f3ca44eb76b8d1c98d56f86d7f811b2395bf0 (diff)
downloadnixpkgs-b25095bcda9a8f8d401b7ed27f412654c905adf0.tar
nixpkgs-b25095bcda9a8f8d401b7ed27f412654c905adf0.tar.gz
nixpkgs-b25095bcda9a8f8d401b7ed27f412654c905adf0.tar.bz2
nixpkgs-b25095bcda9a8f8d401b7ed27f412654c905adf0.tar.lz
nixpkgs-b25095bcda9a8f8d401b7ed27f412654c905adf0.tar.xz
nixpkgs-b25095bcda9a8f8d401b7ed27f412654c905adf0.tar.zst
nixpkgs-b25095bcda9a8f8d401b7ed27f412654c905adf0.zip
nixos/gnome3: add GNOME Flashback sessions option
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/desktops/gnome-3/core/tracker/default.nix8
-rw-r--r--pkgs/desktops/gnome-3/default.nix2
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix200
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-flashback/fix-paths.patch30
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-panel/default.nix18
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-screensaver/default.nix96
-rw-r--r--pkgs/desktops/gnome-3/misc/gnome-screensaver/fix-dbus-service-dir.patch11
7 files changed, 274 insertions, 91 deletions
diff --git a/pkgs/desktops/gnome-3/core/tracker/default.nix b/pkgs/desktops/gnome-3/core/tracker/default.nix
index 14795064cb4..d744fc6c87c 100644
--- a/pkgs/desktops/gnome-3/core/tracker/default.nix
+++ b/pkgs/desktops/gnome-3/core/tracker/default.nix
@@ -46,6 +46,14 @@ in stdenv.mkDerivation rec {
   postPatch = ''
     patchShebangs utils/g-ir-merge/g-ir-merge
     patchShebangs utils/data-generators/cc/generate
+
+    # make .desktop Exec absolute
+    patch -p0 <<END_PATCH
+    +++ src/tracker-store/tracker-store.desktop.in.in
+    @@ -4 +4 @@
+    -Exec=gdbus call -e -d org.freedesktop.DBus -o /org/freedesktop/DBus -m org.freedesktop.DBus.StartServiceByName org.freedesktop.Tracker1 0
+    +Exec=${glib.dev}/bin/gdbus call -e -d org.freedesktop.DBus -o /org/freedesktop/DBus -m org.freedesktop.DBus.StartServiceByName org.freedesktop.Tracker1 0
+    END_PATCH
   '';
 
   postInstall = ''
diff --git a/pkgs/desktops/gnome-3/default.nix b/pkgs/desktops/gnome-3/default.nix
index 8d75797516d..050a05223c4 100644
--- a/pkgs/desktops/gnome-3/default.nix
+++ b/pkgs/desktops/gnome-3/default.nix
@@ -348,6 +348,8 @@ lib.makeScope pkgs.newScope (self: with self; {
 
   gnome-panel = callPackage ./misc/gnome-panel { };
 
+  gnome-screensaver = callPackage ./misc/gnome-screensaver { };
+
   gnome-tweaks = callPackage ./misc/gnome-tweaks { };
 
   gpaste = callPackage ./misc/gpaste { };
diff --git a/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix b/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix
index fe5345f1a6e..716988252d5 100644
--- a/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix
+++ b/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix
@@ -6,6 +6,7 @@
 , glib
 , gnome-bluetooth
 , gnome-desktop
+, gnome-panel
 , gnome-session
 , gnome3
 , gsettings-desktop-schemas
@@ -16,77 +17,154 @@
 , libpulseaudio
 , libxkbfile
 , libxml2
-, metacity
 , pkgconfig
 , polkit
 , substituteAll
 , upower
-, xkeyboard_config }:
+, wrapGAppsHook
+, writeTextFile
+, writeShellScriptBin
+, xkeyboard_config
+}:
 
 let
   pname = "gnome-flashback";
   version = "3.30.0";
-in stdenv.mkDerivation rec {
-  name = "${pname}-${version}";
+  requiredComponents = wmName: "RequiredComponents=${wmName};gnome-flashback-init;gnome-flashback;gnome-panel;org.gnome.SettingsDaemon.A11ySettings;org.gnome.SettingsDaemon.Clipboard;org.gnome.SettingsDaemon.Color;org.gnome.SettingsDaemon.Datetime;org.gnome.SettingsDaemon.Housekeeping;org.gnome.SettingsDaemon.Keyboard;org.gnome.SettingsDaemon.MediaKeys;org.gnome.SettingsDaemon.Mouse;org.gnome.SettingsDaemon.Power;org.gnome.SettingsDaemon.PrintNotifications;org.gnome.SettingsDaemon.Rfkill;org.gnome.SettingsDaemon.ScreensaverProxy;org.gnome.SettingsDaemon.Sharing;org.gnome.SettingsDaemon.Smartcard;org.gnome.SettingsDaemon.Sound;org.gnome.SettingsDaemon.Wacom;org.gnome.SettingsDaemon.XSettings;";
+  gnome-flashback = stdenv.mkDerivation rec {
+    name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
-    sha256 = "18rwql2pi78155l9zp1i50xfi5z8xz2l08m9d81x6qqbfr1nyy57";
-  };
+    src = fetchurl {
+      url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+      sha256 = "18rwql2pi78155l9zp1i50xfi5z8xz2l08m9d81x6qqbfr1nyy57";
+    };
+
+    patches =[
+      # overrides do not respect gsettingsschemasdir
+      # https://gitlab.gnome.org/GNOME/gnome-flashback/issues/9
+      (fetchpatch {
+       url = https://gitlab.gnome.org/GNOME/gnome-flashback/commit/a55530f58ccd600414a5420b287868ab7d219705.patch;
+       sha256 = "1la94lhhb9zlw7bnbpl6hl26zv3kxbsvgx996mhph720wxg426mh";
+      })
+    ];
+
+    # make .desktop Execs absolute
+    postPatch = ''
+      patch -p0 <<END_PATCH
+      +++ data/applications/gnome-flashback-init.desktop.in
+      @@ -4 +4 @@
+      -Exec=gnome-flashback --initialize
+      +Exec=$out/bin/gnome-flashback --initialize
+      +++ data/applications/gnome-flashback.desktop.in
+      @@ -4 +4 @@
+      -Exec=gnome-flashback
+      +Exec=$out/bin/gnome-flashback
+      END_PATCH
+    '';
+
+    postInstall = ''
+      # Check that our expected RequiredComponents match the stock session files, but then don't install them.
+      # They can be installed using mkSessionForWm.
+      grep '${requiredComponents "metacity"}' $out/share/gnome-session/sessions/gnome-flashback-metacity.session || (echo "RequiredComponents have changed, please update gnome-flashback/default.nix."; false)
+
+      rm -r $out/share/gnome-session
+      rm -r $out/share/xsessions
+      rm -r $out/libexec
+    '';
+
+    nativeBuildInputs = [
+      autoreconfHook
+      gettext
+      libxml2
+      pkgconfig
+      wrapGAppsHook
+    ];
+
+    buildInputs = [
+      glib
+      gnome-bluetooth
+      gnome-desktop
+      gsettings-desktop-schemas
+      gtk
+      ibus
+      libcanberra-gtk3
+      libpulseaudio
+      libxkbfile
+      polkit
+      upower
+      xkeyboard_config
+    ];
+
+    doCheck = true;
 
-  patches =[
-    (substituteAll {
-      src = ./fix-paths.patch;
-      inherit metacity;
-      gnomeSession = gnome-session;
-    })
-
-    # overrides do not respect gsettingsschemasdir
-    # https://gitlab.gnome.org/GNOME/gnome-flashback/issues/9
-    (fetchpatch {
-     url = https://gitlab.gnome.org/GNOME/gnome-flashback/commit/a55530f58ccd600414a5420b287868ab7d219705.patch;
-     sha256 = "1la94lhhb9zlw7bnbpl6hl26zv3kxbsvgx996mhph720wxg426mh";
-    })
-  ];
-
-  nativeBuildInputs = [
-    autoreconfHook
-    gettext
-    libxml2
-    pkgconfig
-  ];
-
-  buildInputs = [
-    glib
-    gnome-bluetooth
-    gnome-desktop
-    gsettings-desktop-schemas
-    gtk
-    ibus
-    libcanberra-gtk3
-    libpulseaudio
-    libxkbfile
-    polkit
-    upower
-    xkeyboard_config
-  ];
-
-  doCheck = true;
-
-  enableParallelBuilding = true;
-
-  passthru = {
-    updateScript = gnome3.updateScript {
-      packageName = pname;
-      attrPath = "gnome3.${pname}";
+    enableParallelBuilding = true;
+
+    passthru = {
+      updateScript = gnome3.updateScript {
+        packageName = pname;
+        attrPath = "gnome3.${pname}";
+      };
+
+      mkSessionForWm = { wmName, wmLabel, wmCommand }:
+        let
+          wmApplication = writeTextFile {
+            name = "gnome-flashback-${wmName}-wm";
+            destination = "/share/applications/${wmName}.desktop";
+            text = ''
+              [Desktop Entry]
+              Type=Application
+              Encoding=UTF-8
+              Name=${wmLabel}
+              Exec=${wmCommand}
+              NoDisplay=true
+              X-GNOME-WMName=${wmLabel}
+              X-GNOME-Autostart-Phase=WindowManager
+              X-GNOME-Provides=windowmanager
+              X-GNOME-Autostart-Notify=false
+            '';
+          };
+
+        gnomeSession = writeTextFile {
+          name = "gnome-flashback-${wmName}-gnome-session";
+          destination = "/share/gnome-session/sessions/gnome-flashback-${wmName}.session";
+          text = ''
+            [GNOME Session]
+            Name=GNOME Flashback (${wmLabel})
+            ${requiredComponents wmName}
+          '';
+        };
+
+        executable = writeShellScriptBin "gnome-flashback-${wmName}" ''
+          if [ -z $XDG_CURRENT_DESKTOP ]; then
+            export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"
+          fi
+
+          export XDG_DATA_DIRS=${wmApplication}/share:${gnomeSession}/share:${gnome-flashback}/share:${gnome-panel}/share:$XDG_DATA_DIRS
+
+          exec ${gnome-session}/bin/gnome-session --session=gnome-flashback-${wmName} "$@"
+        '';
+
+      in writeTextFile {
+        name = "gnome-flashback-${wmName}-xsession";
+        destination = "/share/xsessions/gnome-flashback-${wmName}.desktop";
+        text = ''
+          [Desktop Entry]
+          Name=GNOME Flashback (${wmLabel})
+          Comment=This session logs you into GNOME Flashback with ${wmLabel}
+          Exec=${executable}/bin/gnome-flashback-${wmName}
+          TryExec=${wmCommand}
+          Type=Application
+          DesktopNames=GNOME-Flashback;GNOME;
+        '';
+      };
     };
-  };
 
-  meta = with stdenv.lib; {
-    description = "GNOME 2.x-like session for GNOME 3";
-    homepage = https://wiki.gnome.org/Projects/GnomeFlashback;
-    license = licenses.gpl2;
-    maintainers = gnome3.maintainers;
-    platforms = platforms.linux;
+    meta = with stdenv.lib; {
+      description = "GNOME 2.x-like session for GNOME 3";
+      homepage = https://wiki.gnome.org/Projects/GnomeFlashback;
+      license = licenses.gpl2;
+      maintainers = gnome3.maintainers;
+      platforms = platforms.linux;
+    };
   };
-}
+  in gnome-flashback
diff --git a/pkgs/desktops/gnome-3/misc/gnome-flashback/fix-paths.patch b/pkgs/desktops/gnome-3/misc/gnome-flashback/fix-paths.patch
deleted file mode 100644
index 9d5add233d6..00000000000
--- a/pkgs/desktops/gnome-3/misc/gnome-flashback/fix-paths.patch
+++ /dev/null
@@ -1,30 +0,0 @@
---- a/data/Makefile.am
-+++ b/data/Makefile.am
-@@ -22,7 +22,7 @@
- 	             echo 'if [ -z $$XDG_CURRENT_DESKTOP ]; then' && \
- 	             echo '  export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"' && \
- 	             echo 'fi' && echo '' && \
--	             echo 'exec gnome-session --session=gnome-flashback-compiz "$$@"') > $@
-+	             echo 'exec @gnomeSession@/bin/gnome-session --session=gnome-flashback-compiz "$$@"') > $@
- 	$(AM_V_at) chmod a+x $@
- 
- gnome-flashback-metacity: Makefile
-@@ -30,7 +30,7 @@
- 	             echo 'if [ -z $$XDG_CURRENT_DESKTOP ]; then' && \
- 	             echo '  export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"' && \
- 	             echo 'fi' && echo '' && \
--	             echo 'exec gnome-session --session=gnome-flashback-metacity --disable-acceleration-check "$$@"') > $@
-+	             echo 'exec @gnomeSession@/bin/gnome-session --session=gnome-flashback-metacity --disable-acceleration-check "$$@"') > $@
- 	$(AM_V_at) chmod a+x $@
- 
- CLEANFILES = \
---- a/data/xsessions/gnome-flashback-metacity.desktop.in.in
-+++ b/data/xsessions/gnome-flashback-metacity.desktop.in.in
-@@ -2,6 +2,6 @@
- Name=GNOME Flashback (Metacity)
- Comment=This session logs you into GNOME Flashback with Metacity
- Exec=@libexecdir@/gnome-flashback-metacity
--TryExec=metacity
-+TryExec=@metacity@/bin/metacity
- Type=Application
- DesktopNames=GNOME-Flashback;GNOME;
diff --git a/pkgs/desktops/gnome-3/misc/gnome-panel/default.nix b/pkgs/desktops/gnome-3/misc/gnome-panel/default.nix
index b9522e1e3f4..f9cc0a8aa4f 100644
--- a/pkgs/desktops/gnome-3/misc/gnome-panel/default.nix
+++ b/pkgs/desktops/gnome-3/misc/gnome-panel/default.nix
@@ -8,6 +8,7 @@
 , gettext
 , glib
 , gnome-desktop
+, gnome-flashback
 , gnome-menus
 , gnome3
 , gtk
@@ -43,6 +44,23 @@ in stdenv.mkDerivation rec {
     })
   ];
 
+  # make .desktop Exec absolute
+  postPatch = ''
+    patch -p0 <<END_PATCH
+    +++ gnome-panel/gnome-panel.desktop.in
+    @@ -7 +7 @@
+    -Exec=gnome-panel
+    +Exec=$out/bin/gnome-panel
+    END_PATCH
+  '';
+
+  preFixup = ''
+    gappsWrapperArgs+=(
+      --prefix XDG_DATA_DIRS : "${gnome-menus}/share:${gnome-flashback}/share"
+      --prefix XDG_CONFIG_DIRS : "${gnome-menus}/etc/xdg:${gnome-flashback}/etc/xdg"
+    )
+  '';
+
   nativeBuildInputs = [
     autoreconfHook
     gettext
diff --git a/pkgs/desktops/gnome-3/misc/gnome-screensaver/default.nix b/pkgs/desktops/gnome-3/misc/gnome-screensaver/default.nix
new file mode 100644
index 00000000000..be8ab81457e
--- /dev/null
+++ b/pkgs/desktops/gnome-3/misc/gnome-screensaver/default.nix
@@ -0,0 +1,96 @@
+{ stdenv
+, fetchgit
+, fetchurl
+, autoreconfHook
+, dbus-glib
+, glib
+, gnome-common
+, gnome-desktop
+, gnome3
+, gtk
+, gsettings-desktop-schemas
+, pkgconfig
+, intltool
+, pam
+, systemd
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "gnome-screensaver";
+  version = "3.6.1";
+
+  # the original package is deprecated and the Ubuntu version has a number of useful patches
+  src = fetchgit {
+    url = "https://git.launchpad.net/ubuntu/+source/gnome-screensaver";
+    rev =  "4f7b666131dec060a5aac9117f395ac522a627b4";
+    sha256 = "15xqgcpm825cy3rm8pj00qlblq66svmh06lcw8qi74a3g0xcir87";
+  };
+
+  # from debian/patches/series
+  patches = map (patch: "debian/patches/${patch}") [
+    "00git_logind_check.patch"
+    "01_no_autostart.patch"
+    "03_fix_ltsp-fading.patch"
+    "05_dbus_service.patch"
+    "10_legacy_scrsvr_inhibit.patch"
+    "13_nvidia_gamma_fade_fallback.patch"
+    "14_no_fade_on_user_switch.patch"
+    "15_dont_crash_on_no_fade.patch"
+    "16_dont_crash_in_kvm.patch"
+    "17_remove_top_panel.patch"
+    "18_unity_dialog_layout.patch"
+    "24_use_user_settings.patch"
+    "25_fix_lock_command.patch"
+    "27_lightdm_switch_user.patch"
+    "28_blocking_return.patch"
+    "29_handle_expired_creds.patch"
+    # these two patches are ubuntu-specific
+    # "30_ubuntu-lock-on-suspend_gsetting.patch"
+    # "31_lock_screen_on_suspend.patch"
+    "32_input_sources_switcher.patch"
+    "move-not-nuke.patch"
+    "allow-replacement"
+    "libsystemd.patch"
+    "0001-gs-lock-plug-Disconnect-signal-handler-from-right-ob.patch"
+    "33_budgie_support.patch"
+  ] ++ [ ./fix-dbus-service-dir.patch ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+    intltool
+    wrapGAppsHook
+    gnome-common
+    pkgconfig
+  ];
+
+  buildInputs = [
+    glib
+    gtk
+    gnome-desktop
+    dbus-glib
+    pam
+    systemd
+  ];
+
+  configureFlags = [ "--enable-locking" "--with-systemd=yes" ];
+
+  enableParallelBuilding = true;
+
+  doCheck = true;
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      attrPath = "gnome3.${pname}";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    description = "Component of Gnome Flashback that provides screen locking";
+    homepage = https://wiki.gnome.org/Projects/GnomeScreensaver;
+    license = licenses.gpl2Plus;
+    maintainers = gnome3.maintainers;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/desktops/gnome-3/misc/gnome-screensaver/fix-dbus-service-dir.patch b/pkgs/desktops/gnome-3/misc/gnome-screensaver/fix-dbus-service-dir.patch
new file mode 100644
index 00000000000..81e037ee690
--- /dev/null
+++ b/pkgs/desktops/gnome-3/misc/gnome-screensaver/fix-dbus-service-dir.patch
@@ -0,0 +1,11 @@
+--- a/configure.ac  2019-01-20 20:28:01.309231507 +0100
++++ b/configure.ac  2019-01-20 20:31:54.927978927 +0100
+@@ -137,7 +137,7 @@
+ 
+ # Find out where the session service file goes
+ # The sad sed hack is recomended by section 27.10 of the automake manual.
+-DBUS_SESSION_SERVICE_DIR=`pkg-config --variable session_bus_services_dir dbus-1 | sed -e 's,/usr/share,${datarootdir},g'`
++DBUS_SESSION_SERVICE_DIR=`pkg-config --variable session_bus_services_dir dbus-1 --define-variable 'datadir=${datadir}'`
+ AC_SUBST(DBUS_SESSION_SERVICE_DIR)
+ 
+ dnl ---------------------------------------------------------------------------
\ No newline at end of file