gnome.gnome-panel-with-modules: init
Setting X_GNOME_PANEL_MODULESDIR in gnome-session wrapper is confusing to me.
This commit is contained in:
parent
55c124cadb
commit
f6345cd259
4 changed files with 78 additions and 22 deletions
|
@ -229,7 +229,7 @@ in
|
|||
panelModulePackages = mkOption {
|
||||
default = [ pkgs.gnome.gnome-applets ];
|
||||
defaultText = literalExpression "[ pkgs.gnome.gnome-applets ]";
|
||||
type = types.listOf types.path;
|
||||
type = types.listOf types.package;
|
||||
description = lib.mdDoc ''
|
||||
Packages containing modules that should be made available to `gnome-panel` (usually for applets).
|
||||
|
||||
|
@ -295,7 +295,6 @@ in
|
|||
(wm:
|
||||
pkgs.gnome.gnome-flashback.mkSessionForWm {
|
||||
inherit (wm) wmName wmLabel wmCommand enableGnomePanel;
|
||||
inherit (cfg.flashback) panelModulePackages;
|
||||
}
|
||||
) flashbackWms;
|
||||
|
||||
|
@ -309,6 +308,9 @@ in
|
|||
|
||||
environment.systemPackages = with pkgs.gnome; [
|
||||
gnome-flashback
|
||||
(gnome-panel-with-modules.override {
|
||||
panelModulePackages = cfg.flashback.panelModulePackages;
|
||||
})
|
||||
];
|
||||
})
|
||||
|
||||
|
|
|
@ -240,6 +240,8 @@ lib.makeScope pkgs.newScope (self: with self; {
|
|||
|
||||
gnome-panel = callPackage ./misc/gnome-panel { };
|
||||
|
||||
gnome-panel-with-modules = callPackage ./misc/gnome-panel/wrapper.nix { };
|
||||
|
||||
gnome-tweaks = callPackage ./misc/gnome-tweaks { };
|
||||
|
||||
gpaste = callPackage ./misc/gpaste { };
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
, upower
|
||||
, pam
|
||||
, wrapGAppsHook
|
||||
, makeWrapper
|
||||
, writeTextFile
|
||||
, xkeyboard_config
|
||||
, xorg
|
||||
|
@ -127,7 +128,7 @@ let
|
|||
versionPolicy = "odd-unstable";
|
||||
};
|
||||
|
||||
mkSessionForWm = { wmName, wmLabel, wmCommand, enableGnomePanel, panelModulePackages }:
|
||||
mkSessionForWm = { wmName, wmLabel, wmCommand, enableGnomePanel }:
|
||||
let
|
||||
wmApplication = writeTextFile {
|
||||
name = "gnome-flashback-${wmName}-wm";
|
||||
|
@ -156,28 +157,15 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
# gnome-panel will only look for applets in a single directory so symlink them into here.
|
||||
panelModulesEnv = buildEnv {
|
||||
name = "gnome-panel-modules-env";
|
||||
# We always want to find the built-in panel applets.
|
||||
paths = [ gnome-panel gnome-flashback ] ++ panelModulePackages;
|
||||
pathsToLink = [ "/lib/gnome-panel/modules" ];
|
||||
};
|
||||
|
||||
executable = stdenv.mkDerivation {
|
||||
name = "gnome-flashback-${wmName}";
|
||||
nativeBuildInputs = [ glib wrapGAppsHook ];
|
||||
buildInputs = [ gnome-flashback ] ++ lib.optionals enableGnomePanel ([ gnome-panel ] ++ panelModulePackages);
|
||||
|
||||
# We want to use the wrapGAppsHook mechanism to wrap gnome-session
|
||||
# with the environment that gnome-flashback and gnome-panel need to
|
||||
# run, including the configured applet packages. This is only possible
|
||||
# in the fixup phase, so turn everything else off.
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
dontInstall = true;
|
||||
dontWrapGApps = true; # We want to do the wrapping ourselves.
|
||||
|
||||
# gnome-flashback and gnome-panel need to be added to XDG_DATA_DIRS so that their .desktop files can be found by gnome-session.
|
||||
# We need to pass the --builtin flag so that gnome-session invokes gnome-session-binary instead of systemd.
|
||||
|
@ -186,9 +174,7 @@ let
|
|||
makeWrapper ${gnome-session}/bin/gnome-session $out \
|
||||
--add-flags "--session=gnome-flashback-${wmName} --builtin" \
|
||||
--set-default XDG_CURRENT_DESKTOP 'GNOME-Flashback:GNOME' \
|
||||
--prefix XDG_DATA_DIRS : '${lib.makeSearchPath "share" ([ wmApplication gnomeSession gnome-flashback ] ++ lib.optional enableGnomePanel gnome-panel)}' \
|
||||
"''${gappsWrapperArgs[@]}" \
|
||||
${lib.optionalString enableGnomePanel "--set NIX_GNOME_PANEL_MODULESDIR '${panelModulesEnv}/lib/gnome-panel/modules'"}
|
||||
--prefix XDG_DATA_DIRS : '${lib.makeSearchPath "share" [ wmApplication gnomeSession gnome-flashback ]}'
|
||||
'';
|
||||
};
|
||||
|
||||
|
@ -211,7 +197,7 @@ let
|
|||
};
|
||||
|
||||
mkSystemdTargetForWm = { wmName, wmLabel, wmCommand, enableGnomePanel }:
|
||||
runCommand "gnome-flashback-${wmName}.target" {} ''
|
||||
runCommand "gnome-flashback-${wmName}.target" { } ''
|
||||
mkdir -p $out/lib/systemd/user
|
||||
cp -r "${gnome-flashback}/lib/systemd/user/gnome-session@gnome-flashback-metacity.target.d" \
|
||||
"$out/lib/systemd/user/gnome-session@gnome-flashback-${wmName}.target.d"
|
||||
|
|
66
pkgs/desktops/gnome/misc/gnome-panel/wrapper.nix
Normal file
66
pkgs/desktops/gnome/misc/gnome-panel/wrapper.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, buildEnv
|
||||
, gnome-panel
|
||||
, gnome-flashback
|
||||
, xorg
|
||||
, glib
|
||||
, wrapGAppsHook
|
||||
, panelModulePackages ? [ ]
|
||||
}:
|
||||
|
||||
let
|
||||
# We always want to find the built-in panel applets.
|
||||
selectedPanelModulePackages = [ gnome-panel gnome-flashback ] ++ panelModulePackages;
|
||||
|
||||
panelModulesEnv = buildEnv {
|
||||
name = "gnome-panel-modules-env";
|
||||
paths = selectedPanelModulePackages;
|
||||
pathsToLink = [ "/lib/gnome-panel/modules" ];
|
||||
};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "${gnome-panel.pname}-with-modules";
|
||||
inherit (gnome-panel) version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
glib
|
||||
wrapGAppsHook
|
||||
];
|
||||
|
||||
buildInputs = selectedPanelModulePackages ++
|
||||
lib.forEach selectedPanelModulePackages (x: x.buildInputs or [ ]);
|
||||
|
||||
dontUnpack = true;
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
${xorg.lndir}/bin/lndir -silent ${gnome-panel} $out
|
||||
|
||||
rm -r $out/lib/gnome-panel/modules
|
||||
${xorg.lndir}/bin/lndir -silent ${panelModulesEnv} $out
|
||||
|
||||
rm $out/share/applications/gnome-panel.desktop
|
||||
|
||||
substitute ${gnome-panel}/share/applications/gnome-panel.desktop \
|
||||
$out/share/applications/gnome-panel.desktop --replace \
|
||||
"Exec=${gnome-panel}/bin/gnome-panel" "Exec=$out/bin/gnome-panel"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
gappsWrapperArgs+=(
|
||||
--set NIX_GNOME_PANEL_MODULESDIR "$out/lib/gnome-panel/modules"
|
||||
)
|
||||
'';
|
||||
|
||||
meta = gnome-panel.meta // { outputsToInstall = [ "out" ]; };
|
||||
}
|
Loading…
Reference in a new issue