Merge pull request #53695 from chpatrick/gnome-flashback-session

nixos/gnome3: add GNOME Flashback sessions option
This commit is contained in:
Jan Tojnar 2019-01-21 12:01:32 +01:00 committed by GitHub
commit dd3626c036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 316 additions and 88 deletions

View File

@ -36,6 +36,8 @@ let
${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/
'';
flashbackEnabled = cfg.flashback.enableMetacity || length cfg.flashback.customSessions > 0;
in {
options = {
@ -71,6 +73,36 @@ in {
};
debug = mkEnableOption "gnome-session debug messages";
flashback = {
enableMetacity = mkEnableOption "Enable the standard GNOME Flashback session with Metacity.";
customSessions = mkOption {
type = types.listOf (types.submodule {
options = {
wmName = mkOption {
type = types.str;
description = "The filename-compatible name of the window manager to use.";
example = "xmonad";
};
wmLabel = mkOption {
type = types.str;
description = "The pretty name of the window manager to use.";
example = "XMonad";
};
wmCommand = mkOption {
type = types.str;
description = "The executable of the window manager to use.";
example = "\${pkgs.haskellPackages.xmonad}/bin/xmonad";
};
};
});
default = [];
description = "Other GNOME Flashback sessions to enable.";
};
};
};
environment.gnome3.excludePackages = mkOption {
@ -113,7 +145,9 @@ in {
services.telepathy.enable = mkDefault true;
networking.networkmanager.enable = mkDefault true;
services.upower.enable = config.powerManagement.enable;
services.dbus.packages = mkIf config.services.printing.enable [ pkgs.system-config-printer ];
services.dbus.packages =
optional config.services.printing.enable pkgs.system-config-printer ++
optional flashbackEnabled pkgs.gnome3.gnome-screensaver;
services.colord.enable = mkDefault true;
services.packagekit.enable = mkDefault true;
hardware.bluetooth.enable = mkDefault true;
@ -127,7 +161,15 @@ in {
fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell-fonts ];
services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ];
services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ]
++ map
(wm: pkgs.gnome3.gnome-flashback.mkSessionForWm {
inherit (wm) wmName wmLabel wmCommand;
}) (optional cfg.flashback.enableMetacity {
wmName = "metacity";
wmLabel = "Metacity";
wmCommand = "${pkgs.gnome3.metacity}/bin/metacity";
} ++ cfg.flashback.customSessions);
environment.extraInit = ''
${concatMapStrings (p: ''
@ -177,6 +219,9 @@ in {
"/share/nautilus-python/extensions"
];
security.pam.services.gnome-screensaver = mkIf flashbackEnabled {
enableGnomeKeyring = true;
};
};

View File

@ -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 = ''

View File

@ -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 { };

View File

@ -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 =[
(substituteAll {
src = ./fix-paths.patch;
inherit metacity;
gnomeSession = gnome-session;
})
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";
})
];
# 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
'';
nativeBuildInputs = [
autoreconfHook
gettext
libxml2
pkgconfig
];
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)
buildInputs = [
glib
gnome-bluetooth
gnome-desktop
gsettings-desktop-schemas
gtk
ibus
libcanberra-gtk3
libpulseaudio
libxkbfile
polkit
upower
xkeyboard_config
];
rm -r $out/share/gnome-session
rm -r $out/share/xsessions
rm -r $out/libexec
'';
doCheck = true;
nativeBuildInputs = [
autoreconfHook
gettext
libxml2
pkgconfig
wrapGAppsHook
];
enableParallelBuilding = true;
buildInputs = [
glib
gnome-bluetooth
gnome-desktop
gsettings-desktop-schemas
gtk
ibus
libcanberra-gtk3
libpulseaudio
libxkbfile
polkit
upower
xkeyboard_config
];
passthru = {
updateScript = gnome3.updateScript {
packageName = pname;
attrPath = "gnome3.${pname}";
doCheck = true;
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

View File

@ -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;

View File

@ -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

View File

@ -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;
};
}

View File

@ -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 ---------------------------------------------------------------------------