nixpkgs/pkgs/desktops/gnome-3/misc/gnome-flashback/default.nix
volth f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00

159 lines
5.0 KiB
Nix

{ stdenv
, autoreconfHook
, fetchurl
, gettext
, glib
, gnome-bluetooth
, gnome-desktop
, gnome-panel
, gnome-session
, gnome3
, gsettings-desktop-schemas
, gtk3
, ibus
, libcanberra-gtk3
, libpulseaudio
, libxkbfile
, libxml2
, pkgconfig
, polkit
, upower
, wrapGAppsHook
, writeTextFile
, writeShellScriptBin
, xkeyboard_config
}:
let
pname = "gnome-flashback";
version = "3.32.0";
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 = "0jfzr7vdmnxpxqqa38ni1p3c508xhlnxqpmmqshk3rvrf0afqn62";
};
# 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
gtk3
ibus
libcanberra-gtk3
libpulseaudio
libxkbfile
polkit
upower
xkeyboard_config
];
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;
};
};
in gnome-flashback