lol

Merge pull request #259363 from bobby285271/fix/gnome-flashback

gnome.gnome-flashback: Fix x-d-p-gnome launch

authored by

Bobby Rong and committed by
GitHub
383b753b d5df6206

+110 -81
+10 -4
nixos/modules/services/x11/desktop-managers/gnome.nix
··· 229 229 panelModulePackages = mkOption { 230 230 default = [ pkgs.gnome.gnome-applets ]; 231 231 defaultText = literalExpression "[ pkgs.gnome.gnome-applets ]"; 232 - type = types.listOf types.path; 232 + type = types.listOf types.package; 233 233 description = lib.mdDoc '' 234 234 Packages containing modules that should be made available to `gnome-panel` (usually for applets). 235 235 ··· 294 294 map 295 295 (wm: 296 296 pkgs.gnome.gnome-flashback.mkSessionForWm { 297 - inherit (wm) wmName wmLabel wmCommand enableGnomePanel; 298 - inherit (cfg.flashback) panelModulePackages; 297 + inherit (wm) wmName wmLabel wmCommand; 299 298 } 300 299 ) flashbackWms; 301 300 ··· 309 308 310 309 environment.systemPackages = with pkgs.gnome; [ 311 310 gnome-flashback 312 - ]; 311 + (gnome-panel-with-modules.override { 312 + panelModulePackages = cfg.flashback.panelModulePackages; 313 + }) 314 + ] 315 + # For /share/applications/${wmName}.desktop 316 + ++ (map (wm: gnome-flashback.mkWmApplication { inherit (wm) wmName wmLabel wmCommand; }) flashbackWms) 317 + # For /share/gnome-session/sessions/gnome-flashback-${wmName}.session 318 + ++ (map (wm: gnome-flashback.mkGnomeSession { inherit (wm) wmName wmLabel enableGnomePanel; }) flashbackWms); 313 319 }) 314 320 315 321 (mkIf serviceCfg.core-os-services.enable {
+1 -8
nixos/tests/gnome-flashback.nix
··· 32 32 xauthority = "/run/user/${uid}/gdm/Xauthority"; 33 33 in '' 34 34 with subtest("Login to GNOME Flashback with GDM"): 35 - # wait_for_x() checks graphical-session.target, which is expected to be 36 - # inactive on gnome-flashback before #228946 (i.e. systemd managed 37 - # gnome-session) is done. 38 - # https://github.com/NixOS/nixpkgs/pull/208060 39 - # 40 - # Previously this was unconditionally touched by xsessionWrapper but was 41 - # changed in #233981 (we have GNOME-Flashback:GNOME in XDG_CURRENT_DESKTOP). 42 - # machine.wait_for_x() 35 + machine.wait_for_x() 43 36 machine.wait_until_succeeds('journalctl -t gnome-session-binary --grep "Entering running state"') 44 37 # Wait for alice to be logged in" 45 38 machine.wait_for_unit("default.target", "${user.name}")
+3 -3
pkgs/desktops/gnome/default.nix
··· 238 238 239 239 gnome-flashback = callPackage ./misc/gnome-flashback { }; 240 240 241 - gnome-panel = callPackage ./misc/gnome-panel { 242 - autoreconfHook = pkgs.autoreconfHook269; 243 - }; 241 + gnome-panel = callPackage ./misc/gnome-panel { }; 242 + 243 + gnome-panel-with-modules = callPackage ./misc/gnome-panel/wrapper.nix { }; 244 244 245 245 gnome-tweaks = callPackage ./misc/gnome-tweaks { }; 246 246
+30 -66
pkgs/desktops/gnome/misc/gnome-flashback/default.nix
··· 127 127 versionPolicy = "odd-unstable"; 128 128 }; 129 129 130 - mkSessionForWm = { wmName, wmLabel, wmCommand, enableGnomePanel, panelModulePackages }: 131 - let 132 - wmApplication = writeTextFile { 133 - name = "gnome-flashback-${wmName}-wm"; 134 - destination = "/share/applications/${wmName}.desktop"; 135 - text = '' 136 - [Desktop Entry] 137 - Type=Application 138 - Encoding=UTF-8 139 - Name=${wmLabel} 140 - Exec=${wmCommand} 141 - NoDisplay=true 142 - X-GNOME-WMName=${wmLabel} 143 - X-GNOME-Autostart-Phase=WindowManager 144 - X-GNOME-Provides=windowmanager 145 - X-GNOME-Autostart-Notify=false 146 - ''; 147 - }; 148 - 149 - gnomeSession = writeTextFile { 150 - name = "gnome-flashback-${wmName}-gnome-session"; 151 - destination = "/share/gnome-session/sessions/gnome-flashback-${wmName}.session"; 152 - text = '' 153 - [GNOME Session] 154 - Name=GNOME Flashback (${wmLabel}) 155 - ${requiredComponents wmName enableGnomePanel} 156 - ''; 157 - }; 158 - 159 - # gnome-panel will only look for applets in a single directory so symlink them into here. 160 - panelModulesEnv = buildEnv { 161 - name = "gnome-panel-modules-env"; 162 - # We always want to find the built-in panel applets. 163 - paths = [ gnome-panel gnome-flashback ] ++ panelModulePackages; 164 - pathsToLink = [ "/lib/gnome-panel/modules" ]; 165 - }; 166 - 167 - executable = stdenv.mkDerivation { 168 - name = "gnome-flashback-${wmName}"; 169 - nativeBuildInputs = [ glib wrapGAppsHook ]; 170 - buildInputs = [ gnome-flashback ] ++ lib.optionals enableGnomePanel ([ gnome-panel ] ++ panelModulePackages); 171 - 172 - # We want to use the wrapGAppsHook mechanism to wrap gnome-session 173 - # with the environment that gnome-flashback and gnome-panel need to 174 - # run, including the configured applet packages. This is only possible 175 - # in the fixup phase, so turn everything else off. 176 - dontUnpack = true; 177 - dontConfigure = true; 178 - dontBuild = true; 179 - dontInstall = true; 180 - dontWrapGApps = true; # We want to do the wrapping ourselves. 130 + mkWmApplication = { wmName, wmLabel, wmCommand }: 131 + writeTextFile { 132 + name = "gnome-flashback-${wmName}-wm"; 133 + destination = "/share/applications/${wmName}.desktop"; 134 + text = '' 135 + [Desktop Entry] 136 + Type=Application 137 + Encoding=UTF-8 138 + Name=${wmLabel} 139 + Exec=${wmCommand} 140 + NoDisplay=true 141 + X-GNOME-WMName=${wmLabel} 142 + X-GNOME-Autostart-Phase=WindowManager 143 + X-GNOME-Provides=windowmanager 144 + X-GNOME-Autostart-Notify=false 145 + ''; 146 + }; 181 147 182 - # gnome-flashback and gnome-panel need to be added to XDG_DATA_DIRS so that their .desktop files can be found by gnome-session. 183 - # We need to pass the --builtin flag so that gnome-session invokes gnome-session-binary instead of systemd. 184 - # If systemd is used, it doesn't use the environment we set up here and so it can't find the .desktop files. 185 - preFixup = '' 186 - makeWrapper ${gnome-session}/bin/gnome-session $out \ 187 - --add-flags "--session=gnome-flashback-${wmName} --builtin" \ 188 - --set-default XDG_CURRENT_DESKTOP 'GNOME-Flashback:GNOME' \ 189 - --prefix XDG_DATA_DIRS : '${lib.makeSearchPath "share" ([ wmApplication gnomeSession gnome-flashback ] ++ lib.optional enableGnomePanel gnome-panel)}' \ 190 - "''${gappsWrapperArgs[@]}" \ 191 - ${lib.optionalString enableGnomePanel "--set NIX_GNOME_PANEL_MODULESDIR '${panelModulesEnv}/lib/gnome-panel/modules'"} 192 - ''; 193 - }; 148 + mkGnomeSession = { wmName, wmLabel, enableGnomePanel }: 149 + writeTextFile { 150 + name = "gnome-flashback-${wmName}-gnome-session"; 151 + destination = "/share/gnome-session/sessions/gnome-flashback-${wmName}.session"; 152 + text = '' 153 + [GNOME Session] 154 + Name=GNOME Flashback (${wmLabel}) 155 + ${requiredComponents wmName enableGnomePanel} 156 + ''; 157 + }; 194 158 195 - in 159 + mkSessionForWm = { wmName, wmLabel, wmCommand }: 196 160 writeTextFile 197 161 { 198 162 name = "gnome-flashback-${wmName}-xsession"; ··· 201 165 [Desktop Entry] 202 166 Name=GNOME Flashback (${wmLabel}) 203 167 Comment=This session logs you into GNOME Flashback with ${wmLabel} 204 - Exec=${executable} 168 + Exec=${gnome-session}/bin/gnome-session --session=gnome-flashback-${wmName} 205 169 TryExec=${wmCommand} 206 170 Type=Application 207 171 DesktopNames=GNOME-Flashback;GNOME; ··· 211 175 }; 212 176 213 177 mkSystemdTargetForWm = { wmName, wmLabel, wmCommand, enableGnomePanel }: 214 - runCommand "gnome-flashback-${wmName}.target" {} '' 178 + runCommand "gnome-flashback-${wmName}.target" { } '' 215 179 mkdir -p $out/lib/systemd/user 216 180 cp -r "${gnome-flashback}/lib/systemd/user/gnome-session@gnome-flashback-metacity.target.d" \ 217 181 "$out/lib/systemd/user/gnome-session@gnome-flashback-${wmName}.target.d"
+66
pkgs/desktops/gnome/misc/gnome-panel/wrapper.nix
··· 1 + { stdenv 2 + , lib 3 + , buildEnv 4 + , gnome-panel 5 + , gnome-flashback 6 + , xorg 7 + , glib 8 + , wrapGAppsHook 9 + , panelModulePackages ? [ ] 10 + }: 11 + 12 + let 13 + # We always want to find the built-in panel applets. 14 + selectedPanelModulePackages = [ gnome-panel gnome-flashback ] ++ panelModulePackages; 15 + 16 + panelModulesEnv = buildEnv { 17 + name = "gnome-panel-modules-env"; 18 + paths = selectedPanelModulePackages; 19 + pathsToLink = [ "/lib/gnome-panel/modules" ]; 20 + }; 21 + in 22 + stdenv.mkDerivation { 23 + pname = "${gnome-panel.pname}-with-modules"; 24 + inherit (gnome-panel) version; 25 + 26 + nativeBuildInputs = [ 27 + glib 28 + wrapGAppsHook 29 + ]; 30 + 31 + buildInputs = selectedPanelModulePackages ++ 32 + lib.forEach selectedPanelModulePackages (x: x.buildInputs or [ ]); 33 + 34 + dontUnpack = true; 35 + dontConfigure = true; 36 + dontBuild = true; 37 + 38 + preferLocalBuild = true; 39 + allowSubstitutes = false; 40 + 41 + installPhase = '' 42 + runHook preInstall 43 + 44 + mkdir -p $out 45 + ${xorg.lndir}/bin/lndir -silent ${gnome-panel} $out 46 + 47 + rm -r $out/lib/gnome-panel/modules 48 + ${xorg.lndir}/bin/lndir -silent ${panelModulesEnv} $out 49 + 50 + rm $out/share/applications/gnome-panel.desktop 51 + 52 + substitute ${gnome-panel}/share/applications/gnome-panel.desktop \ 53 + $out/share/applications/gnome-panel.desktop --replace \ 54 + "Exec=${gnome-panel}/bin/gnome-panel" "Exec=$out/bin/gnome-panel" 55 + 56 + runHook postInstall 57 + ''; 58 + 59 + preFixup = '' 60 + gappsWrapperArgs+=( 61 + --set NIX_GNOME_PANEL_MODULESDIR "$out/lib/gnome-panel/modules" 62 + ) 63 + ''; 64 + 65 + meta = gnome-panel.meta // { outputsToInstall = [ "out" ]; }; 66 + }