2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
2020-08-20 17:08:02 +00:00
|
|
|
, nix-update-script
|
2020-04-24 23:36:52 +00:00
|
|
|
, substituteAll
|
2020-07-18 16:06:22 +00:00
|
|
|
, desktop-file-utils
|
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, writeScript
|
|
|
|
, pantheon
|
|
|
|
, gnome-keyring
|
|
|
|
, gnome-session
|
|
|
|
, wingpanel
|
|
|
|
, orca
|
|
|
|
, onboard
|
|
|
|
, at-spi2-core
|
|
|
|
, elementary-default-settings
|
|
|
|
, elementary-settings-daemon
|
|
|
|
, runtimeShell
|
|
|
|
, writeText
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
#
|
|
|
|
# ─── ENSURES PLANK GETS ELEMENTARY'S DEFAULT DOCKITEMS ────────────────────────────
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Upstream relies on /etc/skel to initiate a new users home directory with plank's dockitems.
|
|
|
|
#
|
|
|
|
# That is not possible within nixos, but we can achieve this easily with a simple script that copies
|
|
|
|
# them. We then use a xdg autostart and initalize it during the "EarlyInitialization" phase of a gnome session
|
|
|
|
# which is most appropriate for installing files into $HOME.
|
|
|
|
#
|
|
|
|
|
|
|
|
dockitems-script = writeScript "dockitems-script" ''
|
|
|
|
#!${runtimeShell}
|
|
|
|
|
|
|
|
elementary_default_settings="${elementary-default-settings}"
|
|
|
|
dock_items="$elementary_default_settings/etc/skel/.config/plank/dock1/launchers"/*
|
|
|
|
|
|
|
|
if [ ! -d "$HOME/.config/plank/dock1" ]; then
|
|
|
|
echo "Instantiating default Plank Dockitems..."
|
|
|
|
|
|
|
|
mkdir -p "$HOME/.config/plank/dock1/launchers"
|
|
|
|
cp -r --no-preserve=mode,ownership $dock_items "$HOME/.config/plank/dock1/launchers/"
|
|
|
|
else
|
|
|
|
echo "Plank Dockitems already instantiated"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
dockitemAutostart = writeText "default-elementary-dockitems.desktop" ''
|
|
|
|
[Desktop Entry]
|
|
|
|
Type=Application
|
|
|
|
Name=Instantiate Default elementary dockitems
|
|
|
|
Exec=${dockitems-script}
|
|
|
|
StartupNotify=false
|
|
|
|
NoDisplay=true
|
|
|
|
OnlyShowIn=Pantheon;
|
|
|
|
X-GNOME-Autostart-Phase=EarlyInitialization
|
|
|
|
'';
|
|
|
|
|
|
|
|
executable = writeScript "pantheon" ''
|
2020-10-16 20:44:37 +00:00
|
|
|
# gnome-session can find RequiredComponents for `pantheon` session (notably pantheon's patched g-s-d autostarts)
|
|
|
|
export XDG_CONFIG_DIRS=@out@/etc/xdg:$XDG_CONFIG_DIRS
|
|
|
|
|
|
|
|
# Make sure we use our gtk-3.0/settings.ini
|
|
|
|
export XDG_CONFIG_DIRS=${elementary-default-settings}/etc:$XDG_CONFIG_DIRS
|
|
|
|
|
|
|
|
# * gnome-session can find the `pantheon' session
|
|
|
|
# * use pantheon-mimeapps.list
|
2020-04-24 23:36:52 +00:00
|
|
|
export XDG_DATA_DIRS=@out@/share:$XDG_DATA_DIRS
|
2020-10-16 20:44:37 +00:00
|
|
|
|
|
|
|
# Start pantheon session. Keep in sync with upstream
|
|
|
|
exec ${gnome-session}/bin/gnome-session --builtin --session=pantheon "$@"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Absolute path patched version of the upstream xsession
|
|
|
|
xsession = writeText "pantheon.desktop" ''
|
|
|
|
[Desktop Entry]
|
|
|
|
Name=Pantheon
|
|
|
|
Comment=This session provides elementary experience
|
|
|
|
Exec=@out@/libexec/pantheon
|
|
|
|
TryExec=${wingpanel}/bin/wingpanel
|
|
|
|
Icon=
|
|
|
|
DesktopNames=Pantheon
|
|
|
|
Type=Application
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-07-18 16:06:22 +00:00
|
|
|
pname = "elementary-session-settings-unstable";
|
2020-10-16 20:44:37 +00:00
|
|
|
version = "2020-07-06";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
repoName = "session-settings";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "elementary";
|
|
|
|
repo = repoName;
|
2020-10-16 20:44:37 +00:00
|
|
|
rev = "fa15cbd83fba0ba30e9a302db880350bff5ace52";
|
|
|
|
hash = "sha256-26H791c7OAjFYtjVChIatICSocMt0uTej1TKBOvw+6w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2020-07-18 16:06:22 +00:00
|
|
|
desktop-file-utils
|
2020-04-24 23:36:52 +00:00
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2020-07-18 16:06:22 +00:00
|
|
|
pantheon.elementary-settings-daemon
|
|
|
|
gnome-keyring
|
|
|
|
onboard
|
|
|
|
orca
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
mesonFlags = [
|
2020-07-18 16:06:22 +00:00
|
|
|
"-Dmimeapps-list=false"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-Dfallback-session=GNOME"
|
2020-07-18 16:06:22 +00:00
|
|
|
"-Ddetect-program-prefixes=true"
|
|
|
|
"--sysconfdir=${placeholder "out"}/etc"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
2020-10-16 20:44:37 +00:00
|
|
|
# our mimeapps patched from upstream to exclude:
|
|
|
|
# * pantheon-mail -> geary
|
|
|
|
# * evince.desktop -> org.gnome.Evince.desktop
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/share/applications
|
|
|
|
cp -av ${./pantheon-mimeapps.list} $out/share/applications/pantheon-mimeapps.list
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
# instantiates pantheon's dockitems
|
2020-04-24 23:36:52 +00:00
|
|
|
cp "${dockitemAutostart}" $out/etc/xdg/autostart/default-elementary-dockitems.desktop
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
# script `Exec` to start pantheon
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/libexec
|
|
|
|
substitute ${executable} $out/libexec/pantheon --subst-var out
|
|
|
|
chmod +x $out/libexec/pantheon
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
# absolute path patched xsession
|
|
|
|
substitute ${xsession} $out/share/xsessions/pantheon.desktop --subst-var out
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
2020-08-20 17:08:02 +00:00
|
|
|
updateScript = nix-update-script {
|
2020-04-24 23:36:52 +00:00
|
|
|
attrPath = "pantheon.${pname}";
|
|
|
|
};
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
providedSessions = [
|
|
|
|
"pantheon"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Session settings for elementary";
|
|
|
|
homepage = "https://github.com/elementary/session-settings";
|
|
|
|
license = licenses.lgpl3;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = pantheon.maintainers;
|
|
|
|
};
|
|
|
|
}
|