fluffychat: 1.22.1 -> 1.23.0 (#364091)
[NixPkgs.git] / pkgs / by-name / gn / gnome-flashback / package.nix
blobafc747c3a3e8f6654a2de8eedbb65de8e278276f
2   stdenv,
3   lib,
4   autoreconfHook,
5   fetchurl,
6   gettext,
7   glib,
8   gnome-bluetooth,
9   gnome-desktop,
10   gnome-panel,
11   gnome-session,
12   gnome,
13   gsettings-desktop-schemas,
14   gtk3,
15   ibus,
16   libcanberra-gtk3,
17   libpulseaudio,
18   libxkbfile,
19   libxml2,
20   pkg-config,
21   polkit,
22   gdm,
23   systemd,
24   upower,
25   pam,
26   wrapGAppsHook3,
27   writeTextFile,
28   xkeyboard_config,
29   xorg,
30   nixosTests,
31   runCommand,
32   buildEnv,
35 let
36   # From data/sessions/Makefile.am
37   requiredComponentsCommon =
38     enableGnomePanel: [ "gnome-flashback" ] ++ lib.optional enableGnomePanel "gnome-panel";
39   requiredComponentsGsd = [
40     "org.gnome.SettingsDaemon.A11ySettings"
41     "org.gnome.SettingsDaemon.Color"
42     "org.gnome.SettingsDaemon.Datetime"
43     "org.gnome.SettingsDaemon.Housekeeping"
44     "org.gnome.SettingsDaemon.Keyboard"
45     "org.gnome.SettingsDaemon.MediaKeys"
46     "org.gnome.SettingsDaemon.Power"
47     "org.gnome.SettingsDaemon.PrintNotifications"
48     "org.gnome.SettingsDaemon.Rfkill"
49     "org.gnome.SettingsDaemon.ScreensaverProxy"
50     "org.gnome.SettingsDaemon.Sharing"
51     "org.gnome.SettingsDaemon.Smartcard"
52     "org.gnome.SettingsDaemon.Sound"
53     "org.gnome.SettingsDaemon.UsbProtection"
54     "org.gnome.SettingsDaemon.Wacom"
55     "org.gnome.SettingsDaemon.XSettings"
56   ];
57   requiredComponents =
58     wmName: enableGnomePanel:
59     "RequiredComponents=${
60       lib.concatStringsSep ";" (
61         [ wmName ] ++ requiredComponentsCommon enableGnomePanel ++ requiredComponentsGsd
62       )
63     };";
65 stdenv.mkDerivation (finalAttrs: {
66   pname = "gnome-flashback";
67   version = "3.54.0";
69   src = fetchurl {
70     url = "mirror://gnome/sources/gnome-flashback/${lib.versions.majorMinor finalAttrs.version}/gnome-flashback-${finalAttrs.version}.tar.xz";
71     hash = "sha256-gkNa4wLNZK6xG25M0YTaj/+qzSSFFf+gIidZXDzPne4=";
72   };
74   # make .desktop Execs absolute
75   postPatch = ''
76     patch -p0 <<END_PATCH
77     +++ data/applications/gnome-flashback.desktop.in
78     @@ -4 +4 @@
79     -Exec=gnome-flashback
80     +Exec=$out/bin/gnome-flashback
81     END_PATCH
82   '';
84   postInstall = ''
85     # Check that our expected RequiredComponents match the stock session files, but then don't install them.
86     # They can be installed using mkSessionForWm.
87     grep '${requiredComponents "metacity" true}' $out/share/gnome-session/sessions/gnome-flashback-metacity.session || (echo "RequiredComponents have changed, please update gnome-flashback/default.nix."; false)
89     rm -r $out/share/gnome-session
90     rm -r $out/share/xsessions
91     rm $out/libexec/gnome-flashback-metacity
92   '';
94   nativeBuildInputs = [
95     autoreconfHook
96     gettext
97     libxml2
98     pkg-config
99     wrapGAppsHook3
100   ];
102   buildInputs = [
103     glib
104     gnome-bluetooth
105     gnome-desktop
106     gsettings-desktop-schemas
107     gtk3
108     ibus
109     libcanberra-gtk3
110     libpulseaudio
111     libxkbfile
112     xorg.libXxf86vm
113     polkit
114     gdm
115     gnome-panel
116     systemd
117     upower
118     pam
119     xkeyboard_config
120   ];
122   doCheck = true;
124   enableParallelBuilding = true;
126   PKG_CONFIG_LIBGNOME_PANEL_LAYOUTSDIR = "${placeholder "out"}/share/gnome-panel/layouts";
127   PKG_CONFIG_LIBGNOME_PANEL_MODULESDIR = "${placeholder "out"}/lib/gnome-panel/modules";
129   passthru = {
130     updateScript = gnome.updateScript {
131       packageName = "gnome-flashback";
132       versionPolicy = "odd-unstable";
133     };
135     mkWmApplication =
136       {
137         wmName,
138         wmLabel,
139         wmCommand,
140       }:
141       writeTextFile {
142         name = "gnome-flashback-${wmName}-wm";
143         destination = "/share/applications/${wmName}.desktop";
144         text = ''
145           [Desktop Entry]
146           Type=Application
147           Encoding=UTF-8
148           Name=${wmLabel}
149           Exec=${wmCommand}
150           NoDisplay=true
151           X-GNOME-WMName=${wmLabel}
152           X-GNOME-Autostart-Phase=WindowManager
153           X-GNOME-Provides=windowmanager
154           X-GNOME-Autostart-Notify=false
155         '';
156       };
158     mkGnomeSession =
159       {
160         wmName,
161         wmLabel,
162         enableGnomePanel,
163       }:
164       writeTextFile {
165         name = "gnome-flashback-${wmName}-gnome-session";
166         destination = "/share/gnome-session/sessions/gnome-flashback-${wmName}.session";
167         text = ''
168           [GNOME Session]
169           Name=GNOME Flashback (${wmLabel})
170           ${requiredComponents wmName enableGnomePanel}
171         '';
172       };
174     mkSessionForWm =
175       {
176         wmName,
177         wmLabel,
178         wmCommand,
179       }:
180       writeTextFile {
181         name = "gnome-flashback-${wmName}-xsession";
182         destination = "/share/xsessions/gnome-flashback-${wmName}.desktop";
183         text = ''
184           [Desktop Entry]
185           Name=GNOME Flashback (${wmLabel})
186           Comment=This session logs you into GNOME Flashback with ${wmLabel}
187           Exec=${gnome-session}/bin/gnome-session --session=gnome-flashback-${wmName}
188           TryExec=${wmCommand}
189           Type=Application
190           DesktopNames=GNOME-Flashback;GNOME;
191         '';
192       }
193       // {
194         providedSessions = [ "gnome-flashback-${wmName}" ];
195       };
197     mkSystemdTargetForWm =
198       {
199         wmName,
200         wmLabel,
201         wmCommand,
202         enableGnomePanel,
203       }:
204       runCommand "gnome-flashback-${wmName}.target" { } ''
205         mkdir -p $out/lib/systemd/user
206         cp -r "${finalAttrs.finalPackage}/lib/systemd/user/gnome-session@gnome-flashback-metacity.target.d" \
207           "$out/lib/systemd/user/gnome-session@gnome-flashback-${wmName}.target.d"
208       '';
210     tests = {
211       inherit (nixosTests) gnome-flashback;
212     };
213   };
215   meta = with lib; {
216     description = "GNOME 2.x-like session for GNOME 3";
217     mainProgram = "gnome-flashback";
218     homepage = "https://gitlab.gnome.org/GNOME/gnome-flashback";
219     changelog = "https://gitlab.gnome.org/GNOME/gnome-flashback/-/blob/${finalAttrs.version}/NEWS?ref_type=tags";
220     license = licenses.gpl2;
221     maintainers = teams.gnome.members;
222     platforms = platforms.linux;
223   };