Merge pull request #45058 from michaelpj/imp/freedesktop-modules

freedesktop modules: init

Changed files
+155 -36
nixos
+8 -20
nixos/modules/config/system-path.nix
···
description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
};
};
system = {
···
"/etc/gtk-3.0"
"/lib" # FIXME: remove and update debug-info.nix
"/sbin"
-
"/share/applications"
-
"/share/desktop-directories"
"/share/emacs"
-
"/share/icons"
-
"/share/menus"
-
"/share/mime"
"/share/nano"
"/share/org"
"/share/themes"
···
# outputs TODO: note that the tools will often not be linked by default
postBuild =
''
-
if [ -x $out/bin/update-mime-database -a -w $out/share/mime ]; then
-
XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null
-
fi
-
if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
$out/bin/gtk-update-icon-cache $out/share/icons/hicolor
fi
···
if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
$out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
fi
-
-
if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then
-
$out/bin/update-desktop-database $out/share/applications
-
fi
-
-
if [ -x $out/bin/install-info -a -w $out/share/info ]; then
-
shopt -s nullglob
-
for i in $out/share/info/*.info $out/share/info/*.info.gz; do
-
$out/bin/install-info $i $out/share/info/dir
-
done
-
fi
'';
};
···
description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
};
+
extraSetup = mkOption {
+
type = types.lines;
+
default = "";
+
description = "Shell fragments to be run after the system environment has been created. This should only be used for things that need to modify the internals of the environment, e.g. generating MIME caches. The environment being built can be accessed at $out.";
+
};
+
};
system = {
···
"/etc/gtk-3.0"
"/lib" # FIXME: remove and update debug-info.nix
"/sbin"
"/share/emacs"
"/share/nano"
"/share/org"
"/share/themes"
···
# outputs TODO: note that the tools will often not be linked by default
postBuild =
''
if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
$out/bin/gtk-update-icon-cache $out/share/icons/hicolor
fi
···
if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
$out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
fi
+
+
${config.environment.extraSetup}
'';
};
+22
nixos/modules/config/xdg/autostart.nix
···
···
+
{ config, lib, ... }:
+
+
with lib;
+
{
+
options = {
+
xdg.autostart.enable = mkOption {
+
type = types.bool;
+
default = true;
+
description = ''
+
Whether to install files to support the
+
<link xlink:href="https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html">XDG Autostart specification</link>.
+
'';
+
};
+
};
+
+
config = mkIf config.xdg.autostart.enable {
+
environment.pathsToLink = [
+
"/etc/xdg/autostart"
+
];
+
};
+
+
}
+27
nixos/modules/config/xdg/icons.nix
···
···
+
{ config, lib, ... }:
+
+
with lib;
+
{
+
options = {
+
xdg.icons.enable = mkOption {
+
type = types.bool;
+
default = true;
+
description = ''
+
Whether to install files to support the
+
<link xlink:href="https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html">XDG Icon Theme specification</link>.
+
'';
+
};
+
};
+
+
config = mkIf config.xdg.icons.enable {
+
environment.pathsToLink = [
+
"/share/icons"
+
"/share/pixmaps"
+
];
+
+
environment.profileRelativeEnvVars = {
+
XCURSOR_PATH = [ "/share/icons" ];
+
};
+
};
+
+
}
+25
nixos/modules/config/xdg/menus.nix
···
···
+
{ config, lib, ... }:
+
+
with lib;
+
{
+
options = {
+
xdg.menus.enable = mkOption {
+
type = types.bool;
+
default = true;
+
description = ''
+
Whether to install files to support the
+
<link xlink:href="https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html">XDG Desktop Menu specification</link>.
+
'';
+
};
+
};
+
+
config = mkIf config.xdg.menus.enable {
+
environment.pathsToLink = [
+
"/share/applications"
+
"/share/desktop-directories"
+
"/etc/xdg/menus"
+
"/etc/xdg/menus/applications-merged"
+
];
+
};
+
+
}
+36
nixos/modules/config/xdg/mime.nix
···
···
+
{ config, lib, pkgs, ... }:
+
+
with lib;
+
{
+
options = {
+
xdg.mime.enable = mkOption {
+
type = types.bool;
+
default = true;
+
description = ''
+
Whether to install files to support the
+
<link xlink:href="https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html">XDG Shared MIME-info specification</link> and the
+
<link xlink:href="https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html">XDG MIME Applications specification</link>.
+
'';
+
};
+
};
+
+
config = mkIf config.xdg.mime.enable {
+
environment.pathsToLink = [ "/share/mime" ];
+
+
environment.systemPackages = [
+
# this package also installs some useful data, as well as its utilities
+
pkgs.shared-mime-info
+
];
+
+
environment.extraSetup = ''
+
if [ -w $out/share/mime ]; then
+
XDG_DATA_DIRS=$out/share ${pkgs.shared-mime-info}/bin/update-mime-database -V $out/share/mime > /dev/null
+
fi
+
+
if [ -w $out/share/applications ]; then
+
${pkgs.desktop-file-utils}/bin/update-desktop-database $out/share/applications
+
fi
+
'';
+
};
+
+
}
+8
nixos/modules/misc/documentation.nix
···
environment.systemPackages = [ pkgs.texinfoInteractive ];
environment.pathsToLink = [ "/share/info" ];
environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo";
})
(mkIf cfg.doc.enable {
···
environment.systemPackages = [ pkgs.texinfoInteractive ];
environment.pathsToLink = [ "/share/info" ];
environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo";
+
environment.extraSetup = ''
+
if [ -w $out/share/info ]; then
+
shopt -s nullglob
+
for i in $out/share/info/*.info $out/share/info/*.info.gz; do
+
${pkgs.texinfo}/bin/install-info $i $out/share/info/dir
+
done
+
fi
+
'';
})
(mkIf cfg.doc.enable {
+4
nixos/modules/module-list.nix
···
./config/fonts/fontdir.nix
./config/fonts/fonts.nix
./config/fonts/ghostscript.nix
./config/gnu.nix
./config/i18n.nix
./config/iproute2.nix
···
./config/fonts/fontdir.nix
./config/fonts/fonts.nix
./config/fonts/ghostscript.nix
+
./config/xdg/autostart.nix
+
./config/xdg/icons.nix
+
./config/xdg/menus.nix
+
./config/xdg/mime.nix
./config/gnu.nix
./config/i18n.nix
./config/iproute2.nix
-1
nixos/modules/programs/environment.nix
···
GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ];
XDG_CONFIG_DIRS = [ "/etc/xdg" ];
XDG_DATA_DIRS = [ "/share" ];
-
XCURSOR_PATH = [ "/share/icons" ];
MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
LIBEXEC_PATH = [ "/lib/libexec" ];
};
···
GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ];
XDG_CONFIG_DIRS = [ "/etc/xdg" ];
XDG_DATA_DIRS = [ "/share" ];
MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
LIBEXEC_PATH = [ "/lib/libexec" ];
};
+7 -3
nixos/modules/services/networking/xrdp.nix
···
config = mkIf cfg.enable {
-
# copied from <nixos/modules/services/x11/xserver.nix>
# xrdp can run X11 program even if "services.xserver.enable = false"
-
environment.pathsToLink =
-
[ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
fonts.enableDefaultFonts = mkDefault true;
systemd = {
···
config = mkIf cfg.enable {
# xrdp can run X11 program even if "services.xserver.enable = false"
+
xdg = {
+
autostart.enable = true;
+
menus.enable = true;
+
mime.enable = true;
+
icons.enable = true;
+
};
+
fonts.enableDefaultFonts = mkDefault true;
systemd = {
+7 -2
nixos/modules/services/x11/desktop-managers/enlightenment.nix
···
pkgs.xorg.xauth # used by kdesu
pkgs.gtk2 # To get GTK+'s themes.
pkgs.tango-icon-theme
-
pkgs.shared-mime-info
pkgs.gnome2.gnomeicontheme
pkgs.xorg.xcursorthemes
];
-
environment.pathsToLink = [ "/etc/enlightenment" "/etc/xdg" "/share/enlightenment" "/share/elementary" "/share/applications" "/share/locale" "/share/icons" "/share/themes" "/share/mime" "/share/desktop-directories" ];
services.xserver.desktopManager.session = [
{ name = "Enlightenment";
···
pkgs.xorg.xauth # used by kdesu
pkgs.gtk2 # To get GTK+'s themes.
pkgs.tango-icon-theme
+
pkgs.gnome2.gnomeicontheme
pkgs.xorg.xcursorthemes
];
+
environment.pathsToLink = [
+
"/etc/enlightenment"
+
"/share/enlightenment"
+
"/share/elementary"
+
"/share/locale"
+
];
services.xserver.desktopManager.session = [
{ name = "Enlightenment";
+1 -2
nixos/modules/services/x11/desktop-managers/lumina.nix
···
# Link some extra directories in /run/current-system/software/share
environment.pathsToLink = [
-
"/share/desktop-directories"
-
"/share/icons"
"/share/lumina"
"/share"
];
···
# Link some extra directories in /run/current-system/software/share
environment.pathsToLink = [
"/share/lumina"
+
# FIXME: modules should link subdirs of `/share` rather than relying on this
"/share"
];
+4 -1
nixos/modules/services/x11/desktop-managers/plasma5.nix
···
++ lib.optional config.services.colord.enable colord-kde
++ lib.optionals config.services.samba.enable [ kdenetwork-filesharing pkgs.samba ];
-
environment.pathsToLink = [ "/share" ];
environment.etc = singleton {
source = xcfg.xkbDir;
···
++ lib.optional config.services.colord.enable colord-kde
++ lib.optionals config.services.samba.enable [ kdenetwork-filesharing pkgs.samba ];
+
environment.pathsToLink = [
+
# FIXME: modules should link subdirs of `/share` rather than relying on this
+
"/share"
+
];
environment.etc = singleton {
source = xcfg.xkbDir;
-5
nixos/modules/services/x11/desktop-managers/xfce.nix
···
tango-icon-theme
xfce4-icon-theme
-
desktop-file-utils
-
shared-mime-info
-
# Needed by Xfce's xinitrc script
# TODO: replace with command -v
which
···
environment.pathsToLink = [
"/share/xfce4"
"/share/themes"
-
"/share/mime"
-
"/share/desktop-directories"
"/share/gtksourceview-2.0"
];
···
tango-icon-theme
xfce4-icon-theme
# Needed by Xfce's xinitrc script
# TODO: replace with command -v
which
···
environment.pathsToLink = [
"/share/xfce4"
"/share/themes"
"/share/gtksourceview-2.0"
];
+6 -2
nixos/modules/services/x11/xserver.nix
···
]
++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh;
-
environment.pathsToLink =
-
[ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
# The default max inotify watches is 8192.
# Nowadays most apps require a good number of inotify watches,
···
]
++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh;
+
xdg = {
+
autostart.enable = true;
+
menus.enable = true;
+
mime.enable = true;
+
icons.enable = true;
+
};
# The default max inotify watches is 8192.
# Nowadays most apps require a good number of inotify watches,